Rendering Order Advice Please

Started by
1 comment, last by Blasteroids 17 years, 8 months ago
Hello all, This is my first attempt at OpenGL programming and engine programming. Its not brilliant but its giving me lots of experience. I have implemented a type of scene graph with automatic bounds calculation and use this for culling and rendering. Currently I am rendering objects as I encouter then in the scene graph, unless they are culled. I should be able to easily extract these into a culling bin for sorting but what order should the objects be rendered in OpenGL? What would be the fastest/correct way of drawing the objects with alpha, etc ? I hope that makes sense :) Here are a couple of images of a very basic engine test; Exe of test http://exoload.net/uploads/806/1155975677.zip Keys Arrows : up/down/left/right camera move C : Culling B : Culling Bounds show M : Mouse look (Limited) If anyone tried test, please post FPSc result at stock load before movement that would be great! Slightly offtopic from OpenGL now, I noticed on one machine that in mouselook its very "jerky" but on others it was not. I am using just window messaging. Has anyone else found this ? Perhaps I would be better off using DirectInput ? Thanks in advance!
Advertisement
If the objects use alpha blending, you will generally need to render in back-to-front (furthest-to-nearest) order for it to look correct.

Without alpha blending rendering order becomes less important, but you may find you get better hardware depth culling by rendering in front-to-back order.

If the scene has objects with and without blending, then try to render all the non-blended objects first, front-to-back, then the blended ones, back-to-front.

Can't help with the jittery mouse problem though, sorry!
reiko,
Thanks for the info, I think I am starting to understand a little.

So I would do this;
1) Enable depth buffer testing.
2) Sort all objects by Z.
3) Render all non-alpha objects from near to far.
4) Render all alpha objects from far to near.

I will try and give that a go when I get some time.

Thanks again for the info.

This topic is closed to new replies.

Advertisement