Announcement

Collapse
No announcement yet.

Layer Mask - Group Mask

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

  • Layer Mask - Group Mask

    Hi,

    Is there any way to masking some layers in the Shader Tree in a VrayMtl, like we usually do with Modo shaders through Layer Mask and Group Mask effect ? The "Modo way" doesn't work, and I tried with the Schematic View ( connect the texture value/color to the Alpha channel of the target layer) but it does not work either. :/

    Otherwise, Vray integration is really great, and with full support for shaders it will be amazing. Keep up the good work !

  • #2
    Using "layer" and "group" masks with the V-Ray material (and its texture effects) should generally work.
    One limitation in V-Ray when blending between materials (and not individual texture effects) is that only the texture effects will get blended.
    The channels that cannot be textured will not get blended. For example, if you use a layer mask on a V-Ray material with another one below
    it, the "fresnel reflections" boolean option will be taken from the top-most material, the layer mask won't affect it.

    Also you can only blend between materials of the same type. You cannot for example blend between a MODO Advanced material and a V-Ray material.

    You can use "shader" type blending instead of blending between the properties of two materials, which gives a more predictable and accurate result.
    It will also work when the materials are not of the same type.
    Explained here : http://forums.chaosgroup.com/showthr...782#post630782

    I am also attaching a scene where a group mask is used to blend between two V-Ray materials.

    Can you give me an example scene for the specific problem that you are having ?

    Greetings,
    Vladimir Nedev
    Attached Files
    Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

    Comment


    • #3
      Hi Vladimir, and thanks for the reply.

      With other attempts, I could use the Layer Mask effect, but only with a limited number of textures types. The problem wasn't the Layer Mask itself but the weight map texture, which is not recognized by Vray. A list of supported textures and effects would be really appreciated. The layered shaders system of Modo is powerful but the Vray way is originally different, and the mix is sometimes disturbing.

      Thank you for the attachment.

      Comment


      • #4
        Yep, we need to add supported/unsupported features to the documentation. For textures, there are only a few that are supported.
        When the scene is being exported, V-Ray for MODO will print a warning to the event log for any texture layers that are not supported.

        I know of at least one bug when you try to blend (using the add mode) two V-Ray materials - if you have refraction, the two default
        white fog colors get added together, and the V-Ray material doesn't work correctly when the fog color is above 1.0. But this is fixable.
        Generally, trying to blend two materials (without using Shader items) with a blend mode other than "Normal" may result in very strange results.
        It is best to either blend only separate texture effects or to use Shader blending when blending materials.

        Greetings,
        Vladimir Nedev
        Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

        Comment


        • #5
          Hi Vladimir,

          I tried to create procedural dirt, but I had some troubles when blending multiples group mask. Here is the material :



          I have a glass panel and I want to blend 3 layers of dirt : all over the surface, edges, and some kind of water drips. The dirt is a white noise layer and is visible ( in theory ) through a copy with "Refraction Color" effect ( and black color ).

          I made a test on a black surface with the water drips layer and everything is ok, but when I redo a test on the transparent surface, there is a strange effect, the glass panel become opaque and the dirt areas turn to red :


          But with the base dirt layer it works :


          Also, I didn't succeed to blend correctly the 3 layers of dirt between them. The blending should be done at the layer level ( the Diffuse and Refraction color effect ) or at the Group Mask level ? ( tried in Add mode, strange result, and multiply mode not working ).
          And is there an equivalent for this kind of shader creation in the Schematic View, like in 3dsMax with Composite and Mask Maps ?

          Thank you

          Comment


          • #6
            Can you send me the scene (just the window and its materials) so I can examine it ?

            When a "mask" (i.e. "group") layer is set to "(all)" it will cause the blending of all texture effects for the material. This might be the reason for the strange behavior, when you enable the edges and water drips groups.
            You can specify the texture effect that the group affects, but then you will need 2 separate groups - one for the refraction and one for the diffuse layer, with the group masks duplicated, so that's not very convenient.

            You can use the "Channel Modifier" -> "Color" -> "Color Blend" in the Schematic. It is similar to Max's "Composite" and "Mask" textures, but works only on 2 textures at a time. So you will need to use more than
            one "Color Blend" to blend all noise layers. The final "Color blend" can then be connected to a "Constant" texture in the Shader Tree. You can then use this "Constant" texture as a mask on the refraction and diffuse layers.

            Using the Schematic you can blend all dirt layers (I think "Add" is the correct mode) and then use them a single mask.

            Greetings,
            Vladimir Nedev
            Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

            Comment


            • #7
              Uh, another strange thing, Group Mask seems to influence the IOR ??

              Click image for larger version

Name:	ior_trouble.jpg
Views:	1
Size:	498.5 KB
ID:	854980

              And this is an example of the effect I want to achieve.

              Click image for larger version

Name:	effect.jpg
Views:	1
Size:	272.0 KB
ID:	854981

              Comment


              • #8
                As for blending the dirt layers in the shader tree - this should be done on the group mask level. The "vmtl Refraction color" and "vmtl Diffuse color" layers inside the group mask
                should be set to "Normal" blend mode and have "Opacity" 1.0, as otherwise they will get blended twice to the values below them - once for the layer and then again for the group.
                What happens in the code is - when a group mask is entered, all texture effect values are copied, then the texture layers in the mask are applied from bottom to top,
                and finally the old and new texture effect values are blended based on the group mask "opacity", "blend mode" and "group mask" effect.

                Greetings,
                Vladimir Nedev
                Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

                Comment


                • #9
                  Originally posted by John_Do View Post
                  Uh, another strange thing, Group Mask seems to influence the IOR ??

                  [ATTACH=CONFIG]22319[/ATTACH]

                  And this is an example of the effect I want to achieve.

                  [ATTACH=CONFIG]22320[/ATTACH]
                  If the group mask has its effect set to "(all)" and the blend mode is not "normal", it will affect the IOR, since the IOR is a texture effect.
                  For example, if the blend mode is "add", and the final opacity for the group is 1.0, it will basically multiply the IOR by 2, since
                  it will add it twice.

                  Greetings,
                  Vladimir Nedev
                  Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

                  Comment


                  • #10
                    Ok, thank you for the explanations Vladimir, it's really helpful !

                    The scene is available for download here : http://we.tl/96qpAfkb6S

                    Comment


                    • #11
                      Originally posted by John_Do View Post
                      Ok, thank you for the explanations Vladimir, it's really helpful !

                      The scene is available for download here : http://we.tl/96qpAfkb6S
                      The strange red color probably comes from the connection to the diffuse color of "Glass_Base".
                      Only the red output of a dirt texture was connected to it.

                      Greetings,
                      Vladimir Nedev
                      Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

                      Comment


                      • #12
                        Here is what I came up with :

                        1. I work only with "refraction color" to avoid using group masks and the issues with IOR and other stuff getting blended.
                        This means that all dirt layers will have the same diffuse color, which might be a problem.
                        2. The base dirt textures have their colors reversed, because they are no longer set to a "mask" effect but directly to "refraction color".
                        So un-occluded color is white, so the window is refractive there, occluded color is black so the window is diffuse there.
                        3. The additional noise layers have a blend mode set to "add". This way they restrict where the occlusion happens by bumping up the refraction color closer to white.
                        4. The group mask layers have a blend mode set to "darken". This blend mode will take the smaller of the two values given to it.
                        This way if there is dirt ( values closer to 0.0) in one dirt layer, there will be dirt in the blended result.
                        5. The opacity of the group mask layers can be used to increase the strength of a certain type of dirt ( edge, y, etc.)

                        Here is the modified scene : http://we.tl/8CUsZEDsWt

                        Greetings,
                        Vladimir Nedev
                        Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

                        Comment


                        • #13
                          Thank you very much Vladimir ! I understand better the influence of blending modes, my head was about to explode.
                          So, the group mask effect is useless in this case cause we allow a specific effect to the group itself, interesting, things are clearer now.

                          Comment


                          • #14
                            The way I see it, using group masks set to affect "(all)" is only feasible, if the blend mode of the group mask is "normal".
                            When the blend mode is "normal" all texture effects that are not specified under the group mask will have their values preserved.
                            In that case the formula will be oldValue*(1-opacity) + oldValue*opacity which is equal to oldValue.
                            All other blend modes will mess with texture effects you don't intend to blend ( like the Refraction IOR ).

                            Greetings,
                            Vladimir Nedev
                            Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

                            Comment


                            • #15
                              Hi Vladimir,

                              I have again some issues with the Layer Mask ^^

                              // I have a simple Displacement map on a cube


                              // And a map to mask the joints from the bricks


                              // I use this map as a layer mask for a Vray Noise texture, and it's works
                              > with the vmtl Diffuse Color effect


                              > with the vmtl Self-Illumination color effect


                              > but not with the Bump effect :/


                              What I missed ?


                              EDIT : I found another "strange" thing ( in any case something I don't understand ), the blending mode the texture affected by the layer mask seems to impact the blending mode of this layer mask ? See below



                              Last edited by John_Do; 02-02-2015, 03:59 PM.

                              Comment

                              Working...
                              X