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: 775
Joined: Wed May 05, 2010 12:16 pm

Modifiable rendering order

Post by Rado1 »

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: 200
Joined: Sun Feb 09, 2014 4:42 pm

Re: Modifiable rendering order

Post by Imerion »

Sound logical, yes. And a drop down for choosing, so backwards compatibility is kept sounds like a good solution!
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: Modifiable rendering order

Post by rrTea »

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: 775
Joined: Wed May 05, 2010 12:16 pm

Re: Modifiable rendering order

Post by Rado1 »

Sure, all we have older and current projects; so backward compatibility is a must.
User avatar
VilleK
Site Admin
Posts: 2321
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Modifiable rendering order

Post by VilleK »

I've implemented this feature now. Please download latest beta and give it a try.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Re: Modifiable rendering order

Post by Rado1 »

Great! Ville, thank you. I'll test it this evening.
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Re: Modifiable rendering order

Post by Imerion »

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: 475
Joined: Sat Feb 15, 2014 9:54 am

Nice!

Post by rrTea »

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