Closed e2002e closed 7 months ago
@MoritzBrueckner I need your help again to review this fix.
Using normalized positive value of getPosView an 1.0 / ior for the refract function gives good result for all kind of surfaces.
@MoritzBrueckner @luboslenco I changed the way refract is done a little. Now it's like translucent pass, meaning that it's a forward pass, and instead of translucent resolve, the refraction shader is dispatched. It did this because I noticed that shadowmaps are only generated for objects that have a "mesh" pass. This is still discarded but when we have transparent shadows I think this will be usefull.
The use of normalize() on the getPosView() function is making strange refractions on flat surfaces. Instead, just use the negative return of getPosView() Passing 1.0 / ior to refract() is also not good.
After changing this the render is correct.
I've set the opacity to 0.0 for glass, if user wan't a mix they can use the alpha value of principled.
@luboslenco this is fixing a broken feature that I introduced, and is compatible with the voxels pull request (voxelization of refractive objects). You should merge this one before