emissive fix: return the surface.basecolor in place of zeros emissive is at minimum non-shadowed. TODO: consult folks on if they want a multiplier, mask, or mix for further customization there.

This commit is contained in:
Azaezel 2018-11-12 22:55:52 -06:00
parent 17d3531206
commit d74055619f
3 changed files with 20 additions and 2 deletions

View file

@ -173,7 +173,11 @@ LightTargetOutput main( ConvexConnectP IN )
uvScene, eyePosWorld, eyeRay, cameraToWorld);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
Output.diffuse = surface.baseColor;
Output.spec = surface.baseColor;
return Output;
}
// If we can do dynamic branching then avoid wasting
// fillrate on pixels that are backfacing to the light.

View file

@ -110,8 +110,12 @@ LightTargetOutput main( ConvexConnectP IN )
uvScene, eyePosWorld, eyeRay, cameraToWorld);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
Output.diffuse = surface.baseColor;
Output.spec = surface.baseColor;
return Output;
}
//create surface to light
float3 wsLightDir = mul(cameraToWorld, float4(lightDirection,0)).xyz;
SurfaceToLight surfaceToLight = CreateSurfaceToLight(surface, -wsLightDir);

View file

@ -134,7 +134,7 @@ float4 AL_VectorLightShadowCast( TORQUE_SAMPLER2D(sourceShadowMap),
#ifdef NO_SHADOW
debugColor = float3(1.0,1.0,1.0);
#endif
#ifdef PSSM_DEBUG_RENDER
if ( finalMask.x > 0 )
debugColor += float3( 1, 0, 0 );
@ -194,6 +194,15 @@ LightTargetOutput main(FarFrustumQuadConnectP IN)
//create surface
Surface surface = CreateSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
IN.uv0, eyePosWorld, IN.wsEyeRay, cameraToWorld);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
Output.diffuse = surface.baseColor;
Output.spec = surface.baseColor;
return Output;
}
//create surface to light
float3 wsLightDir = mul(cameraToWorld, float4(lightDirection,0)).xyz;
SurfaceToLight surfaceToLight = CreateSurfaceToLight(surface, -wsLightDir);
@ -215,6 +224,7 @@ LightTargetOutput main(FarFrustumQuadConnectP IN)
float4 dynamic_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), IN.uv0.xy, dynamicWorldToLightProj, surface.P, dynamicScaleX,
dynamicScaleY, dynamicOffsetX, dynamicOffsetY, dynamicFarPlaneScalePSSM, surfaceToLight.NdotL);
float static_shadowed = static_shadowed_colors.a;
float dynamic_shadowed = dynamic_shadowed_colors.a;