Jump to content
  • Advertisement
Sign in to follow this  
DirectXFreak

Shadow Volumes with a pixel shader?

This topic is 4803 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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].

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!