From 72af8af97985fbb63cf48702d0979d98a9001458 Mon Sep 17 00:00:00 2001 From: Samuel Bouchet Date: Thu, 26 Mar 2026 20:00:33 +0100 Subject: [PATCH] Tweak grass blade color --- shaders/voxelTopingPS.hlsl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/shaders/voxelTopingPS.hlsl b/shaders/voxelTopingPS.hlsl index 01c7cfd..f457f33 100644 --- a/shaders/voxelTopingPS.hlsl +++ b/shaders/voxelTopingPS.hlsl @@ -52,18 +52,23 @@ float4 main(PSInput input) : SV_TARGET0 { float halfLambert = rawNdotL * 0.5 + 0.5; 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 // Stronger effect to reduce contrast when orbiting around grass float3 V = normalize(cameraPosition.xyz - input.worldPos); 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; - // Same ambient as voxel faces for color consistency - float3 ambient = float3(0.15, 0.18, 0.25); + // Higher ambient for vegetation: grass blades bounce light between each other + // (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 - float3 diffuse = sunColor.rgb * (wrap * 0.85 + translucency * 0.6); + // Wrap + translucency for soft, low-contrast vegetation shading + float3 diffuse = sunColor.rgb * (wrap * 0.88 + translucency * 0.55); lit = texColor * (diffuse + ambient); }