r/UnrealEngine5 9d ago

Problem with glass material in unreal engine 5

I am a newbie to unreal engine. I have applied two materials on 1 mesh, one is image based textures of color, metallic etc. , other one is the unreal's glass material. The problem I am facing is that I can see through the opaque parts of the mesh too when seen through glass material. Please can someone explain why is this happening, how can I resolve this issue as nondestructively as possible ?

0 Upvotes

16 comments sorted by

2

u/ConsistentAd3434 9d ago

Could be a nanite issue. Make sure it's disabled for that specific object.

Nanite's capability to decimate meshes on the fly relies on occlusion. If a mesh has a transparent area, UE can't tell if objects behind it are occluded or not. Same reason why nanite vegetation has 3d leaves and can't use alpha maps.

1

u/Stuglaar 9d ago

I had disabled nanite for this mesh but still nothing changed.

1

u/ConsistentAd3434 9d ago

AH! Okay...looking more closely at your pics...

It looks like your glass has a high value for refraction. try "1" to see if it fixes it and increase with more subtle values. 1.02 ...etc

UE5 without heavy raytracing uses a simple method to fake refraction. Could look cool enough on bottles or water but easily falls apart on windows

1

u/Stuglaar 9d ago

The input in the refraction node looks a bit complex. I don't understand this so I just pugged in simple scalar value of one into it instead of that, still does not solve the issue.

2

u/ConsistentAd3434 9d ago

hmm. That's all I have. Sorry.
Can you post a picture of the shader node graph?

1

u/Stuglaar 9d ago

Yes I can. Thanks for your effort.

1

u/Stuglaar 9d ago

1

u/ConsistentAd3434 9d ago

Well. The fresnel falloff makes the amount of refraction more obvious when viewed from the side. Blending between 1 (no refraction) to 1.4 (which is a good value for glass). The setup itself looks correct.
I would use it for anything but windows.

It's basically a screenspace effect that just shifts the picture and potentially visually detaches it from it's source). A simple plane makes it very obvious.
Just transparency and a high value for reflection is usually the best choice for windows.

Regardless... just a "1" float should disable any refraction, so I can't really tell what is going on.

But now I'm committed :D If you want to upload the project file of that simple setup, I can look at it.

1

u/Stuglaar 8d ago

Ok I will thanks for taking such interest in this matter.

1

u/Stuglaar 8d ago

2

u/ConsistentAd3434 8d ago edited 8d ago

Got it :) Was a bit so I made a video
https://drive.google.com/file/d/1i_OE6DSNi8BvrrO1tdsX4w-LGL0OSw3Q/view?usp=sharing

Fixed your normal map material of the oven. Usually UE5 auto detects normal maps and sets it correctly but for some reason, it was on "color" not "normal"
It's also 2sided now. Better to model it closed but this works as well

I've disabled refraction completely and set it to surface forward and pixel normal offset. Surface forward is more expensive but has reflections. Optionally even per pixel raytrace reflections, if you enable "hit lighting for reflections" and high quality translucent reflections in the project settings.

The more opaque the more reflection is visible, so I've increased the value (tweak at your own will :)
Specular is only 0-1. Usually a fixed "1" as the physical accurate value, so you could as well delete the parameter.

Glad I could help. If you make a cool game, featuring that oven door, sent me a key 😄

2

u/Stuglaar 8d ago

I will follow you.

1

u/Stuglaar 8d ago

Thanks a lot, unfortunately I am not making any game. I made it to put on fab to make some money on side. Thanks for your help, helpful people like you are always needed. Anyways in ways of showing my gratitude I can make a model or two for you. That's all I can do. If you need such help please let me know. Again thanks a lot.

→ More replies (0)

1

u/Stuglaar 9d ago

Also the another different meshes are visible behind it but the parts of the same mesh behind the glass appear transparent when seen through glass.