Refraction in "unlit" view mode displayed incorrectly

Greetings!.

The “refraction” parameter causing material to render incorrectly in “unlit” mode.

This image should explain the issue and provide all necessary information to reproduce the bug:

Thank you for your report. We will begin investigation into this issue as soon as possible. If we are unable to reproduce the problem, or need more information, we will follow up with some additional questions for you. Otherwise, we will post an ‘Answer’ once the issue has been logged in our bug database or we have a solution for it.

Hi S-ed, What results are you expecting with this material when you view it in unlit mode?

The white border should not be inside the sphere. It is Fresnel - should be on the edge.

Refraction in the Unreal Engine is an approximation of the lighting phenomena that occurs when light passes from one medium to another, like from air to water. I am not sure why you would care about its appearance in Unlit mode, but it’s working as intended.

why you would care about its appearance
It is a material, it’s all about appearance.
working as intended
For real?! This was intentional?


The refraction is applied to the pixels of the object and those behind it. A high refraction will cause the shape of a sphere to appear shrunken, so the white ring is expected and working as intended. You can try turning on “Render After DOF” (formerly known as Separate Translucency) in the material settings to see if that gives you the desired effect.

That’s the problem I’m referring to, “Render After DOF” does not affecting Unlit mode. It is rendered as if it always disabled. Also, “Render After DOF” is enabled by default.

Have you tested it before answering this question?

I apologize, I missed where you mentioned “Render After DOF” anywhere in your previous posts.

Render After DOF = False

224431-off.png

Render After DOF = True

224432-on.png

That’s clearly not an unlit view mode.

M_Glass material from Starter Content viewed in Unlit mode.

And?

Render After DOF disabled in it.

I don’t get your point?

This material simulates “thin wall” glass. You can’t affect ‘edge’ of it by any means.
I need to make a solid one (non hollow blob of water).

225736-screenshot1514927136.png

225737-screenshot1514927153.png

Hi there!

Based on your original post, you mentioned was that your glass-like Material isn’t rendering properly under Unlit mode in the viewport. That’s possibly a bug, I’ll grant you; we’ll add a bug for it on our end. I wouldn’t go so far as to say it’s intentional, but there as a greater-than-zero chance that it’s one of those things that isn’t super high priority to fix, frankly speaking. Reason being that Unlit mode is more of a diagnostic tool than anything else, and not all rendering features are going to be supported within it.

Now, if your immediate response was, “But hey, I was making a game without lighting! Shouldn’t I be using Unlit mode?” Then my answer would be, “No, not really.”

You’d just make a bunch of Unlit Materials (set their Shading Model to Unlit) and use the regular Lit viewport. The Lit mode is utilizing UE4’s full renderer, instead of just a portion of it.

Generally, we recommend you use Unlit mode only to diagnose specific issues. For example, say you’re lighting your scene and can’t tell if a particular rendering error is some aspect of your Material or how the shadows are falling across the surface. You would then switch to Unlit, and if you still see the problem, you know it’s the Material. Make sense?

Now, if you were having difficulty creating the effect you described (and maybe you weren’t… I’ll try not to assume), then let’s take quick look at it. It seems you’re trying to do an Unlit translucent material and see the result of the Fresnel on the surface, rather than inside the refraction. The “hollow” effect you’re seeing is due to the order in which the render - specifically the refraction - takes place. You want the refraction to happen in a different order to avoid the “hollow issue,” so you should activate Render after DOF. This was formerly known as Separate Translucency.

If you do that, and set the Blend mode of the material to Unlit, (and plug your Fresnel into Emissive because in your screenshot you have it plugged into Base Color), then you get this:

225825-glassbubble.png

So this has the white emissive Fresnel effect on the outside of the surface, not retracted in. That’s the effect you were chasing, yes?

Now, that will still break in Unlit mode, as you’ve described. Most likely reason is that Render After DOF isn’t supported in that mode. Again, think of Unlit mode as a diagnostic tool, not how you should be rendering your final project/game/etc.

Anyway, sorry for carrying on. This thread seemed like it was spiraling a bit, so I figured a more thorough explanation might help sort things out. Sorry for any inconvenience in terms of the view mode not working the way you’d like, and further for any communication issues in digging through your problem.

Have a nice day, and Happy New Year!

Oh and one more thing:

If you were trying to make the sphere look like solid glass/water/etc. you’d probably just bump refraction up until you were happy, as a thicker surface would yield more light bending. However, be aware that refraction is a screen-space effect, not an actual raytraced refraction. That’s important to know, because once refraction gets too high, you’ll see weird boundaries within the refracted surfaces. Crank Refraction up to something dumb like 3.0 and you’ll see what I’m talking about:

225826-glassbubble2.png

Refraction only has access to the pixels on the screen. Once it needs more information than that, you will run into errors. As Jon correctly mentioned, Refraction is an approximation in this case, not a full-on simulation. That would be expensive (it would require raytracing).

What you can do is use a second Fresnel to power a Lerp that blends between two different refraction values, thereby eliminating this error at the edge. You can even start using some highly unrealistic (not physically based) numbers and maybe get something that looked a little more deeply refractive, but still working within the limitations explained above.

For example:

It won’t be perfect. But it’s convincing enough that most folks will see it as a solid refracting object. The real issue is that most pure glass balls will flip the refracted image upside down when viewed at a distance, but we can’t do that because we’re not really refracting. But it works well enough.

Now, I’m using crazyTown values here, but the reason it works is that the Fresnel actually changes refraction across the surface, so by the time we start refracting near the edge, we’re pushing pixels out instead of pulling them back. We never run out of pixels that way.

Anyway, hope this helps!