How to acheive self-refracting materials

Is there a way to have objects assigned refractive materials show through other objects that are assigned the same refractive material?

For example, in the following playground example, notice that the parts of the torus knot that are obscured by other parts of the knot don’t contribute to the refracted image:

https://www.babylonjs-playground.com/#RRYXWN#1

Even if one of the rotating balls is changed to the same refractive material, it still does not contribute to the refraction through the torus knot when it passes behind.

Is there any way to achieve this effect or convincingly fake it?

Thanks in advance.

Unfortunately you cannot add the receiving object to the reflectionProbe or else it will hide everything else :frowning:

1 Like

Thanks Deltakosh.

Is this same limitation applicable for refractive interactions between multiple refractive objects in the same scene?

Any pointers on how such interactions could be faked?

Refraction and reflection work by rendering the scene into a rendertexture and then by using that texture as data source for the mesh shader

To “fake” it you may want to try to set the mesh to semi-transparent with no culling to see how it looks like (no guarantee :))

1 Like

Awesome. Thanks for the suggestion Deltakosh! I’ll give it shot.

1 Like