Is it possible to have refractive/transmissive objects visible through other transmissive objects without using alpha transparency?

Hi, is it possible to have transmissive objects visible thru other transmissive objects without resorting to alpha transparency?

In this screenshot from the Shadow glass demo, there are two transmissive meshes, the bottle, and the liquid. But to have them visible thru each other, alpha transparency is used. This makes the train windows in the envmap visible both with the IOR distortions and without (which is what I want to avoid).

I have created a playground here. Can I setup the renderer so when drawing the sphere in the foreground, the sphere in the background will be visible with IOR distortion and not using alpha blend (In the screenshot we only have transmission, i.e no visible sphere in the refraction)? I do not need shadows and in my real use case I will have a fixed draw call order of the transmissive meshes.

Thank you for any help you can offer! :smile:

I remembered @PatrickRyan trying but it was not really possible due to the locallity of the reflections/refractions :frowning:

He might be able to help confirming

1 Like

@bowald, multiple layers of transmittance are always tricky because of the fact that the refraction is calculated from the reflection texture, which is usually your IBL unless you are passing a custom reflection texture. The problem is getting the meshes you add to your scene into the reflection texture. You could use a reflection probe to add your scene meshes, but the problem is that you need to run refraction on the background mesh before it is added to the reflection probe. This has now broken the order of operations since you need to probe the scene to make the reflection texture to then use that for transmission. This means you would need to run a loop for every mesh that needs to be in the reflection and also requires transmission, which is really expensive and is not scalable.

If you don’t want to use alpha, you will have to fake it. For example, in this scene, I wanted to be able to show the inside of the resin surface and still have transmission, so I built textures to mask our refraction and rendered based on backface:

You can see that the die next to the translucent one is not in the reflection map. I made that choice to reduce complexity in the example and compensated by using a very dark color for the material which could imply less transmission. This was a design/art solve to the problem, but in this case the extra compute for the scene was not generating a big return in the render, so I leveraged seeing the other side of the die to do the heavy lifting.

This is always the trade-off… what is the cost of making a render physically accurate and what is the cost? Is there a trick you can do like render the sphere with the IBL as a texture on the surface in your shader at the point you are rendering the reflection probe and then swap back to transmission for them once you get past the point of rendering the reflection texture? This way you would have something that resembles the other transmissive sphere, even if the refractions aren’t exactly right. Would that be enough for your user to understand what is happening? Would they be able to spot the issues with double refraction not being quite right? I would guess that they probably wouldn’t notice unless they were graphics engineers deconstructing the render.

The approach I would take would be something like the above… find the use case that gets your reflections 80% there without a huge render cost because of the diminishing returns of physical accuracy in relation to your viewing audience.


Thanks for the detailed answer @PatrickRyan. I achieved what I wanted using Reflection probes. This will be perfect for my use case.

The result can be seen in the screenshot and in this playground.

Thanks again :raised_hands:

1 Like

Is the background sphere also transmissive? If not and if you can generate a glb for your scene, you can achieve what you want by setting the material non transmissive for the background sphere. The glb loader uses a transmission helper class (internal class only - not visible by the end user) that will make the background sphere visible with IOR distortion:


1 Like

Thanks for the tips @Evgeni_Popov :+1:

In the real use case I will have a concave drinking glass, where I have split the inside of the glass and the outside into two separate meshes as a glTF with the transmission, volume, ior, extensions, I want to be able to see the inside of the glass with IOR distortion. So using alpha blend is not optimal but works when we need a performant scene. However, when doing an isolated close-up I hope the reflection probe will look good. :smiley:

1 Like