Modifiable rendering order

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
Rado1
Posts: 770
Joined: Wed May 05, 2010 12:16 pm

Modifiable rendering order

Post by Rado1 » Thu Oct 06, 2016 7:37 am

Obviously, in my projects I use (or at least would like to use) ZApplication.OnRender for drawing background of the whole application, AppState.OnRender to draw an overlay specific for given application state, Model.OnRender to render model's basic shape and ModelState.OnRender to render model state's specific overlay parts. So more specific OnRender section should add more specific rendering artifacts. Unfortunately, ZGE uses different rendering order, so for instance, when someone tries to render transparent model sprites on top of background rendered by ZApplication.OnRender, he obtains sprite squares where alpha channel is drawn with application's ClearColor, because models are rendered before ZApplication.OnRender. Therefore, it is necessary to render background as a Model. This is not so convenient.

I'm suggesting the following rendering order which for many cases is more logical:

1. ZApplication.OnRender
2. AppState.OnRender if it is active
3. Model.OnRender for each model instance depending on Model.RenderOrder
4. ModelState.OnRender if it is active

Because we do not want to corrupt backward compatibility, the best solution is to add the Application.RenderOrder property with a dropdown for choosing between "ModelsBeforeApp" or "AppBeforeModels", and the default is ModelsBeforeApp. This proposal has been discussed already with Ville who agrees, but we would like to know your opinion. Do you agree with the proposal?

Imerion
Posts: 197
Joined: Sun Feb 09, 2014 4:42 pm

Re: Modifiable rendering order

Post by Imerion » Sun Oct 09, 2016 7:28 am

Sound logical, yes. And a drop down for choosing, so backwards compatibility is kept sounds like a good solution!

User avatar
rrTea
Posts: 335
Joined: Sat Feb 15, 2014 9:54 am

Re: Modifiable rendering order

Post by rrTea » Tue Oct 11, 2016 4:33 am

Yes it makes sense, but please don't forget to keep the option to select the rendering order ;) (I'm in the middle of a project that relies heavily on the current method.)

User avatar
Rado1
Posts: 770
Joined: Wed May 05, 2010 12:16 pm

Re: Modifiable rendering order

Post by Rado1 » Tue Oct 11, 2016 6:21 am

Sure, all we have older and current projects; so backward compatibility is a must.

User avatar
VilleK
Site Admin
Posts: 1951
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Modifiable rendering order

Post by VilleK » Fri Oct 14, 2016 1:02 pm

I've implemented this feature now. Please download latest beta and give it a try.

User avatar
Rado1
Posts: 770
Joined: Wed May 05, 2010 12:16 pm

Re: Modifiable rendering order

Post by Rado1 » Fri Oct 14, 2016 1:17 pm

Great! Ville, thank you. I'll test it this evening.

Imerion
Posts: 197
Joined: Sun Feb 09, 2014 4:42 pm

Re: Modifiable rendering order

Post by Imerion » Sun Oct 30, 2016 11:24 pm

Tested it! Both modes seemed to work fine, though there were no difference for my project. I was thinking it might help with one of the rendering errors in the Android-version of my latest game, but it didn't help. Though I realize now that I misunderstood what this was supposed to do, so it wasn't strange nothing happened. ;)

User avatar
rrTea
Posts: 335
Joined: Sat Feb 15, 2014 9:54 am

Nice!

Post by rrTea » Mon Oct 31, 2016 3:59 am

Works here! It's definitely nice to have both options (the old rendering method was very useful for rendering HUDs for example). Thanks Ville :)

Post Reply