|
![](/i/fill.gif) |
> I was under the impression that most complex GPU effects require rendering
> the entire scene multiple times (in addition to rendering things in a very
> specific order). But hey, what would I know?
You usually want to try and avoid rendering the *entire scene* multiple
times, as this usually involves many relatively slow state changes within
the GPU (ie switching textures and vertex buffers etc). Since complex pixel
shaders became available, this has largely reduced the need for multi-pass
rendering. However some effects still need multiple passes, and in these
situations you try to minimise the amount of stuff drawn multiple times (eg
for a reflection texture you might omit small objects). DX10 has helped
quite a lot here, as it allows you to process a piece of geometry once, yet
output it to several render targets. If you need to do this for a large
number of models it saves a huge amount of time compared to the DX9 method.
Another interesting idea is deferred shading. With this as you go through
the geometry of your scene you don't calculate final lit colour values, but
values to describe the 3D surface at each screen pixel (texture colour,
normal, shinyness etc). This is relatively fast as no lighting calculations
are done. Then once you've drawn all the geometry you end up with a simple
2D array of what is visible. With this you can then run a pixel shader over
it to calculate the final colour values. The advantage is you don't have to
put your lighting code in the shaders for each model, the lighting
calculations only get done for pixels that are visible in the final image,
and it is very cheap to add more lights to the scene. Example here:
http://www.youtube.com/watch?v=hBtfryQBAlk
Post a reply to this message
|
![](/i/fill.gif) |