Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Debug/COZY Fog"
- {
- SubShader
- {
- Tags { "RenderPipeline" = "UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" }
- Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
- ZTest LEqual
- ZWrite Off
- Stencil { Ref 221 Comp Always Pass Replace }
- Pass
- {
- Name "ForwardLit"
- Tags { "LightMode" = "UniversalForward" }
- HLSLPROGRAM
- #pragma target 3.0
- #pragma vertex vert
- #pragma fragment frag
- #pragma multi_compile_fog
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Assets/Distant Lands/Cozy Weather/Contents/Materials/Shaders/Includes/StylizedFogIncludes.cginc"
- struct appdata
- {
- float4 vertex : POSITION;
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct v2f
- {
- float4 pos : SV_POSITION;
- float3 positionWS : TEXCOORD1;
- float fogFactor : TEXCOORD2;
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- v2f vert(appdata v)
- {
- v2f o;
- UNITY_SETUP_INSTANCE_ID(v);
- UNITY_TRANSFER_INSTANCE_ID(v, o);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
- o.pos = TransformObjectToHClip(v.vertex.xyz);
- o.positionWS = TransformObjectToWorld(v.vertex.xyz);
- o.fogFactor = ComputeFogFactor(o.pos.z);
- return o;
- }
- half4 frag(v2f i) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID(i);
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
- float3 color = 0;
- float3 foggedColor = BlendStylizedFog(i.positionWS, float4(color.rgb, 1.0)).rgb;
- //Default Unity fog
- //foggedColor = MixFog(color.rgb, i.fogFactor);
- return float4(foggedColor.rgb,1);
- }
- ENDHLSL
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement