mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
further wipwork on the pointlight conversion. filled CreateSurfaceToLight out in a theoretically correct manner (spoiler, not actually correct)
This commit is contained in:
parent
cf2ed26d6e
commit
605a8cb29b
1 changed files with 6 additions and 5 deletions
|
|
@ -154,7 +154,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;
|
||||||
|
|
||||||
// Build light vec, get length, clip pixel if needed
|
// Build light vec, get length, clip pixel if needed
|
||||||
float3 lightVec = lightPosition - viewSpacePos;
|
float3 lightVec = lightPosition - viewSpacePos;
|
||||||
|
|
@ -179,8 +179,9 @@ LightTargetOutput main( ConvexConnectP IN )
|
||||||
// fillrate on pixels that are backfacing to the light.
|
// fillrate on pixels that are backfacing to the light.
|
||||||
float nDotL = dot( lightVec, normDepth.xyz );
|
float nDotL = dot( lightVec, normDepth.xyz );
|
||||||
//DB_CLIP( nDotL < 0 );
|
//DB_CLIP( nDotL < 0 );
|
||||||
//create surface to light
|
//create surface to light
|
||||||
SurfaceToLight surfaceToLight = CreateSurfaceToLight(surface, dot( lightVec, normDepth.xyz ));
|
float3 wsLightDir = mul(cameraToWorld, float4(lightVec,0)).xyz;
|
||||||
|
SurfaceToLight surfaceToLight = CreateSurfaceToLight(surface, wsLightDir);//lightPosition - viewSpacePos);
|
||||||
|
|
||||||
#ifdef NO_SHADOW
|
#ifdef NO_SHADOW
|
||||||
|
|
||||||
|
|
@ -206,7 +207,7 @@ LightTargetOutput main( ConvexConnectP IN )
|
||||||
shadowCoord,
|
shadowCoord,
|
||||||
shadowSoftness,
|
shadowSoftness,
|
||||||
distToLight,
|
distToLight,
|
||||||
nDotL,
|
surfaceToLight.NdotL,
|
||||||
lightParams.y);
|
lightParams.y);
|
||||||
|
|
||||||
// Dynamic
|
// Dynamic
|
||||||
|
|
@ -216,7 +217,7 @@ LightTargetOutput main( ConvexConnectP IN )
|
||||||
dynamicShadowCoord,
|
dynamicShadowCoord,
|
||||||
shadowSoftness,
|
shadowSoftness,
|
||||||
distToLight,
|
distToLight,
|
||||||
nDotL,
|
surfaceToLight.NdotL,
|
||||||
lightParams.y);
|
lightParams.y);
|
||||||
|
|
||||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue