Shadow Volumes with a pixel shader?

Started by
30 comments, last by Code-R 18 years, 6 months ago
Hi, I recently coded a working shadow volume model into my framework, but when it mixes with the parallax mapping, it looks quite ugly (because it doesn't follow the curves). So my question is, is it possible to code a shadow volume in a pixel shader so that I could offset the current pixel for parallax mapping? Thanks!
--m_nPostCount++
Advertisement
hmm I don't think it's possible. In my opinion, you'll probably have to use shadow mapping which is per-pixel and could probably be modified to works with parallax mapping.
Paic, I don't see how shadowmapping will help since the parallax illusion breaks down at object silhouettes. Maybe it will help if you render parallax mapped shadow-receiver geometry with a shader that outputs modified depth based on the parallax map.
The only way I can foresee doing it is to, when generating the z-only pass, do a depth offset based on the bumps by controlling the depth register in a semantic. That however is NOT a good idea, as that essentially turns off all early z-culling, which significantly reduces speed.
I thought, on some hardware at least, it would only disable early z culling for that pass. Could be wrong though. Anyway, it'd cost, sure, but damn would it be pretty. Besides, it'd work fine for a single quad tech demo[rolleyes].
___________________________________________________David OlsenIf I've helped you, please vote for PigeonGrape!
My modifying z with a pixel shader, you will eliminate culling on gffx and lower for that section of the scene. For gf6, culling will do better, on subsequent passes, but you lose the culling during the pass.

This also effectively will make z compression unusable for those surfaces drawn with z offset.

This will not create proper bumpy silhouettes, but it would allow the shadows to fall onto a bumpy surface better.

Also, the adjusted z values won't be anti-aliased.
Hmmm, doesn't sound worth it to me :-P
Thanks for the info guys
--m_nPostCount++
SimmerD, Thanks for that post, extremely valuable.
Overall, does that mean that Parallax mapping can't be mixed with stencil shadow volumes? I think Eric Lengyel has parallax mapping in his C4 engine, and this engine has -the neatest, IMHO- stenciled soft shadow volumes.
Quote:stenciled soft shadow volumes.


Uhm, you sure he's using stenciled shadow volumes? The only soft shadow volume example I've seen doesn't use the stencil buffer, and isn't enormously practical.
It's perfectly possible to marry stencil shadow volumes with parallax bump mapping, but I never investigated what performance impact it has:

If you want I can try and package up the source for you this evening (uses OpenGL).

Enigma

This topic is closed to new replies.

Advertisement