Skip to content
On this page

GLSL pow function and NaN

After spending some time hunting down a weird artifact in my webgi rendering pipeline, found the cause to be a simple pow operation added in a random commit to tweak the colors a bit.

The pow function in GLSL is defined as pow(x, y) = x^y, and it returns NaN when x is negative or x is 0 and y is -ve.

In general, we abs or clamp the directions and colors before passing to pow, but missed in case of refraction brdf.

Made with ❤️ using the awesome vitepress