From 36b8de9285b2e0610beff61dded4b6b2e78f42e3 Mon Sep 17 00:00:00 2001 From: Samuel Bouchet Date: Thu, 26 Mar 2026 19:07:04 +0100 Subject: [PATCH] Phase 4.2: match grass blade colors to voxel faces + stronger translucency Use same ambient (0.15, 0.18, 0.25) as voxel PS instead of greener tint. Increase translucency (0.6) to reduce contrast when orbiting around grass. Wrap at 0.85 for balanced lit-side brightness. --- shaders/voxelTopingPS.hlsl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/shaders/voxelTopingPS.hlsl b/shaders/voxelTopingPS.hlsl index 26b152d..01c7cfd 100644 --- a/shaders/voxelTopingPS.hlsl +++ b/shaders/voxelTopingPS.hlsl @@ -53,17 +53,18 @@ float4 main(PSInput input) : SV_TARGET0 { float wrap = halfLambert * halfLambert; // squared for falloff shape // Translucency: thin blades let light through from behind - // Simple SSS approximation: light arriving from the back side + // Stronger effect to reduce contrast when orbiting around grass float3 V = normalize(cameraPosition.xyz - input.worldPos); - float backLight = saturate(dot(V, L)); // view aligned with light = backlit - float transAmount = (1.0 - saturate(rawNdotL)) * 0.4; // stronger when facing away from light + float backLight = saturate(dot(V, L)); + float transAmount = (1.0 - saturate(rawNdotL)) * 0.8; float translucency = backLight * transAmount; - // Warm vegetation ambient (higher than stone, slightly green-tinted) - float3 vegAmbient = float3(0.22, 0.28, 0.20); + // Same ambient as voxel faces for color consistency + float3 ambient = float3(0.15, 0.18, 0.25); - float3 diffuse = sunColor.rgb * (wrap * 0.7 + translucency * 0.5); - lit = texColor * (diffuse + vegAmbient); + // Wrap + strong translucency to minimize light/dark contrast + float3 diffuse = sunColor.rgb * (wrap * 0.85 + translucency * 0.6); + lit = texColor * (diffuse + ambient); } return float4(lit, 1.0);