• Create Account

### #Actuallipsryme

Posted 15 December 2012 - 02:48 PM

Hey guys, if you've read my old thread where I tried to implement deferred cascaded shadow maps using MJP's examples...
Basically what I did was delete everything and start from the basics.
I've (for now) manually defined my view and orthographic projection and been trying to project this onto my scene.
The shadow map works fine. My problem (still) seems to be with the actual projection.

What I do is pretty simple:

VSO VS(VSI input)
{
VSO output = (VSO)0;

output.Position = float4(input.Position.xyz, 1.0f);
output.UV = input.UV;

output.PositionVS = mul(input.Position, InverseProjection).xyz;

return output;
}

float4 PS(VSO input) : SV_TARGET0
{
float4 output = float4(0.0f, 0.0f, 0.0f, 1.0f);

float depth = DepthTarget.Sample(PointSampler, input.UV).r;
float3 viewRay = input.ViewRay.xyz;
float4 PositionVS = float4(viewRay * depth, 1.0f);

float4x4 ViewToLightViewProj = mul(InverseView, LightViewProjection);
float4 PositionLS = mul(PositionVS, ViewToLightViewProj);

float LightDepth = PositionLS.z / PositionLS.w;

float2 ShadowUV = PositionLS.xy / PositionLS.w;
ShadowUV.x =  ShadowUV.x / 2.0f + 0.5f;
ShadowUV.y =  ShadowUV.y / -2.0f + 0.5f;

float ShadowTerm = 0;

if(sample0 < LightDepth)
{
}
else
{
}

}


Can someone tell me what I'm fundamentally doing wrong ?

### #9lipsryme

Posted 15 December 2012 - 02:47 PM

Hey guys, if you've read my old thread where I tried to implement deferred cascaded shadow maps using MJP's examples...
Basically what I did was delete everything and start from the basics.
I've (for now) manually defined my view and orthographic projection and been trying to project this onto my scene.
The shadow map works fine. My problem (still) seems to be with the actual projection.

What I do is pretty simple:

VSO VS(VSI input)
{
VSO output = (VSO)0;

output.Position = float4(input.Position.xyz, 1.0f);
output.UV = input.UV;

output.PositionVS = mul(input.Position, InverseProjection).xyz;

return output;
}

float4 PS(VSO input) : SV_TARGET0
{
float4 output = float4(0.0f, 0.0f, 0.0f, 1.0f);

float depth = DepthTarget.Sample(PointSampler, input.UV).r;
float3 viewRay = input.ViewRay.xyz;
float4 PositionVS = float4(viewRay * depth, 1.0f);

float4x4 ViewToLightViewProj = mul(InverseView, LightViewProjection);
float4 PositionLS = mul(PositionVS, ViewToLightViewProj);

float LightDepth = PositionLS.z / PositionLS.w;

float2 ShadowUV = PositionLS.xy / PositionLS.w;
ShadowUV.x =  ShadowUV.x / 2.0f + 0.5f;
ShadowUV.y =  ShadowUV.y / -2.0f + 0.5f;

float ShadowTerm = 0;

if(sample0 < LightDepth)
{
}
else
{
}

}


I'm constructing my geometry's view space position from the HW-depth buffer, then transform back to world space.
Then I multiply this world position with my light's view projection matrix to transform them to the light's space.
When that's done I transform those to UV space and then just sample my shadow map's depth and compare it with the position in light space.
Can someone tell me what I'm fundamentally doing wrong ?

### #8lipsryme

Posted 15 December 2012 - 02:47 PM

Hey guys, if you've read my old thread where I tried to implement deferred cascaded shadow maps using MJP's examples...
Basically what I did was delete everything and start from the basics.
I've (for now) manually defined my view and orthographic projection and been trying to project this onto my scene.
The shadow map works fine. My problem (still) seems to be with the actual projection.

What I do is pretty simple:

VSO VS(VSI input)
{
VSO output = (VSO)0;
output.Position = float4(input.Position.xyz, 1.0f);

output.UV = input.UV;

output.PositionVS = mul(input.Position, InverseProjection).xyz;

return output;
}

float4 PS(VSO input) : SV_TARGET0
{
float4 output = float4(0.0f, 0.0f, 0.0f, 1.0f);

float depth = DepthTarget.Sample(PointSampler, input.UV).r;
float3 viewRay = input.ViewRay.xyz;
float4 PositionVS = float4(viewRay * depth, 1.0f);

float4x4 ViewToLightViewProj = mul(InverseView, LightViewProjection);
float4 PositionLS = mul(PositionVS, ViewToLightViewProj);

float LightDepth = PositionLS.z / PositionLS.w;

float2 ShadowUV = PositionLS.xy / PositionLS.w;
ShadowUV.x =  ShadowUV.x / 2.0f + 0.5f;
ShadowUV.y =  ShadowUV.y / -2.0f + 0.5f;

float ShadowTerm = 0;

if(sample0 < LightDepth)
{
}
else
{
}

}


I'm constructing my geometry's view space position from the HW-depth buffer, then transform back to world space.
Then I multiply this world position with my light's view projection matrix to transform them to the light's space.
When that's done I transform those to UV space and then just sample my shadow map's depth and compare it with the position in light space.
Can someone tell me what I'm fundamentally doing wrong ?

### #7lipsryme

Posted 15 December 2012 - 02:46 PM

Hey guys, if you've read my old thread where I tried to implement deferred cascaded shadow maps using MJP's examples...
Basically what I did was delete everything and start from the basics.
I've (for now) manually defined my view and orthographic projection and been trying to project this onto my scene.
The shadow map works fine. My problem (still) seems to be with the actual projection.

What I do is pretty simple:

VSO VS(VSI input)
{
VSO output = (VSO)0;
output.Position = float4(input.Position.xyz, 1.0f);
output.UV = input.UV;
output.PositionVS = mul(input.Position, InverseProjection).xyz;
return output;
}

float4 PS(VSO input) : SV_TARGET0
{
float4 output = float4(0.0f, 0.0f, 0.0f, 1.0f);

float depth = DepthTarget.Sample(PointSampler, input.UV).r;
float3 viewRay = input.ViewRay.xyz;
float4 PositionVS = float4(viewRay * depth, 1.0f);

float4x4 ViewToLightViewProj = mul(InverseView, LightViewProjection);
float4 PositionLS = mul(PositionVS, ViewToLightViewProj);

float LightDepth = PositionLS.z / PositionLS.w;

float2 ShadowUV = PositionLS.xy / PositionLS.w;
ShadowUV.x =  ShadowUV.x / 2.0f + 0.5f;
ShadowUV.y =  ShadowUV.y / -2.0f + 0.5f;

float ShadowTerm = 0;

if(sample0 < LightDepth)
{
}
else
{
}

}


I'm constructing my geometry's view space position from the HW-depth buffer, then transform back to world space.
Then I multiply this world position with my light's view projection matrix to transform them to the light's space.
When that's done I transform those to UV space and then just sample my shadow map's depth and compare it with the position in light space.
Can someone tell me what I'm fundamentally doing wrong ?

### #6lipsryme

Posted 14 December 2012 - 05:03 PM

Hey guys, if you've read my old thread where I tried to implement deferred cascaded shadow maps using MJP's examples...
Basically what I did was delete everything and start from the basics.
I've (for now) manually defined my view and orthographic projection and been trying to project this onto my scene.
The shadow map works fine. My problem (still) seems to be with the actual projection.

What I do is pretty simple:

VSO VS(VSI input)
{
VSO output = (VSO)0;
output.Position = float4(input.Position.xyz, 1.0f);
output.UV = input.UV;
output.PositionVS = mul(input.Position, InverseProjection).xyz;
return output;
}

float4 PS(VSO input) : SV_TARGET0
{
float4 output = float4(0.0f, 0.0f, 0.0f, 1.0f);
float depth = DepthTarget.Sample(PointSampler, input.UV).r;
float3 viewRay = input.PositionVS.xyz;
float3 PositionVS = viewRay * depth;
float4 PositionWS = mul(float4(PositionVS, 1.0f), InverseView);
float4 PositionLS = mul(PositionWS, LightViewProjection);
PositionLS.xyz /= PositionLS.w;
PositionLS.x = PositionLS.x / 2 + 0.5f;
PositionLS.y = PositionLS.y / -2 + 0.5f;
{
return 0.0f;
}

return 1.0f;
}


I'm constructing my geometry's view space position from the HW-depth buffer, then transform back to world space.
Then I multiply this world position with my light's view projection matrix to transform them to the light's space.
When that's done I transform those to UV space and then just sample my shadow map's depth and compare it with the position in light space.
Can someone tell me what I'm fundamentally doing wrong ?

### #5lipsryme

Posted 14 December 2012 - 04:03 PM

Hey guys, if you've read my old thread where I tried to implement deferred cascaded shadow maps using MJP's examples.
Basically what I did was delete everything and start from the basics.
I've (for now) manually defined my view and orthographic projection and been trying to project this onto my scene.
The shadow map works fine. My problem (still) seems to be with the actual projection.

What I do is pretty simple:

VSO VS(VSI input)
{
VSO output = (VSO)0;
output.Position = float4(input.Position.xyz, 1.0f);
output.UV = input.UV;
output.PositionVS = mul(input.Position, InverseProjection).xyz;
return output;
}

float4 PS(VSO input) : SV_TARGET0
{
float4 output = float4(0.0f, 0.0f, 0.0f, 1.0f);
float depth = DepthTarget.Sample(PointSampler, input.UV).r;
float3 viewRay = input.PositionVS.xyz;
float3 PositionVS = viewRay * depth;
float4 PositionWS = mul(float4(PositionVS, 1.0f), InverseView);
float4 PositionLS = mul(PositionWS, LightViewProjection);
PositionLS.xyz /= PositionLS.w;
PositionLS.x = PositionLS.x / 2 + 0.5f;
PositionLS.y = PositionLS.y / -2 + 0.5f;
{
return 0.0f;
}

return 1.0f;
}


I'm constructing my geometry's view space position from the HW-depth buffer, then transform back to world space.
Then I multiply this world position with my light's view projection matrix to transform them to the light's space.
When that's done I transform those to UV space and then just sample my shadow map's depth and compare it with the position in light space.
Can someone tell me what I'm fundamentally doing wrong ?

PARTNERS