1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Various changes and fixes

Hopefully this works, I haven't yet checked in detail for any problems.
This commit is contained in:
Gefüllte Taubenbrust 2025-05-20 21:40:19 +02:00
parent e05544b84e
commit 51cb37570a
14 changed files with 72 additions and 56 deletions

View file

@ -539,7 +539,7 @@ void main(void)
#endif
#if (defined(ENABLE_NODE_SPECULAR) && !MATERIAL_WATER_REFLECTIONS)
// Apply specular to blocks.
// Apply specular to nodes.
if (dot(v_LightDirection, vNormal) < 0.0) {
// This intensity/roughness is a placeholder and should be replaced by proper specular maps.
float intensity = 0.35 * min(1.0, length(varColor.rgb * base.rgb));

View file

@ -57,7 +57,7 @@ uniform float xyPerspectiveBias1;
uniform float zPerspectiveBias;
#ifdef ENABLE_TINTED_SUNLIGHT
uniform vec3 beta_r0_l;
uniform vec3 scattering_coefficients;
#endif
#ifdef ENABLE_DYNAMIC_SHADOWS
@ -155,11 +155,11 @@ float snoise(vec3 p)
vec3 getDirectLightScatteringAtGround(vec3 v_LightDirection)
{
// Based on talk at 2002 Game Developers Conference by Naty Hoffman and Arcot J. Preetham
const float beta_r0 = 1e-5; // Rayleigh scattering beta
const float unit_conversion = 1e-5; // Rayleigh scattering beta
const float atmosphere_height = 15000.; // height of the atmosphere in meters
// sun/moon light at the ground level, after going through the atmosphere
return exp(-beta_r0_l * beta_r0 * atmosphere_height / (1e-5 - dot(v_LightDirection, vec3(0., 1., 0.))));
return exp(-scattering_coefficients * unit_conversion * atmosphere_height / (1e-5 - dot(v_LightDirection, vec3(0., 1., 0.))));
}
#endif
@ -221,7 +221,7 @@ void main(void)
// The alpha gives the ratio of sunlight in the incoming light.
nightRatio = 1.0 - color.a;
color.rgb = color.rgb * (color.a * dayLight.rgb +
nightRatio * 2.0 * artificialLight.rgb) * 2.0;
nightRatio * max(artificialLight.rgb, vec3(0.0))) * 2.0;
color.a = 1.0;
// Emphase blue a bit in darker places