Tweak grass blade color
This commit is contained in:
parent
36b8de9285
commit
72af8af979
1 changed files with 10 additions and 5 deletions
|
|
@ -52,18 +52,23 @@ float4 main(PSInput input) : SV_TARGET0 {
|
||||||
float halfLambert = rawNdotL * 0.5 + 0.5;
|
float halfLambert = rawNdotL * 0.5 + 0.5;
|
||||||
float wrap = halfLambert * halfLambert; // squared for falloff shape
|
float wrap = halfLambert * halfLambert; // squared for falloff shape
|
||||||
|
|
||||||
|
// Diffuse floor: even fully back-facing blades get some sun contribution
|
||||||
|
// Simulates light scattering through dense grass (cheap GI approximation)
|
||||||
|
wrap = max(wrap, 0.35);
|
||||||
|
|
||||||
// Translucency: thin blades let light through from behind
|
// Translucency: thin blades let light through from behind
|
||||||
// Stronger effect to reduce contrast when orbiting around grass
|
// Stronger effect to reduce contrast when orbiting around grass
|
||||||
float3 V = normalize(cameraPosition.xyz - input.worldPos);
|
float3 V = normalize(cameraPosition.xyz - input.worldPos);
|
||||||
float backLight = saturate(dot(V, L));
|
float backLight = saturate(dot(V, L));
|
||||||
float transAmount = (1.0 - saturate(rawNdotL)) * 0.8;
|
float transAmount = (1.0 - saturate(rawNdotL)) * 0.6;
|
||||||
float translucency = backLight * transAmount;
|
float translucency = backLight * transAmount;
|
||||||
|
|
||||||
// Same ambient as voxel faces for color consistency
|
// Higher ambient for vegetation: grass blades bounce light between each other
|
||||||
float3 ambient = float3(0.15, 0.18, 0.25);
|
// (simplified inter-reflection / GI), brighter than stone ambient
|
||||||
|
float3 ambient = float3(0.30, 0.33, 0.35);
|
||||||
|
|
||||||
// Wrap + strong translucency to minimize light/dark contrast
|
// Wrap + translucency for soft, low-contrast vegetation shading
|
||||||
float3 diffuse = sunColor.rgb * (wrap * 0.85 + translucency * 0.6);
|
float3 diffuse = sunColor.rgb * (wrap * 0.88 + translucency * 0.55);
|
||||||
lit = texColor * (diffuse + ambient);
|
lit = texColor * (diffuse + ambient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue