feat: Main shader LOD detail map

This commit is contained in:
Alexandre Coirier
2026-06-02 07:55:45 +02:00
parent 2f3cd8dc7e
commit 713933b932
16 changed files with 2496 additions and 338 deletions
@@ -28,25 +28,30 @@ void Fog_float
//float test = RidgedNoise3D(PositionWS, 10, 2, 2, .5);
float3 camPos = _WorldSpaceCameraPos.xyz;
float depth = distance(camPos, PositionWS);
float depthAtten = smoothstep(10, 100, depth);
float depthAtten = smoothstep(5, 30, depth);
float mask = smoothstep(0, lerp(.3, .1, depthAtten), PositionOS.y) * pow(smoothstep(1, .5, PositionOS.y), 2);
float t = _Time.y * .7;
float s = lerp(Scale.x, 1, .3);
float3 p = PositionWS;// - PivotWS;
p += float3(t, t * .2, t);
p += RidgedNoise3D(p - PivotWS * .9, .1, 3, 1.6, 1) * 3;
float noise = RidgedNoise3D(p - PivotWS * .9, .1, 5, 1.6, 1);
p += noise * 3;
float fog = FBMNoise3D((p - PivotWS * .5), 10 / s, 3, 1.5, .5);
float4 col = lerp(ColorA, ColorB, saturate(RidgedNoise3D((p - PivotWS * .7) * float3(1, 1.6, 1), 3 / s, 3, 1.6, 1)));
float4 col = lerp(ColorA, ColorB, saturate(RidgedNoise3D((p - PivotWS * .9) * float3(1, 1.6, 1), 3 / s, 3, 1.6, 1)));
float mask = smoothstep(0, lerp(.3, .1, depthAtten), PositionOS.y) * pow(smoothstep(1, .5, PositionOS.y - .15 + noise * .3), 2);
// Output
Output = col.rgb;
Alpha = lerp(fog, smoothstep(1, .5, PositionOS.y), depthAtten * mask) * lerp(.2, 1, smoothstep(0, 30, depth)) * mask * col.a;
Alpha = lerp(fog, smoothstep(1, .5, PositionOS.y), depthAtten * mask) * lerp(.2, 1, smoothstep(0, 15, depth)) * mask * col.a;
}
#endif