unityzgy/Packages/com.unity.postprocessing/PostProcessing/Shaders/Builtins/DeferredFog.shader
ayuan9957 8cfebcb657 feat: 丘陵地形优化与注册 + 地形材质调整
- 丘陵.unity: 地形材质优化(增大tileSize), 添加枯草2种, 替换树木为杨树+阔叶树, 平滑平坦区域过渡, Splatmap用Perlin噪声平滑混合减少突兀边界, 调整减少黄色层次
- 丘陵注册到程序: AB打包, SAMap.txt, SQLite数据库(替换平原), 本地化XML, 8192x8192地图图片(含绿色起点区域)
- 海岛/沙漠/山地: PermissibleArea MeshRenderer统一禁用, 移除临时砾石道路层
- 山地/海岛/沙漠: 地形材质参数调整
2026-07-29 15:50:34 +08:00

66 lines
1.9 KiB
Plaintext

Shader "Hidden/PostProcessing/DeferredFog"
{
HLSLINCLUDE
#pragma multi_compile __ FOG_LINEAR FOG_EXP FOG_EXP2
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/Builtins/Fog.hlsl"
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
TEXTURE2D_SAMPLER2D(_CameraDepthTexture, sampler_CameraDepthTexture);
#define SKYBOX_THREASHOLD_VALUE 0.9999
float4 Frag(VaryingsDefault i) : SV_Target
{
half4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoordStereo);
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoordStereo);
depth = Linear01Depth(depth);
float dist = ComputeFogDistance(depth);
half fog = 1.0 - ComputeFog(dist);
return lerp(color, _FogColor, fog);
}
float4 FragExcludeSkybox(VaryingsDefault i) : SV_Target
{
half4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoordStereo);
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoordStereo);
depth = Linear01Depth(depth);
float skybox = depth < SKYBOX_THREASHOLD_VALUE;
float dist = ComputeFogDistance(depth);
half fog = 1.0 - ComputeFog(dist);
return lerp(color, _FogColor, fog * skybox);
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment Frag
ENDHLSL
}
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment FragExcludeSkybox
ENDHLSL
}
}
}