Having problems converting MJP's shadow mapping sample to DX11

Started by
3 comments, last by lipsryme 11 years, 5 months ago
Hey guys I was looking at mjp's deferred shadow mapping sample (http://mynameismjp.wordpress.com/samples-tutorials-tools/deferred-shadow-maps-sample/) and have been trying to convert this to my c++ dx11 based engine.
The issues I'm having are with the creation of the view and the orthogonal projection matrix for the directional light.

See bottom post...
Advertisement
I have a (non-deferred) DX11 cascaded shadow map implementation using XNAMath in a bunch of the samples that I post on my blog. You could download this one and have a look at the code as a reference.
Thanks I'm gonna have a look at it.
Well I've adopted the code in your QueryProfiling sample but I'm still having problems seeing anything in the shadow map.

Update: Okay so I've managed to get "something" on my texture. I still think there's something wrong with the viewport and the constant variables. Can someone explain what these variables do exactly ? And how I have to set them to get a correct image.


static const float ShadowDist = 1.0f;
static const float Backup = 20.0f; // -20.0f will give me an image
static const float NearClip = 1.0f;
static const float CascadeSplits[4] = { 0.125f, 0.25f, 0.5f, 1.0f };
static const float Bias = 0.005f;
Update: Well now this seems to look a lot better.
http://cl.ly/image/170r1c2L0y0a/Project%202012-11-27%2016-11-13-27.jpg
What I did was invert the light direction. Not sure why MJP's light direction was already inverted there(?).
Plus these values:

const float CascadeSplits[4] = { 0.125f, 0.25f, 0.5f, 1.0f };
const float Bias = 0.005f;
const float ShadowDist = 0.4f;
const float BackupDistance = -1.0f;

The only question left now is how do I make this deferred...

This topic is closed to new replies.

Advertisement