2
0
Эх сурвалжийг харах

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.

Azaezel 6 жил өмнө
parent
commit
da2c536daa

+ 4 - 0
Templates/Full/game/shaders/common/lighting/advanced/pointLightP.hlsl

@@ -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.

+ 5 - 1
Templates/Full/game/shaders/common/lighting/advanced/spotLightP.hlsl

@@ -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);

+ 11 - 1
Templates/Full/game/shaders/common/lighting/advanced/vectorLightP.hlsl

@@ -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;