polyscope
polyscope copied to clipboard
Backface colors flipped when using different and custom backface shading
Hi!
I am using polyscope in python on my intel Mac. When I read this mesh and choose the "backface shading -> custom" option, all faces assume the "inverted" color, despite this mesh being definitely not inverted. Here's a MWE:
import igl
import polyscope as ps
V, _, N, F, _, _ = igl.read_obj("test/unit_tests_data/bunny_oded.obj")
ps.init()
ps.register_surface_mesh("bunny", V,F)
ps.show()
Here is what I see:
After some debugging, it seems that this may actually be due to the underlying graphics drivers. This shader is the one place we use gl_FrontFacing
There are scattered posts online that gl_FrontFacing
is broken on certain OSX openGL driver versions.
We could potentially work around this by rewriting the shader to manually test for front-facingness using screen space derivatives, but that would presumably decrease performance on non-broken platforms.
It would be good to find some fix for this, but I'm not sure what the right fix is. (Also, can we confirm that this is a broken gl_FrontFacing
somehow, and figure out which platforms are effected?)