Glass Bump Issue - How to fix?

I am rendering with Vray the following headlights:

The Glass-Shader / Material is very simple.
A Bump Map inside of a Refractive Glass Shader - that’s it.

The UVW’s are nicely done. However, when I bring the same shader via Datasmith to Unreal, the bump map is gone.

If I want to create a simple Glass Material with the same bump map - and with the same result shown above…
How to setup the simple Glass Material using the Bump?

**I created a bump map and a normal map but it’s still unclear how to create the Glass Shader with the Bump Map and considering,
that the Glass Material should work with Refraction & Ray Tracing.

Does anyone know how to create this Glass-Shader with the Normal Map or Bump Map shown below?**

Thank you so much for any little help,
appreciate it!

Try storing those maps, normal and bump for each circular light fixture, in a project folder you can access in Unreal. Then create a material in the same folder (right-click and select create material, name it, and when the Material Editor opens…select the texture maps and drag them into the Material Editor workspace grid. That’ll generate texture samples of those normal and bump maps with the textures loaded into each one. Connect each normal map’s RGB pin to the Normal pin of the Main Material node (Base Color, Metallic, Roughness…Normal, etc). Connect each bump map’s RGB pin to either the Metiallic pin or the Roughness Pin on the Main Material node. If it doesn’t work, you may need to add something to the Base Color pin, such as an alpha channel or greyscale RGB value that then needs to be set to clear because it’s a glass type of material.

Thank you. I tried to follow your steps, but it didn’t work.

Is there anywhere a simple glass material for download, that works with RayTracing?
The Refraction seems to be broken - and I can’t figure out what’s causing that issue.

The Datasmith conversion creates a Material that is already very complex.

But in theory, I only need to know how to setup the Refraction properly inside of the Unreal Material.
I was looking for a tutorial, that just explains how to setup a Glass Material that works with Ray Tracing and Refraction.

But no luck so far.
Does anybody know?

Thank you so much!

Unreal doesnt use “bump”, maybe that’s the issue.

I would just modify whatever material datasmith is bringing in for you to add the textures in manually.

Refraction is a different pair of fisticuffs altogether.
Glass I0R is 1.33 I think? Not sure, but if you search “unreal glass IOR” it will give you the page with instructions.

Fresnel > lerp from 1 to IOR > into refraction.

Then ofc. Your project needs to have the proper settings (stay tracing it a sphere reflection capture, maybe both for a fallback?) Which is the fisticuffs portion. You end up literally fighting with the engine to get it to show correctly.
Other things that may need adjusting for refracrion/reflection also include the mesh light map size, and…

As far as the light/glass go, I think you can put your normal map right into the glass material and it will offset fine without the need of the extra bump.
However you can also use the bump map you have creatively to change the layers around, the file channel is always from 0 to 1, so you can literally plug it in randomly into fields like roughness and see what happens. You can invert the output with 1-x as I’m sure you know, which is probably closer to what wa roughness map may be like for a light.

I am trying to work this out - step by step and I hope to get all your help. So here we go, please see the video below.

video: Glass Refraction - YouTube

Download UE4 Project File:
https://mega.nz/#!3g9QkAyI!z6VhQH_3x…KHMcQEHEPIaQEo

Thank you so much for any of your help, hints, tips & suggestions.

Happy pixeling,
Bernhard :slight_smile:

In my opinion your material can be trashed and re-done from scratch.
Metal only takes a value of 0 or 1. something is either metal or it is not.
Specular is a texture clamped from 0 to 1, so is roughness. They can also be scalars only.

Now, in your material you have IOR values hooked into a string of messy multiplies that end up into Metallic and Specular. While the value may be Ok on Specular, I doubt it is for Metallic.

Also your default value is not the value for glass
https://docs.unrealengine.com/en-US/…_14/index.html

Additionally, you have it set as a translucency volume. Forward shading does a better job at it.

Once you make a proper material,
Here is a screenshot of it tinted yellow:

Here is one of it tinted Green:

Here is one with the opacity cranked up to .75

(also while in play mode: Screenshot - 40d265826324f3bc754228dab64f63fc - Gyazo)

This example has a normal map applied to it.

It’s still reflective, but the normal map destroys the refraction because it’s not very subtle.
Transitioning the normal map intensity (divide by .1 to .3)

The glass is actually green, but can’t be seen over red.

Other Kettle

And material.

Also the kettle is in a custom depth buffer and the light-map is bumped up to 1024 - neither should affect what you are after really.

Isn´t this the material, that Datasmith provided after importing the scene from VRay, so this was created by Epic to imitade VRay behaviour? Or is this a different one? And if this is from Datasmith, then i wonder, why the material for Cinema 4D imports is so different:

Here is the Blueprint from Datasmith for the C4DMaster Material: C4DMaster posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Just copy it from that side, then you can paste it directly into Unreals blueprint system (while unofficial, that is probably the easiest way to share blueprints).

But what i am missing for the whole tinted or colored Glass issue, is what in Cinema 4Ds transparency settings is called an “Absorption color”. The color, that colors the glass over its thickness (the thinner, the less colored the glass gets, the thicker, the more it will be colored with the chosen absorption color). In Unreal, trying to use the opacity for coloring the glass, you might just color every bit of the glass with the same… intensity of the color, ignoring the objects thickness. In this example you can see it, the left Object turns only red (the used absorption color) at it´s thick center, while the edges are not that much red colored. The other copy is just overall red colored, regardless of its shape and thickness.

https://s19.directupload.net/images/191106/zugd45t2.jpg

2 things.
1)
The automated stuff you get is generally trash anyway. A shader made to “fit all” doesn’t really fit anything at all. It’s generally a visuall unperformant ballpark that gets you a simple visual demonstration you then would have to optimize and, in the case above, fix.

Glass thickness is a bit out of the scope of my simple shader, but it can be done with a texture of the object that reflects thickness. You just multiply the black and white image by a base color and you feed it into both base color and opacity.

Opacity is darker (1) where the glass is thicker.

You have to precompute a specific texture for this so that the object doesn’t have to do needless math to achieve your objective.

Both of those red, glass objects look excellent, even in contrast to the purple tiled terrain and the background water. I think OP is merely trying to get a glass material with refraction of ambient light, not with utilizing a lightmass object. It’s about creating a base material to work with rather than a fully optimized, out-of-the-box solution, but with one simple blueprint.

There’s a brief tutorial in the learning portal about translucency in material inputs. You need to download the files, and make sure they’re accessible in the Content Browser by placing them in the same folder as the tutorial’s .umap file, or in another folder that is easy to open in the Content Browser. Here is the link to the tutorial:

https://learn.unrealengine.com/cours…mcjoUSU&LPId=0

The normal map should be enough to create a complete shader material. I suggest trying it without the bump map too. Use Opacity set to to a mid-range value (.25-.75) depending on how it’s going with the other settings. It seems tricky because the two caps over the lights appear to be almost completely transparent, but are actually dense with a high refraction occurring inside and around small details (such as what the normal and bump maps show). So, using specularity to increase reflection and perhaps multiplying or dividing it by refraction might result in the material becoming a thicker, denser glass. Set Blend Mode to Translucent, enable Screen Space Reflections, and try the different lighting modes to see how well each one works. Obviously forward shading is the highest level of rendering, but it may not combine well with certain other settings being tried.

Nah, i think, at least with the C4D material, they did a pretty good job. You have to keep in mind, that Datasmith is mostly for people, that are more into modelling, animating and presenting awesome models and effects, not so much into developing the shaders or programming. More artists, less game devs. So while performance wise, such an all in one try might not be the best thing in general, but for the audience, it is created for, it might be a blessing, as they can concentrate more on the things they prefer.

I fear, it´s not that easy, as thickness, or rather, the travel distances of the rays, varies with the angle you view at a certain part of the object. If you mark one spot through which you want cast your rays, and rotate such an irregular shape, your rays will have longer or shorter distances to cover, while always starting from the same point. F.e. that shape i have rendered here, if you start at the center axis, you can chose to look at the nearest opposite site, or rotate it, that you watch to one of the edges on the left or right. Or, the longest path would be from f.e. the top left edge to the bottom right edge. This distance should be about 10x longer than a line at a more horizontal viewing angle.
So we would need the exact distance that those rays have to travel within that object or glass material. Something like subsurface scattering, just available for raytracing, not only as post effect.And if possible, those distances should take effects like displacement or bump into account, as those effects simulate different mesh forms -> different ray lenghts ^.^
And the things start to get really funny, if you have other (transparent) objects included within your main object.

Hi Everyone!

First of all… thank you so much for all your contribution and tests and providing your help and more information - I really do appreciate that!!!

@MostHost LA:
I followed your recommendation to start a glass material from scratch. And I further more followed the Unreal Documentation with the link you provided.
My Tests Results and problems are documented in this video - including audio comments.

Link to Video: [Glass Refraction 002 on Vimeo

Glass Refraction 002 on Vimeo](Glass Refraction 002 on Vimeo)

The Project File for Further Testing including the re-built Glass Material can be downloaded at the link below:
https://mega.nz/#!no0FCSjZ!-9gyDTbsAN_xaSSawdCeTiOeHjWUqED2BbfyibXyImc

I have been using the latest Unreal Version 4.23.1

So far no luck creating a Glass Material using Ray Tracing. Biggest issue seems to be, that the IOR doesn’t change anything on the behavior of the Glass Material.
I am hoping I did something wrong and I am full of hope that we are able to create one simple Glass Material that can be used when using Ray Tracing.

Please let me know your thoughts on my latest tests - appreciate all your help and all your input!

Keep rocking & Happy Pixeling,
Bernhard

First of, let’s not assume that the offline renderer you are using is 100% correct. It could be that it is not.

Second of all. Plug in the index of refraction into the material base color, and change it back to opaque so you dont wait 10 minute every change.
This will show you what the IOR does.

Third… make a material instance, so you can change the IOR as needed (or any scalar parameter) without recompiling.

This will get you able to actually see what the IOR does as a mask.
It’s all it is btw, a mask that goes from. 1 (already bright) to values above 1.
So for the purposes of visualizing within base color you can 1-x the node, or change the lerp manually to be from 0 to .54 /whatver refraction value you wanted minus 1.

Now that you are able to see the mask you can make some determinations.

The first determination being. Does it look correct in relation to camera movement / is my fresnel node working here?

The second one being. Can I use this 0 to .5 lerp to affect opacity as well to even moreso mimic glass behaviour?

Another thing to consider.
The refraction seems correct in that its behaving as if the pot was full of water. Expanding the 0 all the way.
The noshell version doesnt do this, so may e that’s the one you need to be checking on.

Another thing to consider.
To do translucency with tinted colors usually you change materials within the shell, so your shelled version may need to have two different materials. One to affect the opacity, one to affect the refraction only.
Basically you should check what the engine does when you leave the outside to cast reflections at the base they give you (plus the Fresnel in opacity maybe), and make the inside a transparent color without any refraction to it.

Last thing, addressing that thickness issue from the post above.
You can affect how much that mask is thick or not based on camera with a fresnel node. It’s an approximation aimed at making it look good, it’s not a physics simulation where you expect it to be accurate.

Hi MostHost LA!

appreciate your thoughts and feedback - and I was able to follow your recommendations. However, the major problem is the fact, that the Glass Material does not work when using the Translucency Type Ray Tracing - instead of Raster. :rolleyes:

**Starting at minute 7:15: I highlight that major problem


**

Link to Video:Glass_Refraction_003 on Vimeo

Test Results:

  • the IOR and Glass Material works for the Translucency Type Raster
  • the IOR and Glass Material does not work with the Translucency Type Ray Tracing

And that’s what I meant from the beginning of this post. :eek:

my goal:
I want to create a Glass Material that works when using Translucency with Ray Tracing and that allows me to change the IOR (Index of Refraction). :slight_smile:

my questions:

  • does this not work?
  • and if not… what would be the workaround?
  • or what Glass Material should you use so it looks okay when using Ray Tracing?
  • if it works, can someone create that Glass Material and also share the Unreal Project File ready for download to demonstrate it’s functionality and setup of the material nodes

I hope I am still doing something wrong and there is a way to create a glass material that works when using the Translucency Type Ray Tracing.

Thank you so much for all your efforts - everyone ideas, hints and suggestions - very much appreciated.

Happy pixeling,
Bernhard :cool:

For the first question, disable the other inputs, you won’t be able to tell anything with transparency and the other settings on. You need to isolate the reuslt of the lerp to have a visual representation of what it does.
I would even change the material to opaque just to see.

I’ll make a short video illustrating what I meant. It’ll be faster.

However, you may not have noticed but the second teapot was changing around as you slid the IOR.

To debug, do you have the raytracing options under the Lit tab?
If you do, then these layers actually may help you visualize things without messing with the material as well. I’ll try and include that in the short if I can (Busy day).

The video is encoding. Meanwhile if you pass by, download this test project and just let it compile
http://mosthostla.com/downloads/RayTracedGlassTest.rar

At this point I’m not 100% sure that ray tracing is working for me, or for you, since you see different things then I do. However, all the project settings seem to be correct. So try that and let’s see what you see. I’ll get the explanation video up asap

Here’s a link to the explanation video.- YouTube
Actually, it kinda downed on me while re-watching, but enabling Reflection without a Reflection Capture in the scene should mean that it’s using ray tracing to process it… it would have no other way to create any reflection at all because of the absence of the capture…

The flickering towards the end, seems to be a transparency sorting issue when reviewing the footage.
It may be the front sprout being rendered After or Before the inside layer.

And I completely forgot to mention the fact that the 3rd inside layer for the tint should be a double sided material.

From what i can see, it doesn´t. There is an easy way to test, if raytracing is activated AND working. And that, is, if you go in the Editor window, and change the Lit mode do Pathtracing. If yu can find the pathtracing option, then RTX is working, if you have not this option, you forgot one important step in activating RTX.

After activating RTX, it´s just me messing around with some settings, so you don´t have to ^.^ (disclaimer: no plans were followed, used or hurt during this process :smiley: )

The things, that you need to check in Edit\Project Settings are:

  • in Engine -> Rendering -> Raytracing with checkmark activated
  • then in Platforms -> Windows -> Targetet RHIs -> needs to be set to from Default to DirectX 12, and this is really important, withouth setting it to DX12, raytracing will not be active, even if you already can set it to be used in PostProces Volumes etc.

Also, as you can see in the video, after activating DX12 and raytracing finally raytracing, you might face the same problems i have recorded. Your material or the engine does not making it so glassy anymore. And even worse, with the material set to translucent instead to opaque, it won´t be reflected anymore in anything, that is able to reflect things. Hopefully, they fix that with 4.24, so that even translucent objects will be reflected.

Video unavailable
This video is private.

I wish I could see…

As far as it working or not working, I’ll follow your suggestions when I can, but all the Epic docs (and some blog posts back when they released .22) were showcasing raytraced glass with reflections. Granted they had no tint. Just seems odd that they broke it in .23…

Argh, pls try again, now it should be just not listed, as i wanted it to be.

Yep. Better.
Ok, I would suggest attempting to unplug metallic from the material or making it 0.
If the raytracing shader is using a PBR approach, glass is not metallic.
That’s all I got without getting back into it.

Yes, since Glass is not metal, I also agree that the metallic value should be 0.

Anyways. With all the tests we did, I can create this short summary:
At this point, it’s not possible to create a simple Glass Material that supports Refraction when using Translucency with Ray Tracing.

Here is the final video that supports that conclusion:

Last but not least, I am going to try another attempt using UE4 4.24 Preview.

I’ll keep you posted and thank you all so much for your contribution and help, that’s awesome!
Keep rocking and happy pixeling,
Bernhard

If you want to use Refraction with Ray Tracing for translucent materials, use the Specular value to drive the refraction amount.

I’ve got an example comparison in the docs here: Hardware Ray Tracing Tips and Tricks in Unreal Engine | Unreal Engine 5.1 Documentation