Refraction texture does not render any object

Beside render list contains ground, refraction texture is still empty

@sebavan @Deltakosh this is also a bug reported from the Pixcap team
(cc: @Coffiend)

You need to change the refraction plane position but I am not sure this will work with PBR anyway as it won t handle the roughness correctly.

cc @Evgeni_Popov if he has any idea ?

I’m using RenderTargetTexture as in KHR_materials_transmission.ts, which makes refraction always appear, but objects in front are always brought inside the refraction surface. Is there any way to eliminate this?

Here’s a corrected PG using RefractionTexture:

Roughness can be simulated by using a blur pass, as in PBR Refraction roughness (blurriness) - #8 by Evgeni_Popov.

Regarding your last question, it’s a “by-product” of the technique we use, unfortunately: it renders all the opaque objects and use the texture as the refraction texture. You can try to remove the objects you don’t want in the opaque texture, as in:

However, you would have to reconstruct the render list it on each frame, if your camera can move. In the PG above, I simply remove the box from the refraction texture, so if you turn the camera so that the box is behind the amber block, the box won’t be refracted and will disappear.

1 Like

I don’t see the front-refraction issue in the dragron model, even when I put a opaque object infront of it, is there any special technique behind it ?

The dragon is transparent, so it is not part of the list of opaque objects. The refraction texture is applied to the dragon.

I see you use refraction plane for scene clipping, how to calculate the right argument of the refraction plane ? Why it’s not used in the KHR_materials_transmission.ts

can you share me an example for multiple refraction objects?

I tried but it looks weird from the top view

Refractive objects cannot appear in the refraction of other refractive objects, as only opaque objects are taken into account when generating the refraction texture. As a result, you won’t be able to see the dragon in the refraction of the box (nor vice versa).

Managing transparency and refraction is difficult, so we have to make a compromise to be able to work in real time. I think there are other techniques that could be used to deal with refraction (such as screen space refraction), but they’re not foolproof either.