Announcement

Collapse
No announcement yet.

GGX Shader + PBR Shader reproduction

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

  • GGX Shader + PBR Shader reproduction

    Hi there,

    I want to re-produce a material/shader that was created within 3d-coat - yes, they call it PBR.

    However, there is no recommendation or any documentation that tells me
    - which maps I should use within the GGX Shader of Vray

    to reproduce the PBR material.

    VIDEO:
    https://youtu.be/-MytgGALMBI


    Meaning, what maps have to be used in which Vray slots ?
    - Diffuse
    - Reflection
    - Gloss
    - etc.

    It might be necessary to use different shaders within a VrayBlend Material, but I was hoping that there is a simple way to use the texture maps only within one Vray GGX Shader.


    Thx for any little help, hint and suggestions and let's see what we can do !
    www.bernhardrieder.com
    rieder.bernhard@gmail.com

  • #2
    Substance Designer from Allegorithmic can convert metalness/roughness PBR to V-ray maps.
    Here's a screenshot that I took.

    Click image for larger version

Name:	MVtNFYx.png
Views:	1
Size:	20.9 KB
ID:	859043

    You just plug the maps into the node on the left side and out comes the v-ray maps.
    Allegorithmic has a guide on how you use the IOR map and what gamma you should use on each map HERE

    Marmoset and Allegorithmic has some very good articles on metalness/roughness PBR
    Marmoset guides HERE
    Allegorithmic guides HERE
    Last edited by dubcat; 28-11-2015, 12:39 AM.

    Comment


    • #3
      Thank you. I saw the Substance Designer post before on polycount. However, 3d-coat does not produce the IOR maps you can get out from Substance Designer.
      So that's the problem.

      However.. I can get the following maps out of 3d-coat and the PBR:
      - albedo / diffuse
      - specular
      - gloss
      - metalness
      - roughness
      - normal maps

      When I look at the PBR Material, I can tell that it has several different layers. I doubt it that a PBR Shader with several layers could be as simple reproduced with one Vray GGX Material, and no VrayBlendMtl.

      The polycount post seems to be a start when using SD.
      However, I guess what ever software is using PBR. My goal is to find a way to use the exported texture maps within my Vray Shader network.

      But so far.. no luck.. couldn't re-produce even one shader within Vray that behaves exactly the same !
      www.bernhardrieder.com
      rieder.bernhard@gmail.com

      Comment


      • #4
        Can you upload a zip with the maps, I don't use 3d-coat. Would love to see if my workflow can convert them properly

        Comment


        • #5
          Originally posted by bernhard View Post
          However.. I can get the following maps out of 3d-coat and the PBR:
          - albedo / diffuse
          - specular
          - gloss
          - metalness
          - roughness
          - normal maps
          Very likely this:

          (3DC) -> (VRay)
          Diffuse -> Diffuse.
          Specular -> Reflection.
          Gloss -> Glossiness
          Roughness -> (Diffuse) Roughness
          Normal Map -> VRay Normal Map texture in Bump slot

          Metalness... well this is usually a switch saying if Fresnel reflections are enabled (black) or not (white).
          In VRay this is available as a checkbox and is not mappable. There are a few workarounds:

          - Create two VrayColors, set the first to the IOR you want to use for your non-metal material and set the second to, say, 50.
          Plug them into a Mix map and plug the metalness map into the Mix Amount slot. Then connect this to the VRayMtl IOR slot.
          Enable Fresnel reflections in the VRayMtl.
          It's a bit hacky and not really 'physically correct', you just ramp up the IOR number so high that the front facing angles will reflect close to what a metal would do.

          - Create a Falloff map and set it to Fresnel. Plug the metalness bitmap into the Front colour and set the Side colour to white.
          Create a VRayCompTex map and set it to multiply, connect the Falloff map and your 3dc specular map.
          Connect the VRayCompTex to the Reflection slot in your VRayMtl.
          Disable Fresnel reflections in the VRayMtl.
          The Falloff map isn't using accurate Fresnel formulas and is slightly off, though it's not by much.

          - Create two VRayMtls, one for a metal setup and one for a non-metal setup, blend them using the metalness map.

          You likely don't need to use multiple VRay materials (unless using the third option above). Tweak the GGX tail/falloff/gamma setting so it fits.
          Rens Heeren
          Generalist
          WEBSITE - IMDB - LINKEDIN - OSL SHADERS

          Comment


          • #6
            Or try this, disable Fresnel Reflections on your VRayMtl, create a VrayOSLTex (not mtl) and save this as metalnessRefl_v001.osl and load it in. Plug into Reflection.

            Code:
            shader
            metalnessRefl_v001
            (
            	string metalness = "",
            	string specular = "", 
            	float IOR = 1.5,
            	output color Col_Out = color(0.0)
            )
            {
            color colMetalness = texture (metalness, u, v);
            color colSpecular = texture (specular, u, v);
            float fIOR = IOR;
            color colWhite = color(1.0);
            
            float fFresnel = 0.0;
            float fEmpty = 0.0;
            fresnel ((normalize (I)), (normalize (N)), (1/fIOR), fFresnel, fEmpty);
            
            color colFresnel = color(fFresnel);
            
            color colMix = mix (colFresnel, colWhite, colMetalness);
            
            Col_Out = colMix * colSpecular;
            }
            Rens Heeren
            Generalist
            WEBSITE - IMDB - LINKEDIN - OSL SHADERS

            Comment


            • #7
              @Rens,
              thank you for your tips, appreciate it !

              From the three options you mentioned I would for sure prefer the last one. Which means, creating two VrayMtls blending within a VrayBlend and using the metalness map as a map. But of course, I have to run lot's of tests and see if I can get similar results.


              What about the Rougness map ?
              Have you personally ever been able to re-create a PBR Material within Vray ?

              The VrayOSL Texture.. hmm.. have to look into that. But when you write... create an .osl texture... ok.. but how does that texture look like ?
              Meaning, after you created it.. and you load it back into the reflection slot... what did you finally create with the code ?


              @dubcat:
              sure... will upload all maps and scene files shortly, so you can download and run your own tests.
              Last edited by bernhard; 30-11-2015, 09:32 AM.
              www.bernhardrieder.com
              rieder.bernhard@gmail.com

              Comment


              • #8
                Hi Bernhard,

                The PBR setup from 3DC isn't any different from what VRay does, just the names of the inputs/maps are different (still not ideal I think).


                Originally posted by bernhard View Post
                What about the Rougness map ?
                That seems to go into the Roughness input of the VRayMtl, as there already is a Gloss map defining what seems to be reflection layer roughness/blurriness (reflection glossiness in VRay).


                Have you personally ever been able to re-create a PBR Material within Vray ?
                Yes. There are a few different setups, for example not all use metalness directly, but in the end it's just moving names around.


                The VrayOSL Texture.. hmm.. have to look into that. But when you write... create an .osl texture... ok.. but how does that texture look like ?
                Meaning, after you created it.. and you load it back into the reflection slot... what did you finally create with the code ?
                If you create an empty notepad txt file you can paste in the code and then save the file out, just make sure it's named .osl instead of .txt. I've uploaded it as a zip file now.
                So what it does it recreates the second option I mentioned earlier. Based on the metalness input map it creates either a solid colour or a simple Fresnel falloff (for non-metals) and multiplies it with the specular input map. This can then go into the reflection slot. As the Fresnel falloff is already built in (needed for the parts where the metalness map is black) you can disable it in the VRayMtl.
                Basically it rolls the VRay enable Fresnel button and the reflection map into one, and I named the inputs after the maps you have. It's a simple setup, no complex IOR for example, but it does the trick.
                Attached Files
                Rens Heeren
                Generalist
                WEBSITE - IMDB - LINKEDIN - OSL SHADERS

                Comment


                • #9
                  I wasn't aware we could just pipe PBR maps into vray and have it working the same way PBR would.

                  So just popping my head to say I'm pretty interested in this thread

                  Stan
                  3LP Team

                  Comment


                  • #10
                    I did some more tests, and figured out a few things.

                    Roughness map:
                    doesn't seem to be the Vray Roughness map. I was checking 3d coat, and within the PBR Shader it controls the sharpness/bluriness of the reflection.
                    that being said, it looks like that's the glossy map within the VrayShader.

                    Here is my test using the roughness map within the glossy slot:




                    Here is the video I made, step by step:
                    https://www.youtube.com/watch?time_c...&v=eIUTy_WbE08

                    hmmm... so if I would use the roughness map exported from the PBR Material within the Roughness slot of the VrayMtl... it wouldn't really work.
                    However.. it's a workaround. I had to tweak the curves all the time, as seen within my video.

                    Meaning, it would be cool if the maps would work without adding curves.

                    @dubcat:
                    you can NOW DOWNLOAD ALL TEXTURE MAPS I've been using for the test render:
                    http://www.bernhardrieder.com/wp-con...rom-3dcoat.zip

                    Model is here:
                    http://www.bernhardrieder.com/wp-con...Coat-Model.zip


                    curious about all your tests and thoughts !
                    cheers
                    Attached Files
                    www.bernhardrieder.com
                    rieder.bernhard@gmail.com

                    Comment


                    • #11
                      Ok, could make sense as well, probably would need to be inverted then as Glossiness white (=smooth) is Roughness black. But what is the gloss map then, a mask for another layer?

                      Ah I think I see now, in your video the dropdown menu lists the workflows. So it would be either gloss or roughness you can use it seems.
                      Out of curiosity, does the Specular Color / Gloss workflow create a map to differentiate between metal and non-metal maps? Does it create a second specular map?
                      Last edited by Rens; 01-12-2015, 01:38 AM.
                      Rens Heeren
                      Generalist
                      WEBSITE - IMDB - LINKEDIN - OSL SHADERS

                      Comment


                      • #12
                        Looks like the specular / color / glossiness workflow blends between the specular map value for facing angles and full white for grazing angles?

                        Originally posted by 3LP View Post
                        I wasn't aware we could just pipe PBR maps into vray and have it working the same way PBR would.

                        So just popping my head to say I'm pretty interested in this thread

                        Stan
                        Sure, all of this has been around for 10-15 years at the very least. It's just common render practices re-branded and simplified so it's easier to create maps that don't break physical rules, and therefore look more real. All of it was already there, the theory on which values to use as well, it was just that it was not that widespread.
                        Rens Heeren
                        Generalist
                        WEBSITE - IMDB - LINKEDIN - OSL SHADERS

                        Comment


                        • #13
                          Originally posted by Rens View Post
                          Looks like the specular / color / glossiness workflow blends between the specular map value for facing angles and full white for grazing angles?
                          Yep, they have that as an assumption so the amount for the reflection is only for the front faces, their shaders are all hard coded to do the blend to 100% reflection you've mentioned. Vlado mentioned that there's a version of the vray material in glsl format in the maya installer that might be usable inside of substance painter, could be a great option if it works!

                          Comment


                          • #14
                            I did a quick test. The problem here is inconsistency in the exporter.
                            There are two types of PBR. One is using Metalness/Roughness and one is using Specular/Glossiness. Let me try to explain

                            Roughness version
                            Albedo: Contain both plastic colors and the metal specular color
                            Roughness: An inverted glossiness map
                            Specular: This is the same as we call IOR in vray. (A normal shader does not need this, only for tweaking)
                            Metalness: A black and white map that tell the shader if it's plastic or metal. Plastic use 1.5 IOR by default.

                            Glossiness version
                            Diffuse: Contain plastic colors, metal is painted as black.
                            Glossiness: This is the same as we use in v-ray
                            Specular: Contain the color of the metal

                            Here is a graphical representation




                            Now lets look at the maps you posted.

                            BR__sphere_color, this map contain both plastic and metal colors = Roughness version
                            BR__sphere_gloss = Glossiness version
                            BR__sphere_metalness, this map is out of whack. First we need to remove the transparency. The result is that the metal is grey. So the metal is not plastic, and not metal.
                            I had to use levels and recreate my own version to fix the diffuse and blend map. = Roughness version
                            BR__sphere_nmap = Both versions
                            BR__sphere_rough = inverted glossiness map = Roughness version
                            BR_spec__sphere_specular_color = This texture is out of whack too. It should have one solid color for the plastic if it was "Glossiness version". And it should not look like this if it's IOR for "Roughness version".

                            I have recreated the missing "Glossiness version" maps.
                            Most software export glossiness/roughness as gamma 1.0. Since the texture maps I downloaded does not match with the one in the youtube video it is kinda hard for me to compare.

                            This is how a metalness map should look like, use this as blend amount in VRayBlendMtl



                            This is how the diffuse should look like



                            This is how I setup my PBR textures when I export them from Quixel SUITE 2.0 or Substance Designer/Painter.
                            PBR textures should have 1 / white reflection if it's plastic. Everything is controlled by glossiness.
                            Plastics use 1.5 IOR as default in PBR engines
                            I disable the IOR on metals and use this falloff. I use the specular color from the exported map in the top slot. (In your case the color was in the albedo map, since it's Roughness)





                            So. Use the new diffuse map, old glossiness map, old normalmap and the new metalness map as blend amount in VRayBlendMtl.
                            See if you can find a way to export the glossiness version of the diffuse and a proper metalness map (Metal should be pure white, plastic should be pure black).

                            I though, well, since the exporter is so inconsistent, let's render the glossiness with auto/1 gamma and invert the glossiness map to roughness map just in case. Here are the results.
                            If none of these match, play with the glossiness map.



                            Here is an all in one shader for laziness. It was converted in Substance Designer as I showed you in the first post.
                            I have attached the textures in a zip



                            The all in one version does not look as good as the setup above.


                            Hope this helps you
                            Attached Files
                            Last edited by dubcat; 01-12-2015, 01:26 PM.

                            Comment

                            Working...
                            X