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.
This commit is contained in:
parent
9086a794a8
commit
36b8de9285
1 changed files with 8 additions and 7 deletions
|
|
@ -53,17 +53,18 @@ float4 main(PSInput input) : SV_TARGET0 {
|
||||||
float wrap = halfLambert * halfLambert; // squared for falloff shape
|
float wrap = halfLambert * halfLambert; // squared for falloff shape
|
||||||
|
|
||||||
// Translucency: thin blades let light through from behind
|
// 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);
|
float3 V = normalize(cameraPosition.xyz - input.worldPos);
|
||||||
float backLight = saturate(dot(V, L)); // view aligned with light = backlit
|
float backLight = saturate(dot(V, L));
|
||||||
float transAmount = (1.0 - saturate(rawNdotL)) * 0.4; // stronger when facing away from light
|
float transAmount = (1.0 - saturate(rawNdotL)) * 0.8;
|
||||||
float translucency = backLight * transAmount;
|
float translucency = backLight * transAmount;
|
||||||
|
|
||||||
// Warm vegetation ambient (higher than stone, slightly green-tinted)
|
// Same ambient as voxel faces for color consistency
|
||||||
float3 vegAmbient = float3(0.22, 0.28, 0.20);
|
float3 ambient = float3(0.15, 0.18, 0.25);
|
||||||
|
|
||||||
float3 diffuse = sunColor.rgb * (wrap * 0.7 + translucency * 0.5);
|
// Wrap + strong translucency to minimize light/dark contrast
|
||||||
lit = texColor * (diffuse + vegAmbient);
|
float3 diffuse = sunColor.rgb * (wrap * 0.85 + translucency * 0.6);
|
||||||
|
lit = texColor * (diffuse + ambient);
|
||||||
}
|
}
|
||||||
|
|
||||||
return float4(lit, 1.0);
|
return float4(lit, 1.0);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue