x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

alt text

Product Version: UE 4.18
Tags:
more ▼

asked Dec 07 '17 at 12:30 PM in Rendering

avatar image

S-ed
1.3k 27 22 40

avatar image Jon X ♦♦ STAFF Dec 07 '17 at 08:34 PM

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.

avatar image Jon X ♦♦ STAFF Dec 12 '17 at 08:25 PM

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

avatar image S-ed Dec 15 '17 at 10:05 PM

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

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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:

alt text

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!

glassbubble.png (177.2 kB)
more ▼

answered Jan 03 '18 at 07:24 PM

avatar image

ActualZak STAFF
278 9 4 17

avatar image ActualZak STAFF Jan 03 '18 at 07:59 PM

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:

alt text

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:

alt text

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!

glassbubble2.png (204.9 kB)
glassy.png (274.3 kB)
(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Dec 18 '17 at 09:40 PM

avatar image

Jon X ♦♦ STAFF
822 3 4 6

avatar image S-ed Dec 19 '17 at 08:53 AM

why you would care about its appearance

It is a material, it's all about appearance.

working as intended

For real?! This was intentional?
![img][1]
[1]: /storage/temp/224363-screenshot1513673125.png
avatar image Jon X ♦♦ STAFF Dec 19 '17 at 04:13 PM

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.

avatar image S-ed Dec 19 '17 at 05:06 PM

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?

avatar image Jon X ♦♦ STAFF Dec 19 '17 at 05:39 PM

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

Render After DOF = False

DOF Off

Render After DOF = True

DOF On

off.png (196.9 kB)
on.png (176.8 kB)
avatar image S-ed Dec 19 '17 at 05:47 PM

That's clearly not an unlit view mode.

alt text

avatar image Jon X ♦♦ STAFF Jan 02 '18 at 07:17 PM

M_Glass material from Starter Content viewed in Unlit mode.

Unlit

unlit.jpg (69.3 kB)
avatar image S-ed Jan 02 '18 at 09:10 PM

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).

Lit Unlit

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question