|
@@ -89,18 +89,7 @@ LightTargetOutput main( ConvexConnectP IN )
|
|
// Eye ray - Eye -> Pixel
|
|
// Eye ray - Eye -> Pixel
|
|
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );
|
|
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );
|
|
float3 viewSpacePos = eyeRay * normDepth.w;
|
|
float3 viewSpacePos = eyeRay * normDepth.w;
|
|
-
|
|
|
|
- //create surface
|
|
|
|
- Surface surface = CreateSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
|
|
|
- uvScene, eyePosWorld, eyeRay, cameraToWorld);
|
|
|
|
- //early out if emissive
|
|
|
|
- if (getFlag(surface.matFlag, 0))
|
|
|
|
- return Output;
|
|
|
|
-
|
|
|
|
- //create surface to light
|
|
|
|
- float3 wsLightDir = mul(cameraToWorld, float4(lightDirection,0)).xyz;
|
|
|
|
- SurfaceToLight surfaceToLight = CreateSurfaceToLight(surface, -wsLightDir);
|
|
|
|
-
|
|
|
|
|
|
+
|
|
// Build light vec, get length, clip pixel if needed
|
|
// Build light vec, get length, clip pixel if needed
|
|
float3 lightToPxlVec = viewSpacePos - lightPosition;
|
|
float3 lightToPxlVec = viewSpacePos - lightPosition;
|
|
float lenLightV = length( lightToPxlVec );
|
|
float lenLightV = length( lightToPxlVec );
|
|
@@ -116,6 +105,17 @@ LightTargetOutput main( ConvexConnectP IN )
|
|
clip( atten - 1e-6 );
|
|
clip( atten - 1e-6 );
|
|
atten = saturate( atten );
|
|
atten = saturate( atten );
|
|
|
|
|
|
|
|
+ //create surface
|
|
|
|
+ Surface surface = CreateSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
|
|
|
+ uvScene, eyePosWorld, eyeRay, cameraToWorld);
|
|
|
|
+ //early out if emissive
|
|
|
|
+ if (getFlag(surface.matFlag, 0))
|
|
|
|
+ return Output;
|
|
|
|
+
|
|
|
|
+ //create surface to light
|
|
|
|
+ float3 wsLightDir = mul(cameraToWorld, float4(lightDirection,0)).xyz;
|
|
|
|
+ SurfaceToLight surfaceToLight = CreateSurfaceToLight(surface, -wsLightDir);
|
|
|
|
+
|
|
float nDotL = dot( normDepth.xyz, -lightToPxlVec );
|
|
float nDotL = dot( normDepth.xyz, -lightToPxlVec );
|
|
|
|
|
|
// Get the shadow texture coordinate
|
|
// Get the shadow texture coordinate
|