Path Tracing Glass Material Black artifacts

Hi all,
I´m here regarding an issue with glass material in Path Tracing.

Let me explain my goal first so that you can better understand the issue. I am trying to prepare a Metahuman to be rendered in Path Tracing. Most of it works now out of the box, but the eyes change quite a lot from one renderer to another. The main feature that can be improved upon is the watery effect on the eye. While realtime metahuman has it, it´s almost non visible in path tracing and it does not use any refraction.
Real Time


Path Tracing

So my task was simple, just apply a water material to the geometry MH provides for the tearline in the eye. This is where I encountered some ugly artifacts.
I simplified the textures to make the error clear. You can see the glass/water geometry, the eye and the black areas.


At first I thought they were intersecting geometries. But I realized it shouldn´t be doing that anyway. It seems like there is some kind of milimetric occlusion going on.
Let me show you what is happening in here if we intersect a glass cube into the floor.
bros2
You can see that in the last moment, the glass turns black. It goes into that small distance that turns the glass back like in the eye. The distance seems to be around 0,004 UE units and I can´t find a way of making it just be 0.
More examples with a normal and a glass sphere


the more parallel the polygons are, the most visible the gap.

This is a big problem to create realistic eyes in Path tracing, the way we do in other offline renderers.

My glass shader is the most basic at the moment, in case you were wondering.


I tried touching almost any checkbox I could find, even the ones that didn´t make sense but couldn’t get rid of the effect. I tried light bounces, disabling occlusions, changing IOR values… Nothing changes this.


This picture shows the same intersection, this time the material does not have refraction, instead it’s 0,5 opaque. You can see there is still an artifact, but it’s not black.

Which means this must be happening all the time but we don´t notice it because we mostly work with opaque materials.
It seems that there is some kind of occlussion or shadow bias size that affects this that does not let the light go through really small gaps between geometries. Does anyone know if there is a fix or a command for this?
This is all 5.4, by the way.
Thanks!

1 Like

Currently having the exact same issue…

Just looking at the artifact type alone, it seems like a ray bias or shadow terminator problem? You can probably change ray offset settings in the CVars somewhere, but it looks like the demo sphere you’re showing off is very faceted, do you get the problem on a higher poly mesh that can better support the rounding?

Hi, yes the sphere is quite faceted. A higher polycount would indeed result in less noticable areas, but I feel like that´s just a patch fix and the problem would still persist. Specially since I’m planing on using it on Metahuman Topology which is high, but not as much as a cinematic, subdivided model.

I too think this looks like some kind of bias problem. To me it feels a bit like the light doesn’t get into that little space. And it is size dependant, for example, if I multiply x10, it´s less noticeable. So it´s not an issue of camera being closer or further, it is really something that happens phisically at that size. But I don’t know where I can find a command to reduce that gap distance. Vray has Shadow Bias, for example, but I can’t find anything similar for path tracing.

If that’s true, then that really sounds like the shadow terminator problem. I tried replicating your issues in my instance with a standard glass material and I haven’t had any of the problems you have, which is interesting to me. I am working in 5.5 however, which makes me wonder if your problems might be fixed if you migrate? I’d at least spin up a 5.5 instance to check it out, given how much work Epic put into bringing the PT up to parity with raster in this version.

Yeah I believe I will have to try that… Thanks for the suggestion. I just recently moved all my projects to 5.4 and erased 5.3 to save some memory. I think I can’t avoid 5.5 anymore though, specially since it is supposed to have improved upon Path Tracing. I´ll update and post about the results.

It’s interesting that you couldn’t replicate it. Did you try getting really close?

I’m afraid the problem persists in version 5.5 too…

OOC, did you adjust the near clip plane values in your project settings?

So, it’s not a material issue, the geometry is topologically valid, version # makes no difference…this is interesting.

Hi! I set my near clip plane to 0. But that should only affect the clipping from the “camera” in geometries, right?
Yeah it’s interesting… I can recreate it but can’t see where to fix it. I’ve searched online a lot and read through Path tracing documentation but I don’t see anything that applies here

I’d try resetting your clip plane and see what happens. Sometimes ray biases can be influenced by your clip plane in magic number scenarios, and in general any change from standard behavior carries risks. Would you be willing to share a demo project?

Hi, thank you for the interest!
I prepared a new project with a demo level (which also shows this can be reproduced in new projects). Let me know if you can open it correctly. Unique Download Link | WeTransfer
The link will expire in 7 days, btw.
I made an interesting discovery too. We are not seing shadows, as I thought at first, the black areas are black because we are seing through the mess to a shadowed area. What I mean is, we are not seeing an occlussion, we are seing a refraction. We see through the geometry that is about to be intersected, but light does not go through the geometry. You´ll be able to see it clearly in the file I provided, where you´ll see geometries being intersected (or about to be intersected) with others. Play around with the different lights I set up.

In case you want some pictures for reference of what I found out before digging into the file:
Imagine you have these three elements. A sphere, a plane and a glass plane


If you put the glass plane very very close to the white plane, you´ll be able to see (or refract) through it! See how you can see the sphere in there?

However, notice how although we can refract through the white plane, we can not light through it, light still hits the white plane and does not iluminate the sphere

This gif illustrates the whole effect.
bros2
You´ll see a similar example in the file provided.

The link doesn’t appear to be working unfortunately? If it doesn’t work you could just paste the map data as a txt file (what it is at its’ base level) and I should be able to make that run in a new project.

So, if the black areas are refraction issues, perhaps you’re running out of bounces? Have you changed your bounce count settings at all? It could be that your materials are just refracting internally and never returning light from the other side correctly.

Okay, that is baffling then. It’s like light is refusing to transmit through correctly?

Wait a minute, have you done anything with r.pathtracing.approximatecaustics ?

The link doesn’t work? It does for me… It should lead you to the wetransfer page to download.
I tried cranking up bounces to 100 and it doesn’t change. I also now tried to switching on and off r.pathtracing.approximatecaustics but it doesn’t seem to work.
I´ve never done the txt file thing but I´ll take a look at it, thanks!