Fix #136346: Workbench: Smoke simulation renders artifacts

Precent division by zero.
Unclear why this wasn't an issue before,
or why is not an issue outside OpenGL.
This commit is contained in:
Miguel Pozo
2025-04-02 17:03:34 +02:00
parent 1ea89c82d4
commit 1be036d883

View File

@@ -25,8 +25,8 @@ float line_unit_box_intersect_dist(vec3 lineorigin, vec3 linedirection)
{
/* https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
*/
vec3 firstplane = (vec3(1.0) - lineorigin) / linedirection;
vec3 secondplane = (vec3(-1.0) - lineorigin) / linedirection;
vec3 firstplane = (vec3(1.0) - lineorigin) * safe_rcp(linedirection);
vec3 secondplane = (vec3(-1.0) - lineorigin) * safe_rcp(linedirection);
vec3 furthestplane = min(firstplane, secondplane);
return reduce_max(furthestplane);
}