dither alpha
This commit is contained in:
parent
501bfad182
commit
87254005f1
@ -119,6 +119,7 @@ Material:
|
|||||||
- _Cutoff: 0.5
|
- _Cutoff: 0.5
|
||||||
- _DetailAlbedoMapScale: 1
|
- _DetailAlbedoMapScale: 1
|
||||||
- _DetailNormalMapScale: 1
|
- _DetailNormalMapScale: 1
|
||||||
|
- _Dither: 0.5
|
||||||
- _DstBlend: 0
|
- _DstBlend: 0
|
||||||
- _DstBlendAlpha: 0
|
- _DstBlendAlpha: 0
|
||||||
- _EnvironmentReflections: 1
|
- _EnvironmentReflections: 1
|
||||||
|
|||||||
@ -71,6 +71,7 @@ Shader "Universal Render Pipeline/Lit"
|
|||||||
[HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
|
[HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
|
||||||
[HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
|
[HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
|
||||||
[HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
|
[HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
|
||||||
|
_Dither("Dither", Range(0,1)) = 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
SubShader
|
SubShader
|
||||||
@ -179,6 +180,7 @@ Shader "Universal Render Pipeline/Lit"
|
|||||||
sampler2D _ShadowRemap;
|
sampler2D _ShadowRemap;
|
||||||
#pragma multi_compile_fragment _ _ShadowRemapON
|
#pragma multi_compile_fragment _ _ShadowRemapON
|
||||||
|
|
||||||
|
float _Dither;
|
||||||
half4 _UniversalFragmentPBR(InputData inputData, SurfaceData surfaceData)
|
half4 _UniversalFragmentPBR(InputData inputData, SurfaceData surfaceData)
|
||||||
{
|
{
|
||||||
#if defined(_SPECULARHIGHLIGHTS_OFF)
|
#if defined(_SPECULARHIGHLIGHTS_OFF)
|
||||||
@ -190,7 +192,7 @@ Shader "Universal Render Pipeline/Lit"
|
|||||||
|
|
||||||
// NOTE: can modify "surfaceData"...
|
// NOTE: can modify "surfaceData"...
|
||||||
InitializeBRDFData(surfaceData, brdfData);
|
InitializeBRDFData(surfaceData, brdfData);
|
||||||
|
|
||||||
#if defined(DEBUG_DISPLAY)
|
#if defined(DEBUG_DISPLAY)
|
||||||
half4 debugColor;
|
half4 debugColor;
|
||||||
|
|
||||||
@ -341,7 +343,16 @@ Shader "Universal Render Pipeline/Lit"
|
|||||||
InputData inputData;
|
InputData inputData;
|
||||||
InitializeInputData(input, surfaceData.normalTS, inputData);
|
InitializeInputData(input, surfaceData.normalTS, inputData);
|
||||||
SETUP_DEBUG_TEXTURE_DATA(inputData, input.uv, _BaseMap);
|
SETUP_DEBUG_TEXTURE_DATA(inputData, input.uv, _BaseMap);
|
||||||
|
float2 screenPos = inputData.normalizedScreenSpaceUV * _ScreenParams.xy;
|
||||||
|
const float DITHER_THRESHOLDS[4][4] =
|
||||||
|
{
|
||||||
|
1.0/17.6,9.6/17.0,3.0/17.0,11.0/17.0,
|
||||||
|
13.0/17.0,5.0/17.0,15.0/17.0,7.0/17.0,
|
||||||
|
4.0/17.0,12.0/17.0,2.0/17.0,10.0/17.0,
|
||||||
|
16.0/17.0,8.0/17.0,14.0/17.0,6.6/17.0
|
||||||
|
};
|
||||||
|
|
||||||
|
clip(_Dither - DITHER_THRESHOLDS[floor(fmod(screenPos.x, 4))][floor(fmod(screenPos.y, 4))]);
|
||||||
#ifdef _DBUFFER
|
#ifdef _DBUFFER
|
||||||
ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData);
|
ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData);
|
||||||
#endif
|
#endif
|
||||||
@ -667,5 +678,5 @@ Shader "Universal Render Pipeline/Lit"
|
|||||||
}
|
}
|
||||||
|
|
||||||
FallBack "Hidden/Universal Render Pipeline/FallbackError"
|
FallBack "Hidden/Universal Render Pipeline/FallbackError"
|
||||||
CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.LitShader"
|
// CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.LitShader"
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user