|
From: Roger H. <rog...@mi...> - 2007-03-13 14:03:33
|
On 13 Mar, 2007, at 01:04, James Walker wrote: > Roger Holmes wrote: > >>> In answer to the question "why do they have to be known before >>> StartRender time", my answer is: because any OpenGL-based renderer >>> needs >>> to have the lights set up before you render anything that should be >>> lit >>> by said lights. >> >> Well if that is a restriction of OpenGL then fair enough. I just >> think that no processing of lights can be done until a (non shadow) >> renderer has the Z buffer set up with depths and references to the >> triangles, and whilst the renderer builds the list of triangles (and >> culls some) it could have set up the list of lights whilst it parsed >> the group structures. > > Either I'm misunderstanding you, or you have a mental model of > rendering > that doesn't correspond to the way any of our built-in renderers work. > There isn't any separate phase of setting up the Z buffer with depths > and references to triangles. There's a continuous process of breaking > triangles into fragments, updating the Z and color buffers with new > fragment data, and so on. Once a particular triangle has passed > through > the pipeline, there is no opportunity to change the way it has been > lit. No. My mental model is that of the plug-in (shadow) renderer we ship for Quesa, which I wrote. To speed up rendering, I do not do the slow calculations for the texturing, shading, lighting (and shadowing) of a z buffer pixel until I know it is front most. Game programmers have control of their data and can cull lots of stuff which is behind other items, but for fully user defined data this is not easy, probably impossible without using more time than it saves. So for each front most pixel there are dozens behind, and with user defined ordering of the data that means I can save doing the calculations for many of them. Roger. |