unityzgy/Packages/com.unity.postprocessing/PostProcessing/Shaders/Debug/Vectorscope.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

60 lines
1.7 KiB
Plaintext

Shader "Hidden/PostProcessing/Debug/Vectorscope"
{
HLSLINCLUDE
#pragma exclude_renderers gles gles3 d3d11_9x
#pragma target 4.5
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/Colors.hlsl"
StructuredBuffer<uint> _VectorscopeBuffer;
float3 _Params; // x: width, y: height, z: exposure, w: unused
float Tonemap(float x, float exposure)
{
const float a = 6.2;
const float b = 0.5;
const float c = 1.7;
const float d = 0.06;
x *= exposure;
x = max(0.0, x - 0.004);
x = (x * (a * x + b)) / (x * (a * x + c) + d);
return x * x;
}
float4 Frag(VaryingsDefault i) : SV_Target
{
i.texcoord.x = 1.0 - i.texcoord.x;
float2 uv = i.texcoord - (0.5).xx;
float3 c = YCbCrToRgb(float3(0.5, uv.x, uv.y));
float dist = sqrt(dot(uv, uv));
float delta = fwidth(dist) * 0.5;
float alphaOut = 1.0 - smoothstep(0.5 - delta, 0.5 + delta, dist);
uint2 uvI = i.texcoord.xy * _Params.xy;
uint v = _VectorscopeBuffer[uvI.x + uvI.y * _Params.x];
float vt = saturate(Tonemap(v, _Params.z));
float4 color = float4(lerp(c, (0.0).xxx, vt), 1.0);
return color;
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment Frag
ENDHLSL
}
}
}