Mesh/Shader is all black on any computer other than mine?

I’ve encountered what is by far the strangest bug I’ve ever seen :sweat_smile:

The scene I’m working on has a floor plane with a custom Shader Material on it. On my computer, it all renders just fine. However, when opened on any computer that isn’t mine, the floor appears all black.

This has been confirmed on Windows, OSX, and Linux. But no matter what I do, I can’t re-create the bug unless I open it on my PC (the scene was developed on my mac).

The project is for a client so the code is private unfortunately, but I was able to isolate the floor plane in an online Stackblitz repo. In case this problem isn’t easily identifiable with the description alone, I can add individuals to the Stackblitz repo if they’re logged in with github and tell me their username.

The crazy thing is, even on the Stackblitz reproduction, the floor shader runs great for JUST me! Even testing that on other computers / friends computers results in the same problem- all black scene (in this case the whole scene is black because in the reproduction, the floor plane is the only object in the scene).

At first I thought it was due to a jpg I’m using as a texture in the shader- but that same texture is used in other shaders throughout the scene, all of which render fine for everyone. It’s just this one floor plane that appears all black…

Has anyone seen this problem before?

Thanks in advanced to anyone who may be able to provide some insight!

Got the reproduction here:

It loads the shader/animation fine on my Intel Macbook, but not on my PC or M1 Macbook.

Doesn’t work here.

Chrome 103.0.5060.134
Win 11
GTX 1080

Finally fixed it!

Apparently is was this line in the caustics fragment shader:

float parabolic_time = 10.0 + sin(pow(4.0 * padded_time * (1.0 - padded_time), 0.5)) * 0.0025;

Removing this part fixes it: * (1.0 - padded_time)

Is there an obvious reason why that caused the whole shader to go black?

could be negative numbers. Maybe throw an abs around that. Also, pow(x,0.5) is the same as sqrt(x), and the answer is imaginary when x is negative.

2 Likes

Yea that was totally it! I’m confused why it didn’t cause an issue on my Macbook :thinking: