Download

Problem with secondary rays in ray tracing refractions

I’ve been experimenting a little bit with ray tracing refractions in UE4.25 and I’m getting this strange result.

In this scene I have a sphere surrounding everything with a postprocess material applied to it so I would have this all light blue background.

I added a sphere and created a simple reflective material, like the following:


Then I added a plane in front of the sphere. The plane material is setup to be a two sided translucent with the Lighting Mode set as Surface Translucency Volume, as the official documentation says to do. Here is the material applied to the plane, all parameter values are set to 0 using an instance:


The idea was just to create a passthrough and play with the parameters. Here is the post process volume configuration:


And here is the result. I am trying to understand if the black in the sphere behind the plane is a bug or a misconfiguration from my side.


Even the path tracer doesn’t seem to handle refractions correctly.


Am I missing something in my setup?

What is the light in the scene (directional? or skylight too?)?

Single directional light pointing straight down.

Could this be the material applied to the surrounding sphere?

I’m testing almost the same in a project level I have, and it’s showing the landscape (with default grid material) as black in the reflection. But it’s not only the part of the sphere behind the translucent plane. I used the exact same material graphs you posted. It could be the material of the surrounding sphere requires a setting or two to be changed, or something added to it or the small sphere’s reflective material to get it working.

Of course! I was being stupid. I forgot to **invert the normals of the surrounding sphere! **No collision was happening against it because the normals were pointing out, not in. I guess the fact that the part of the small sphere not covered by the plane is rendered correctly because this is actually a hybrid renderer. It will add black to the blue, resulting in blue while the part covered by the plane is pure ray tracing.

Here is the result after inverting the surrounding sphere normals:

Now the ray tracer works fine, but the path tracer only bounces the rays once (I think). Is there an option to change that?

Such funny errors happen even the best ^.^ Well, for further experiments, you can try to make your surrounding material simply a two sided material, or, if you don´t want to always inverse the normals, Epic already have created a sphere with inverted normals for this purpose. Just activate, that you can see engine or developer stuff, and then search for a mesh/sphere named “Sphere_inversenormals”. It´s somewhere in the engine content folder :slight_smile:

Now to the real problem…

What you see in your pathtracer is NOT the pathtracer ignoring your sphere, or refractions, it seems more like… that the pathtracer handles your plane as a perfect mirror. Your image shows evidence, that you actually see the rear of your floor as a reflection rather than seeing through the plane, as you would expect from a transparent material.

Thanks for the info about the inverted sphere, really valuable.

You are absolutely correct! I never even considered it! I placed an object in front of the plane to confirm.

So, after experimenting a little bit with the Specular value of the refractive material, which is the index of refraction, I noticed that the path tracer treats a value of 0 as perfect reflection, changing it to 0.01 solves it.

Here is another interesting one:

One sphere is reflective and the other is translucent. Results with the path tracer: The refractive sphere gets reflected almost correctly in the reflection, the path tracer doesn’t seen to take into account the base colour of the material

And here are the results with the ray tracer: The base colour of the material is respected but the reflection doesn’t seem to take into account the index of refraction of the translucent material.

Could this be a bug?