Godot Version
4.7.2
Question
Hello everyone,
This is my first post here in the forum so please be nice. ![]()
I hope this is the right place for this. I couldn’t find a dedicated source code category.
Question: Is there someone who would implement a source code fix and/or would point me into the right direction?
The TLDR part:
Usually when I need something I do it myself. Although I have a coding brain I never dared to delve into GIT Repositories or fundamentally changing elements of big projects like Godot. Only small things and only local on my machine. But while working on my Godot game I realized that I want something fixed and officially implemented, had the idea how to do it and … well. The basic principle works. But the bigger implementation destroys something in the render pipeline. Therefore I will not try to engage the GIT way and do it myself … yet. Also I would be more comfortable if this would be implemented by someone who knows what they do. ![]()
The details part:
when having a light with a higher attenuation value (like 2) in a volumetric fog environment the fog starts to flicker. Yes, even with temporal reprojection. The reason is obvious: In the center of the light the energy injection rises way highter than 1 and the fog resolution does the rest. My solution: Cap the incection energy. So in volumetric_fog_process.glsl find the line
` ` `glsl
total_light += light * attenuation * shadow_attenuation * henyey_greenstein(dot(safe_normalize(light_pos - view_pos), safe_normalize(view_pos)), params.phase_g) * omni_lights.data[light_index].volumetric_fog_energy;
` ` `
and replace it with something like
` ` `glsl
if (cap > 0.0001) {
total_light += light * min(cap, attenuation * shadow_attenuation * henyey_greenstein(dot(safe_normalize(light_pos - view_pos), safe_normalize(view_pos)), params.phase_g)) * omni_lights.data[light_index].volumetric_fog_energy;
} else {
total_light += light * attenuation * shadow_attenuation * henyey_greenstein(dot(safe_normalize(light_pos - view_pos), safe_normalize(view_pos)), params.phase_g) * omni_lights.data[light_index].volumetric_fog_energy;
}
` ` `
Before that point define a cap value
` ` `glsl
float cap = omni_lights.data[light_index].volumetric_fog_cap;
` ` `
If I just set the value like
` ` `glsl
float cap = 1
` ` `
it works fine. But of course I want a per light custom value. So I injected an additional property to the light_3d.cpp, light_3d.h, rendering_server_enums.h and so on. But I realized that at this point I don’t EXACTLY know what I am doing. Godot is starting but the rendering of lights seems broken at this point. So maybe someone can point me in the right direction or tell me how stupid my idea is in the first place.