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 338e66b7e6
commit da2c536daa
3 changed files with 20 additions and 2 deletions

View file

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

View file

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

View file

@ -194,6 +194,15 @@ LightTargetOutput main(FarFrustumQuadConnectP IN)
//create surface //create surface
Surface surface = CreateSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer), Surface surface = CreateSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
IN.uv0, eyePosWorld, IN.wsEyeRay, cameraToWorld); 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 //create surface to light
float3 wsLightDir = mul(cameraToWorld, float4(lightDirection,0)).xyz; float3 wsLightDir = mul(cameraToWorld, float4(lightDirection,0)).xyz;
SurfaceToLight surfaceToLight = CreateSurfaceToLight(surface, -wsLightDir); 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, float4 dynamic_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), IN.uv0.xy, dynamicWorldToLightProj, surface.P, dynamicScaleX,
dynamicScaleY, dynamicOffsetX, dynamicOffsetY, dynamicFarPlaneScalePSSM, surfaceToLight.NdotL); dynamicScaleY, dynamicOffsetX, dynamicOffsetY, dynamicFarPlaneScalePSSM, surfaceToLight.NdotL);
float static_shadowed = static_shadowed_colors.a; float static_shadowed = static_shadowed_colors.a;
float dynamic_shadowed = dynamic_shadowed_colors.a; float dynamic_shadowed = dynamic_shadowed_colors.a;