Advertisement

Shadows casting with ppl

Started by June 24, 2004 07:23 AM
4 comments, last by lc_overlord 20 years, 5 months ago
does someone know where i can find some good tutorial or refereces about shadows with per pixel lighting? also, i need to use not vendor extension like the nvidia's one or ati (pratically i would like a base code that runs on every video card... later i'll work on optimization)
What exactly do you mean by 'shadow casting with ppl'? If by ppl you mean bump-mapping/parallax-mapping then do you want to know about macro-level shadows (i.e. shadows cast by geometry) or micro-level shadows (i.e. shadows cast by the bumps)? Either way, you best bets would probably be the nvidia and ati websites (some of their stuff will use vendor extensions, but a fair amount of it is vendor independent - basic shadow map and shadow volume algorithms for example) and google.

Enigma
Advertisement
'shadow casting with ppl' stands for any kind of shadowing tecniques while using per pixel lighting
Well, shadow casting and PPL are not that much directly connected as you may think. There is ALOT of material about shadowing on the internet. You might want to read a few papers about it before you start implementing anything.
You should never let your fears become the boundaries of your dreams.
If you want hard shadows then you might want to look at shadow volumes. I have a few screenshots in my journal showing the kind of effect you can get (see developer journals at the top of the page). Essentially, you extrude the silhouettes of your meshes to get shadow volumes, you render the unlit scene, and you render to the stencil buffer where the shadow volumes intersect other objects. You can then use the stencil buffer to render the lit areas of the scene. See here for a more complete description.

Shadow volumes have a few disadvantages, namely that you have to render the shadowed multiple times, and it uses a huge amount of fill-rate.

Shadow maps are the main other technique. This is basically an image-based approach whereby you render a z-buffer from the light's POV and use that to calculate the shadowed pixels when you render your scene. You can get good "fake" soft shadows with shadow mapping, and it tends to fit into a rendering system better than shadow volumes, but there are problems with it too. You need a very high res shadow map to get decent shadows, and the quality degrades where geometry is far from the light source. Also, only nvidia currently have proper support for linear filtered shadow maps via OpenGL. To do it with ATi requires a fragment program work-around, which isn't as good.

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

My preference is z-fail stencil volume shadows.
If done right they are acurate, no artifacts(save for the obvious lack of softness, but there are ways around that to) and they are pretty simple to implement even without pixel/vertex shaders.

The downside is that they are fairly slow, but with the help of doublesided stencil and other small enhancements the speed is acceptable.

This topic is closed to new replies.

Advertisement