PDA

View Full Version : Back to front question..



kaysoft
11-25-2002, 01:14 AM
When we are taking about rendering from back to front, are we saying that we Render the farthest object first and then the nearest, or do we mean that we need to render objects at a certain depth?

I hope you understand my question!

mikael_aronsson
11-25-2002, 02:33 AM
It means rendering from back to from, at least as far as I know.

Side note: Rendering from front to back is normally a better way to do it when you have a depth buffer because then the objects that are far away will be dropped at the depth test.

Mikael

vladk
11-25-2002, 09:22 PM
Depth buffer actually allows you to draw in random manner, without having to sort objects first. Actually, depth buffer does work per-pixel, not per-object, which means that when an object is drawn, individual pixels are checked against depth buffer to see if at that pixel some other pixel was drawn. If it was, and is CLOSER than new pixel, the new pixel is discarded; if it is FURTHER, the new pixel replaces the old. Nevertheless, you can decide how your depth-testing is done (which one gets rejected).

BUT, for certain situations (blending for example) you will have to sort your objects and draw them either front-to-back or back-to-front.

Bear in mind that simple sorting algorithms can only decide against object CENTERS, which is not a good solution for complex geometry. You can sort per-primitive (triangles or quads), but consider your rendering FPS when you have 5000+ primitives in your scene...


[This message has been edited by vladk (edited 11-25-2002).]

mikael_aronsson
11-25-2002, 11:23 PM
Hi !

Sorry if I was unclear, what I meant was that some time you can speed up the rendering by sorting the depth order because then you would render objects close to the viewer first, smaller object far away can then be dropped at the depth test and the number of writes to the framebuffer would be minimized, if that has any effect on modern Zbuffer hardware is another thing.

Mikael

kaysoft
11-26-2002, 02:03 AM
k, thanks!