Shadow Volumes on GPU

What it says on the tin: a place to discuss proposed new features.
Post Reply
Alexander K
Gnoblar
Posts: 4
Joined: Wed May 23, 2007 6:16 am

Shadow Volumes on GPU

Post by Alexander K »

Did somebody Shadow volumes full_on_GPU? I think, that its good idea for underground FPS. Like Prey )
Need help: shaders, links, similar topics...

Sorry my english))
voxel
Gnome
Posts: 334
Joined: Wed Aug 02, 2006 9:27 am
Location: Toronto, Canada

Re: Shadow Volumes on GPU

Post by voxel »

Alexander K wrote:Did somebody Shadow volumes full_on_GPU? I think, that its good idea for underground FPS. Like Prey )
Need help: shaders, links, similar topics...

Sorry my english))
I was under the impression that shadow volumes were almost solely on the GPU (after the models have degenerate quads on the edges). The extrusion is done in the vertex shader and the rendering is stencil buffer / pixel shaders. Sorry, it's been 5-6 years since I've deal with them. What do people do on the CPU with shadow volumes these days?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Calculating the light facing in order to calculate the silhouette.

There are ways to put everything on the GPU but it requires a hell of a lot of extra geometry and just isn't worth it. Texture shadows are the future for GPU driven shadows.
voxel
Gnome
Posts: 334
Joined: Wed Aug 02, 2006 9:27 am
Location: Toronto, Canada

Post by voxel »

sinbad wrote:Calculating the light facing in order to calculate the silhouette.
Crap forgot about "finding which edges" to extrude.
sinbad wrote: There are ways to put everything on the GPU but it requires a hell of a lot of extra geometry and just isn't worth it. Texture shadows are the future for GPU driven shadows.
Are you talking about shadow maps? Up until I read about Variance Shadow Maps I found SM fraught with aliasing (too dependant on resolution and light distance) and precision issues (z and perspective projection). I want something like Deep Shadow Maps implemented on the GPU - i.e each pixel is a "linear function." I also had great hopes for Pre-computed radiance transfer until I actually tried it - you need dense meshes and a long pre-computation time.

I kinda like the sharp / discontinuous shadows that shadow volumes gives ;-)
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
x 18
Contact:

Post by PolyVox »

voxel wrote:I also had great hopes for Pre-computed radiance transfer until I actually tried it - you need dense meshes and a long pre-computation time.
What is Pre-computed radiance transfer? Are they dynamic? ('precomputed' implies not - but you mention them alongside shadow maps/volumes...). And I have dense mehes so they sound interesting.
voxel
Gnome
Posts: 334
Joined: Wed Aug 02, 2006 9:27 am
Location: Toronto, Canada

Post by voxel »

esuvs wrote:
voxel wrote:I also had great hopes for Pre-computed radiance transfer until I actually tried it - you need dense meshes and a long pre-computation time.
What is Pre-computed radiance transfer? Are they dynamic? ('precomputed' implies not - but you mention them alongside shadow maps/volumes...). And I have dense mehes so they sound interesting.
PRT is an extension of the "spherical harmonics" rendering research.

In SH - lighting (i.e a light dome) is converted into 3D function kinda like how Fast Fourier Transform converts a wave signal into co-efficients for 2D sin + cosine. This allows you to do diffuse lighting using HDR domes (better than directional lighting) without needing to an environment/image map to sample. You don't even need a model in this process. The HDR light dome gets converted to a 3D function (3 x 9 co-efficients) through a offline process which then can be plugged into an vertex shader. You passe a vertex normal into this 3D function / Vertex shader and get a colour back.

PRT uses multiple SH representations - one for the light dome, one for shadowing / self-shadowing, and another for glossy / interreflections (i.e red shirt bleeds onto white face). To get the best results you need dense meshes because PRT/SH is vertex-based and PRT builds a virtual light-dome at every vertex (so 3D function exists at every vertex) whereas SH is model-independent (one 3D function for the entire world).
So if you have 100k vertices you'll have 100k 3D functions also (27 co-efficients). The data size is brutal.

PRT is light-independent, but if the model deforms everything breaks. You can get some beautiful cars / spaceships rendered using this method. Changing the lighting on the fly costs zero as all self-shading + glossy reflections are "pre-computed" (the light paths are, but not the values).

It doesn't have much use in games to be honest. I think it makes for great rendering in main menus / UI selection screens or in single room games. Normal SH rendering, I believe, is pretty common - it's super cheap and easy. I'm sure I've missed out on the advances in the past three years so my knowledge might be out of date.
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
x 18
Contact:

Post by PolyVox »

Well thanks for the info :) It sounds interesting but if it breaks when the model is deformed then I can't use it in my project. Plus I'm gonna be tight on memory as it is... It always good to know about new techniques though!
Post Reply