Skip to main content
gamedev.net
🔒 Locked

Avoid Shadow Volume Self Shadowing?

Started by pangplast 6 replies 1.2k views
Original Post
pangplast
pangplast
Hi! I''ve finally decided to use the Shadow Volume method in the DX9 sample. Mostly since I havent found a working shadow mapping or ZFail sample for dx9. Anyhow, It looks good and all but what I really want to do is to use a low-pygon model for the shadow volume and project it only on the ground. Maybe I even want to use a sinple box as a carshadow. Can anyone please give me a hint on what to do to avoid shadow volumes shadowing themselves? Project Website http://buggy.vaultcity.org/ .Pangplast
Screenshos of "Humanoid invasion": http://humanoid.vaultcity.org/
pangplast
pangplast
I figures so too. I might have distorted the code some... I''m going to try to remove the airplane in the sample but I do believe I''ve tried that before. I have to get back to you on that one.

Anyhow here''s what it looks like when rendering the shadow and not the caster.

http://buggy.vaultcity.org/buggy/bmxkid/shadow.gif
Screenshos of "Humanoid invasion": http://humanoid.vaultcity.org/
pangplast
pangplast
Here is the DX9 sample airplane rendering just the shadow.

http://buggy.vaultcity.org/buggy/bmxkid/shadow2.gif

.Pangplast
Screenshos of "Humanoid invasion": http://humanoid.vaultcity.org/
neneboricua19
neneboricua19
quote:
Original post by pangplast
Hi! I've finally decided to use the Shadow Volume method in the DX9 sample. Mostly since I havent found a working shadow mapping or ZFail sample for dx9.


shadow mapping:
DX9 - http://www.ati.com/developer/samples/dx9/ShadowMap.html
DX8 - http://www.ati.com/developer/samples/shadowmap.html
OpenGL and DirectX - http://developer.nvidia.com/object/hwshadowmap_paper.html
quote:
Original post by pangplast
Anyhow, It looks good and all but what I really want to do is to use a low-pygon model for the shadow volume and project it only on the ground. Maybe I even want to use a sinple box as a carshadow.


Look up "planar shadows" or "projection shadows".
quote:
Original post by pangplast
Can anyone please give me a hint on what to do to avoid shadow volumes shadowing themselves?


Normally, you wouldn't want to do that. Most applications *want* objects to be able to shadow themselves, because that's what happens in the real world. Shadow Maps and Shadow Volumes allow you to do this. If you don't want self-shadowing, there are other less robust (and simpler) shadowing techniques you can use.

neneboricua

[edited by - neneboricua19 on June 6, 2004 3:24:16 PM]
Etnu
Etnu
The only reason I could see for not having self-shadowing would be for some sort of special effect (a character that cast''s a shadow, even though light doesn''t seem to effect him directly?)
---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
pangplast
pangplast
Ok. Self shadowing is a good thing and it looks cool and all. However I wish to use a low-polygon moden for the shadow for two reasons.

1. It''s faster
2. I can without too much cpu calculate if camera is inside a volume.

Now if I use a low-polygon model to shadow the real model it will produce side effects such as the low-poly model shadowing itself. (And this is bad).

Why the shadow model shadows itself I can''t understand either since ZWRITE is turned off in the two renderpasses.

The same problem exists in the DX9 sample too. (Basically tha same code that I use).

Now does anyone know if there''s a way to solve this problem?

If anyone could point me to a working shadow mapping sample that works with most cards and DX9 that would kick-ass to.

.Pangplast
Screenshos of "Humanoid invasion": http://humanoid.vaultcity.org/
neneboricua19
neneboricua19
quote:
Original post by pangplast
Ok. Self shadowing is a good thing and it looks cool and all. However I wish to use a low-polygon moden for the shadow for two reasons.

1. It''s faster
2. I can without too much cpu calculate if camera is inside a volume.

Now if I use a low-polygon model to shadow the real model it will produce side effects such as the low-poly model shadowing itself. (And this is bad).


It''s to be expected that lower quality models will produce lower quality shadows. Especially when using a technique like Shadow Volumes, which is *very* dependent upon the quality of the geometry.
quote:
Original post by pangplast
If anyone could point me to a working shadow mapping sample that works with most cards and DX9 that would kick-ass to.


The links I posted previously apply to pretty much any hardware. The white paper from NVIDIA explains the theory and basic steps in pretty good detail. The only problem is that they assume you''re using NVIDIA hardware which has the ability to use depth buffers as textures.

If you take the ideas from the NVIDIA white paper and then look at the ATI samples, you''ll see that it''s very easy to make the ATI samples run on any hardware. As a matter of fact, the ATI''s DX8 shadow mapping sample will run on any hardware. The main difference between their DX8 and DX9 samples is that the DX9 sample uses floating point textures. Just change the render target type to be some other format and it should run just fine on any DX9 hardware.

neneboricua

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.