Announcement

Collapse
No announcement yet.

Glass Bump Issue - How to fix?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Glass Bump Issue - How to fix?

    I am rendering with Vray the following headlights:
    Click image for larger version

Name:	headlights.jpg
Views:	684
Size:	68.9 KB
ID:	1681465

    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?


    Click image for larger version

Name:	FrontLighstBump.JPG
Views:	431
Size:	149.1 KB
ID:	1681468

    Click image for larger version

Name:	FrontLighstNormal.jpg
Views:	440
Size:	215.7 KB
ID:	1681469

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




    Attached Files

    #2
    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.

    Comment


      #3
      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!

      Comment


        #4
        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.

        Comment


          #5
          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: https://youtu.be/azGdQYGiq5g

          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

          Comment


            #6
            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:
            https://gyazo.com/3d9f728cc9c5b7435adbffe77f092dc7

            Here is one of it tinted Green:
            https://gyazo.com/0fe01557be4b3e1269cdc4002c323fa8

            Here is one with the opacity cranked up to .75
            https://gyazo.com/9eb9827a31f4f282793f6c302225728d
            (also while in play mode: https://gyazo.com/40d265826324f3bc754228dab64f63fc)

            This example has a normal map applied to it.
            https://gyazo.com/71cddc9ea5cdb3eead040a04ef731cbd
            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)
            https://gyazo.com/b783528dca766e3079ce479299b53c16
            The glass is actually green, but can't be seen over red.

            Other Kettle
            https://gyazo.com/2b959f944a0a167a21990c5719bbc157

            And material.
            https://gyazo.com/4d445c3b59dff905da75a26180781cf8

            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.
            Last edited by MostHost LA; 11-06-2019, 10:10 AM.

            Comment


              #7
              Originally posted by MostHost LA View Post
              In my opinion your material can be trashed and re-done from scratch.
              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: https://blueprintue.com/blueprint/cvdc33ck/

              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.

              Comment


                #8
                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.

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

                Comment


                  #9
                  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.
                  Last edited by presto423; 11-07-2019, 01:41 PM.

                  Comment


                    #10
                    Originally posted by MostHost LA View Post
                    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.
                    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.


                    2)
                    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.
                    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.
                    Last edited by Suthriel; 11-07-2019, 02:09 PM.

                    Comment


                      #11
                      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: https://vimeo.com/371693647


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

                      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

                      Comment


                        #12
                        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.

                        Comment


                          #13
                          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.

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



                          Link to Video:https://vimeo.com/371947151

                          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.

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


                          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

                          Comment


                            #14
                            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.
                            https://www.youtube.com/watch?v=LsFwYfo6Eyc

                            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.
                            Last edited by MostHost LA; 11-09-2019, 03:48 AM.

                            Comment


                              #15
                              Originally posted by MostHost LA View Post
                              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.
                              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 )

                              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.
                              Last edited by Suthriel; 11-09-2019, 04:30 PM.

                              Comment

                              Working...
                              X