D3D10 Shadow Mapping
#61
Posted 20 February 2009 - 10:33 AM
BTW no problem, i will add the small value and will let you know.
Thank you again for all your help.
Mabye i i would gave up without you!
#62
Posted 20 February 2009 - 02:28 PM
#63
Posted 20 February 2009 - 10:53 PM
XVincentX said:
I'd wager that with that addition of an epsilon it would work with >= too.
Quote
You're welcome :) I'm glad I was of some help :) Even if it did take far too long to figure out the issues :lol:
#64
Posted 25 February 2009 - 09:12 PM
A) I just tested that, pointing the spotlight ON the shadowed zone gave by the point light: as i expected, the shader draws still black.
So i tried to replace this code
return (PointLight + SpotLight) * BaseColor * ShadowValue * CubeValue;
with
return (PointLight + SpotLight) * BaseColor * (ShadowValue || CubeValue);
Hoping that the OR on the ints would leave lighted at least the points lighted by a light source.
B) Can you suggest me a good way to avoid black shadow and simply give less light (i already did it but i want to make it in another way, if possible)?
Thank you.
#65
Posted 25 February 2009 - 10:00 PM
B) You could try
(ambientColour + (PointLight * CubeValue) + (SpotLight * ShadowValue)) * SampledTextureColour;
PointLight * CubeValue means that you will light, with the point light, any section that isn't in shadow. If in shadow then it will add nothing to the ambient colour. The same goes for the SpotLight * ShadowValue. However it will allow you to have a difference between things lit by the point light but in the shadow of the spot light or lit by the spot light and in the shadow of the point, or in shadow of both or in shadow of neither. This gives you far more control.
Essentially when doing multipass rendering, ala Doom3, this is what you would be doing. You would do an ambient pass. And then do a pass for each light where you add the contribution from that light (or not if in shadow). You would then multiply the whole thing by the texture colour.
Of course once you have done that you can then add specular highlights on top of that whole lot. But that might just be complicating matters further ;)
I'd strongly recommend doing some reading on how the lighting pipeline works.
This page is a good start: http://msdn.microsof...178(VS.85).aspx
Its also worth looking into the physics of lighting itself, the RGB colour model and additive colours. Once you understand HOW light contributes to a surface you will have a much better understanding of how direct lighting works :)
A quick flick found this: http://www.rgbworld.com/color.html
#66
Posted 26 February 2009 - 11:07 AM

Mabye the point light on the lamp lights also the wall and reduces shadow?
Thanks for the links and yes, i really have to read something more about lights, i'm completely on 0 (just lambert and phong)
#67
Posted 26 February 2009 - 11:57 AM
#68
Posted 26 February 2009 - 12:00 PM
#69
Posted 26 February 2009 - 02:59 PM
As a suggestion, sometimes when debugging thinks like this, it may help if you change objects and positions from time to time, you may find a bug just doing this and looking the new results.
Good luck!
#70
Posted 26 February 2009 - 03:28 PM
There is still a lot to do.
A) Make a decent scene with good illumination
B) Make a camera system (the one i'm using is owful, if you can suggest me one "Maya Like" it would be great)
C) Use some more advanced shadow mapping alghoritm.
P.S.
I made sense of strange post hours...i'm not from USA or Canada, so when you see 5.00 AM here are 10 o clock...but do you REALLY post at that time???
#71
Posted 26 February 2009 - 06:21 PM
#72
Posted 28 February 2009 - 12:10 PM

The less "darkness" of shadow is due to point light contribution?
#73
Posted 28 February 2009 - 03:23 PM
XVincentX said:
Behind the car? Cos yes if thats what you mean. If you turn on a torch and it casts a shadow if you then place a light behind the object casting the shadow then the shadow will get washed out by the new light ...
#74
Posted 01 March 2009 - 10:07 AM
I tried to reduce it to 100x100 or 200x200, and the antialiasing comes out. So the PSM and TSM are used to reduce antialiasing of little textures (in front of backbuffer size)?
#75
Posted 01 March 2009 - 07:10 PM
Of course its worth noting that unless you are right up against the wall its nto actually worth, in many case, wasting time doing anti-aliasing.
If itg looks good as is then its not worth wasting time making it look a tiny percent better. Only bother when its needed and save your GPU time for where its really needed.
#76
Posted 01 March 2009 - 08:34 PM
I checked on nvidia developer site, and i found A LOT of other shadow map implementation:
Parallel-Split Shadow Maps
Variance Shadow Maps
Percentage-Closer Filtering
Perspective Shadow Maps
Trapezoidal Shadow Maps
What could be the "must" to learn about it?
#77
Posted 01 March 2009 - 10:43 PM
XVincentX said:
I checked on nvidia developer site, and i found A LOT of other shadow map implementation:
Parallel-Split Shadow Maps
Variance Shadow Maps
Percentage-Closer Filtering
Perspective Shadow Maps
Trapezoidal Shadow Maps
What could be the "must" to learn about it?
Learn any one of them inside out. Once you've learnt it you'll find it easier to get your head round the others. Each method has its advantage and its disadvantages. The learning process teaches yyou when to use one over another :) It take a while, though ... good luck!
#78
Posted 02 March 2009 - 02:47 PM
#79
Posted 02 March 2009 - 11:52 PM
I just wanted to try without the usual gaussian blur.
So i modified my code in pixel shader:
int ShadowValue = (step((LightToVecDist/FarClip),SpotShadow.x) && Atten != 0);
float lit = (float2)0.0f;
float E_x2 = SpotShadow.y;
float Ex_2 = SpotShadow.x * SpotShadow.x;
float variance = E_x2 - Ex_2;
float mD = SpotShadow.x - (LightToVecDist/FarClip);
float mD_2 = mD * mD;
float p = variance / (variance + mD_2);
lit = max( p, ShadowValue );
LightToVec = In.WPos - LightInfo.xyz;
LightToVecDist = length(LightToVec);
float CubeShadow = Cubemap.Sample(SamplText,(LightToVec/LightToVecDist));
int CubeValue = step((LightToVecDist / FarClip),CubeShadow);
float4 SpotLight = (Atten * dot( In.Nor, LightToVecDirection ));
return ((PointLight * CubeValue) + (SpotLight * lit) + 0.1f) * BaseColor;
And obiously modified the depth pass
return float2(depth,pow(depth,2));
But it does not work: the shadow remains perfectly the same.
BTW, a concept is not really clear to me.
Why have i to store depth^2 in the second channel and retrive it?
Can't i compute it directly in Pixel shader retriving original depth?
Anyway, reading original paper, i have to scale light intensity by lit value. But how? Dividing?
Thank you.
#80
Posted 03 March 2009 - 09:56 PM

It's something due to limited 32bit precision?
I do not think it, becouse the code
float E_x2 = SpotShadow.y; float Ex_2 = SpotShadow.x * SpotShadow.x;Are the SAME thing!!!!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












