Announcement

Collapse
No announcement yet.

Custom UserShader with multiple outputs

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

  • Custom UserShader with multiple outputs

    Hi,
    I'm working on a procedural texture using the VRay SDK. The sample texture in samples/vfh_plugins/my_color was a good starting point and the texture works fine using the UserShader node in Houdini. However, I can't figure out how to have multiple outputs from the texture (like in e.g. the TexAColorOp texture).

    I've tried adding a parameter tagged with parmtag { "vray_type" "OutputTexture"} to my .ds file and it shows up correctly in the ui. The problem is that I'm not sure how to actually get the correct values out of the texture.

    Looking at the samples that come with V-Ray for 3ds Max and they seem to be using separate textures for the different outputs (like CommonTexture in samples/vray_plugins/textures/common/basetexture.h which uses a CommonIntensTex for the intensity output).
    I tried doing something similar in my texture but I couldn't get it to work. I might just have been doing something wrong, but I thought I'd ask if anyone knows if this is supposed to work.

    I'd also like to know if it's possible to do a "proper" Houdini VOP for my texture, instead of using the UserShader node. There's no sample for this but I imagine it could work by inheriting from the VfhShaderNodeTranslator?

  • #2
    > owever, I can't figure out how to have multiple outputs from the texture

    Check samples/vray_plugins/textures/vray_texsampler/tex_sampler.cpp (TexAColorOp is there btw).

    > but I imagine it could work by inheriting from the VfhShaderNodeTranslator?

    Yes.
    V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
    andrei.izrantcev@chaos.com
    Support Request

    Comment


    • #3
      Cool, thanks for the quick reply!
      The sample you pointed out looks helpful, I'll see if I can figure it out from there.

      Comment


      • #4
        Hi,
        I've been working a bit more on this and it feels like I can't figure out the last piece of the puzzle. I have created my own VOP now, and I'm using the VfhShaderNodeTranslator to translate it into a vray plugin. So far so good, everything works as expected.
        I've also been able to create a vray plugin with multiple outputs, thanks to the sample you pointed me to.

        The problem is that I don't understand how to get the vfh translator to actually reference my outputs. Whichever output node I use, I get diffuse=|mat|my_tex; in my vrscene file, when I would like e.g. diffuse=|mat|my_tex::sub_tex;.
        If I modify the vrscene by hand and add ::sub_tex, I get the expected results. How do I get the translator to recognize my outputs? Where does it look to find which plugin output a vop output represents?
        Click image for larger version

Name:	image.png
Views:	172
Size:	19.5 KB
ID:	1170548​

        ​

        Comment


        • #5
          > How do I get the translator to recognize my outputs?

          This seems not implemented yet, let me check how this could be done...
          V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
          andrei.izrantcev@chaos.com
          Support Request

          Comment


          • #6
            Awesome, thanks for looking into it!
            Just out of curiosity, how do the nodes that ship with V-Ray for Houdini handle this?

            Comment


            • #7
              > Just out of curiosity, how do the nodes that ship with V-Ray for Houdini handle this?

              Via .ds files parmtag; actually you may try creating .ds file with the name of your plugin
              having at least the outputs description (check TexBulge.ds for instance and vfh_texture_common_outputs.ds),
              this may help, but I haven't tested it...
              V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
              andrei.izrantcev@chaos.com
              Support Request

              Comment


              • #8
                I see, thanks for the pointer. I've managed to get the outputs working properly using the UserShader node now. My custom VOP still won't connect properly but I think I can get by with this solution for now. Thanks for the help!

                Comment


                • #9
                  I've added some changes, the outputs descriptions in .ds file will be taken into account for custom VOPs, pls check if it works for you.
                  V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
                  andrei.izrantcev@chaos.com
                  Support Request

                  Comment


                  • #10
                    That's great, thank you! I just got back from being sick for a few days but I look forward to trying it out later this week.

                    Comment


                    • #11
                      I've tried with the latest nightly and I can confirm that it works with my custom node now. This is awesome, tanks a lot for the help!

                      Comment

                      Working...
                      X