1 registered members (AndrewAMD),
1,248
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
looking for "Z Buffer" Shadow
#360544
02/24/11 20:41
02/24/11 20:41
|
Joined: May 2008
Posts: 301
Oxy
OP
Senior Member
|
OP
Senior Member
Joined: May 2008
Posts: 301
|
Hi, Im looking for a simple Shadow Shader, that uses the Z-Buffer technique. Such as: http://en.wikipedia.org/wiki/Shadow_mappingThe shadows dont need to have a good resolution. They mainly need to be fast. Just like this example:
|
|
|
Re: looking for "Z Buffer" Shadow
[Re: Superku]
#360549
02/24/11 21:04
02/24/11 21:04
|
Joined: May 2008
Posts: 301
Oxy
OP
Senior Member
|
OP
Senior Member
Joined: May 2008
Posts: 301
|
|
|
|
Re: looking for "Z Buffer" Shadow
[Re: Oxy]
#360550
02/24/11 21:10
02/24/11 21:10
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
If you don't mind getting a little more complicated, there's a CSM tutorial on my website here. More specifically, it's how to adapt the shadowmapping.c code Superku pointed you to into Cascaded Shadow Mapping, which is relatively easy but effective over huge distances. Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: looking for "Z Buffer" Shadow
[Re: Oxy]
#360565
02/25/11 01:05
02/25/11 01:05
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
I believe my tutorial also makes the shadows mix more nicely with the standard lighting.
Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: looking for "Z Buffer" Shadow
[Re: Oxy]
#360572
02/25/11 02:06
02/25/11 02:06
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
It is possible to use fewer views. There is also room to make it faster, with functions that have been added since then in A8 (such as view_check). If you want to use just the widest view, it's mostly be just the same as the original shadowmapping.c example with a couple of changes. If I were you, I'd use:
return tex2D(TexSampler,inTex) * min(fShadow, fDiffuse);
This will make a smooth transition from the cast shadow to the diffuse lighting. Then, if you need the shadow to be less dark, change fDark near the beginning of the .fx file. The way it is set up, you'll need to add the shadow stuff into each different material manually if you want them to receive shadows. Out of curiosity, what are your system specs? And what kind of framerate are you getting? Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
|