@@ -361,48 +361,55 @@ struct PSOutput
361
361
362
362
PSMainInfo.Footer = R"(
363
363
PSOutput PSOut;
364
- #if UNSHADED
365
- PSOut.Color = g_Frame.Renderer.UnshadedColor + g_Frame.Renderer.HighlightColor;
366
- #else
367
- PSOut.Color = OutColor;
368
- #endif
369
-
370
- PSOut.Normal.xyz = Shading.BaseLayer.Normal.xyz;
371
- PSOut.MaterialData.xyz = float3(Shading.BaseLayer.Srf.PerceptualRoughness, Shading.BaseLayer.Metallic, 0.0);
372
- PSOut.BaseColor.xyz = BaseColor.xyz;
373
- PSOut.IBL.xyz = GetBaseLayerIBL(Shading, SrfLighting);
374
-
375
- # if ENABLE_CLEAR_COAT
376
- {
377
- // We clearly can't do SSR for both base layer and clear coat, so we
378
- // blend the base layer properties with the clearcoat using the clearcoat factor.
379
- // This way when the factor is 0.0, we get the base layer, when it is 1.0,
380
- // we get the clear coat, and something in between otherwise.
381
-
382
- PSOut.Normal.xyz = lerp(PSOut.Normal.xyz, Shading.Clearcoat.Normal, Shading.Clearcoat.Factor);
383
- PSOut.MaterialData.xy = lerp(PSOut.MaterialData.xy, float2(Shading.Clearcoat.Srf.PerceptualRoughness, 0.0), Shading.Clearcoat.Factor);
384
- PSOut.BaseColor.xyz = lerp(PSOut.BaseColor.xyz, float3(1.0, 1.0, 1.0), Shading.Clearcoat.Factor);
385
-
386
- // Note that the base layer IBL is weighted by (1.0 - Shading.Clearcoat.Factor * ClearcoatFresnel).
387
- // Here we are weighting it by (1.0 - Shading.Clearcoat.Factor), which is always smaller,
388
- // so when we subtract the IBL, it can never be negative.
389
- PSOut.IBL.xyz = lerp(
390
- PSOut.IBL.xyz,
391
- GetClearcoatIBL(Shading, SrfLighting),
392
- Shading.Clearcoat.Factor);
364
+ # if UNSHADED
365
+ {
366
+ PSOut.Color = g_Frame.Renderer.UnshadedColor + g_Frame.Renderer.HighlightColor;
367
+ PSOut.Normal = float4(0.0, 0.0, 0.0, 0.0);
368
+ PSOut.MaterialData = float4(0.0, 0.0, 0.0, 0.0);
369
+ PSOut.BaseColor = float4(0.0, 0.0, 0.0, 0.0);
370
+ PSOut.IBL = float4(0.0, 0.0, 0.0, 0.0);
393
371
}
394
- # endif
372
+ # else
373
+ {
374
+ PSOut.Color = OutColor;
375
+ PSOut.Normal.xyz = Shading.BaseLayer.Normal.xyz;
376
+ PSOut.MaterialData.xyz = float3(Shading.BaseLayer.Srf.PerceptualRoughness, Shading.BaseLayer.Metallic, 0.0);
377
+ PSOut.BaseColor.xyz = BaseColor.xyz;
378
+ PSOut.IBL.xyz = GetBaseLayerIBL(Shading, SrfLighting);
379
+
380
+ # if ENABLE_CLEAR_COAT
381
+ {
382
+ // We clearly can't do SSR for both base layer and clear coat, so we
383
+ // blend the base layer properties with the clearcoat using the clearcoat factor.
384
+ // This way when the factor is 0.0, we get the base layer, when it is 1.0,
385
+ // we get the clear coat, and something in between otherwise.
386
+
387
+ PSOut.Normal.xyz = lerp(PSOut.Normal.xyz, Shading.Clearcoat.Normal, Shading.Clearcoat.Factor);
388
+ PSOut.MaterialData.xy = lerp(PSOut.MaterialData.xy, float2(Shading.Clearcoat.Srf.PerceptualRoughness, 0.0), Shading.Clearcoat.Factor);
389
+ PSOut.BaseColor.xyz = lerp(PSOut.BaseColor.xyz, float3(1.0, 1.0, 1.0), Shading.Clearcoat.Factor);
390
+
391
+ // Note that the base layer IBL is weighted by (1.0 - Shading.Clearcoat.Factor * ClearcoatFresnel).
392
+ // Here we are weighting it by (1.0 - Shading.Clearcoat.Factor), which is always smaller,
393
+ // so when we subtract the IBL, it can never be negative.
394
+ PSOut.IBL.xyz = lerp(
395
+ PSOut.IBL.xyz,
396
+ GetClearcoatIBL(Shading, SrfLighting),
397
+ Shading.Clearcoat.Factor);
398
+ }
399
+ # endif
395
400
396
- // Blend material data and IBL with background
397
- PSOut.BaseColor = float4(PSOut.BaseColor.xyz * BaseColor.a, BaseColor.a);
398
- PSOut.MaterialData = float4(PSOut.MaterialData.xyz * BaseColor.a, BaseColor.a);
399
- PSOut.IBL = float4(PSOut.IBL.xyz * BaseColor.a, BaseColor.a);
401
+ // Blend material data and IBL with background
402
+ PSOut.BaseColor = float4(PSOut.BaseColor.xyz * BaseColor.a, BaseColor.a);
403
+ PSOut.MaterialData = float4(PSOut.MaterialData.xyz * BaseColor.a, BaseColor.a);
404
+ PSOut.IBL = float4(PSOut.IBL.xyz * BaseColor.a, BaseColor.a);
400
405
401
- // Do not blend motion vectors as it does not make sense
402
- PSOut.MotionVec = float4(MotionVector, 0.0, 1.0);
406
+ // Do not blend motion vectors as it does not make sense
407
+ PSOut.MotionVec = float4(MotionVector, 0.0, 1.0);
403
408
404
- // Also do not blend normal - we want normal of the top layer
405
- PSOut.Normal.a = 1.0;
409
+ // Also do not blend normal - we want normal of the top layer
410
+ PSOut.Normal.a = 1.0;
411
+ }
412
+ # endif
406
413
407
414
return PSOut;
408
415
)" ;
0 commit comments