Add **Depth Offset to materials**
This commit is contained in:
@@ -22,6 +22,9 @@ void PS_GBuffer(
|
||||
#if USE_GBUFFER_CUSTOM_DATA
|
||||
,out float4 RT3 : SV_Target4
|
||||
#endif
|
||||
#endif
|
||||
#if USE_DEPTH_OFFSET
|
||||
,out float Depth : SV_Depth
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@@ -36,11 +39,16 @@ void PS_GBuffer(
|
||||
MaterialInput materialInput = GetMaterialInput(input);
|
||||
Material material = GetMaterialPS(materialInput);
|
||||
|
||||
// Depth offset
|
||||
#if USE_DEPTH_OFFSET
|
||||
Depth = (materialInput.SvPosition.z * materialInput.SvPosition.w) / (materialInput.SvPosition.w + material.DepthOffset);
|
||||
#endif
|
||||
|
||||
// Masking
|
||||
#if MATERIAL_MASKED
|
||||
clip(material.Mask - MATERIAL_MASK_THRESHOLD);
|
||||
#endif
|
||||
|
||||
|
||||
#if USE_LIGHTMAP
|
||||
float3 diffuseColor = GetDiffuseColor(material.Color, material.Metalness);
|
||||
float3 specularColor = GetSpecularColor(material.Color, material.Specular, material.Metalness);
|
||||
|
||||
Reference in New Issue
Block a user