fix floodfill lightmap fallback

This commit is contained in:
NULL511 2024-05-02 13:06:48 -04:00
parent da5654476c
commit f33b071152
2 changed files with 16 additions and 8 deletions

View File

@ -1267,9 +1267,13 @@ void main() {
#endif
vec3 lpvPos = GetLpvPosition(feetPlayerPos) + 0.5*viewToWorld(FlatNormals);
#ifdef IS_LPV_ENABLED
vec3 lpvPos = GetLpvPosition(feetPlayerPos) + 0.5*viewToWorld(FlatNormals);
#else
const vec3 lpvPos = vec3(0.0);
#endif
// vec3 lpvPos = GetLpvPosition(feetPlayerPos) - 0.5*FlatNormals + slopednormal;
Indirect_lighting = DoAmbientLightColor(lpvPos, Indirect_lighting, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
Indirect_lighting *= Absorbtion;

View File

@ -13,15 +13,19 @@ vec3 DoAmbientLightColor(
vec3 IndirectLight = max(SkyColor * ambient_brightness * skyLM, MinimumLight);
// do torch lighting.
// float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap.x)),5.0)+0.1));
// TorchLM = pow(TorchLM/4,10) + pow(Lightmap.x,1.5)*0.5;
float TorchLM = pow(Lightmap.x,10.0)*5.0 + pow(Lightmap.x,1.5);
vec3 TorchLight = TorchColor * TORCH_AMOUNT * TorchLM * (1.0 + LightLevelZero*dot(SkyColor * ambient_brightness,vec3(0.3333)));
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
vec4 lpvSample = SampleLpvLinear(lpvPos);
vec3 TorchLight = GetLpvBlockLight(lpvSample);
#else
// float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap.x)),5.0)+0.1));
// TorchLM = pow(TorchLM/4,10) + pow(Lightmap.x,1.5)*0.5;
vec3 LpvTorchLight = GetLpvBlockLight(lpvSample);
float TorchLM = pow(Lightmap.x,10.0)*5.0 + pow(Lightmap.x,1.5);
vec3 TorchLight = TorchColor * TORCH_AMOUNT * TorchLM * (1.0 + LightLevelZero*dot(SkyColor * ambient_brightness,vec3(0.3333)));
// TODO: needs work, just binary transition for now
float LpvFadeF = clamp(lpvPos, vec3(0.0), LpvSize3 - 1.0) == lpvPos ? 1.0 : 0.0;
TorchLight = mix(TorchLight, LpvTorchLight, LpvFadeF);
#endif
return IndirectLight + TorchLight;