Announcement

Collapse
No announcement yet.

Understanding the vrayblinn example - Writing a "material frontend"

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

  • Understanding the vrayblinn example - Writing a "material frontend"

    Hi there,

    i am a complete c++ noob and try to understand the vrayblinn example. I can compile and use the example but i don´t understand where the computation of the blinn is happening. All i see in this example is the basic input output structure. Maybe someone could help me out? I want to replace the blinn computation by a simple pass through of a shader output: inColor -> outColor -> shadinggroup.

    What i in the end want to achive is a "material frontend" where i want to bundle many paramateres which are spread over a shading network and i want to pass through the outputcolor of this network through the new node into the shading group. so the "shader" itself does no computation, just sending values to the network and receiving and pass through the outputcolor.

    Does anyone have an idea how to achive this as simple as possible ?

    Many thanks,
    Andy

  • #2
    What kind of shading network do you want to encapsulate? I don't think you need a C++ plugin to do what you need.

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      Hi Vlado,

      it´s a bunch of texture placements, some vray-textures, 2-3 vray-materials, 2 vray coat materials. What other ways i have ?

      Many thanks!
      Andy

      Comment


      • #4
        You can do this with Maya Assets. You can create an asset container, add the shader nodes to it and expose the attributes you want.
        V-Ray for Maya dev team lead

        Comment


        • #5
          Yes true i will give it a try!

          Ok that is not very comfortable to setup to be honest.

          I would love to have one node that is sitting between the shading group and the rest of the network which holds a bunch of parameters which are fed back into the network and passes through the networks outcolor to the shadinggroup. I think this should be possible with a c++ shader.

          How would you pass through the outcolor programmatically ?

          Comment


          • #6
            This is not a C++ thing...
            www.deex.info

            Comment


            • #7
              Wow, Deex himself!!

              What else then ?

              Comment


              • #8
                Unfortunately there's not really much else that you can do... nVidia has a patent on encapsulating shaders (the mental ray "phenomenons" originally patented by mental images). That's why we never implemented such functionality in V-Ray at all. The patent in question is this one: https://www.google.com/patents/US6496190

                Best regards,
                Vlado
                I only act like I know everything, Rogers.

                Comment


                • #9
                  Thats sad. Thanks Vlado.

                  So could someone please help me out which code i need to pass through inColor>outColor in a c++ vray "shader" ?

                  Comment


                  • #10
                    For the C++ part that is a Maya plugin, it is only there for UI purposes; it is not used during actual rendering at all. It is only used to hold the material attributes and do viewport display stuff. V-Ray uses the desc.txt file to create a V-Ray plugin that will be used for the actual rendering.

                    For the V-Ray rendering plugin itself, if it's a texture, you can look at the sources of TexAColor, which is really a passthrough texture (it just returns the result from the getTexColor() method of the base texture). If it's a material, you need to implement both the shade() method of the material, and the BRDF methods by calling the respective methods of the base brdf. You can look at MtlMaterialID which is also a sort of a pass-through material.

                    The sources of TexAColor are in [vraysdk]/samples/vray_plugins/textures/vray_texacolor and for MtlMaterialID, in [vraysdk]\samples\vray_plugins\materials\vray_MtlMaterialID \vray_MtlMaterialID.cpp

                    To be honest, I don't see how any of that will help you though - it's still very unclear for me what you mean by "pass through inColor>outColor" and what you want to do with it.

                    Best regards,
                    Vlado
                    Last edited by vlado; 07-10-2016, 12:25 AM.
                    I only act like I know everything, Rogers.

                    Comment


                    • #11
                      Lets say i have a fairly complex shading network with values that are set on different nodes. What i want is just one node to which i can add all the attributes i need and feed that back into the shadingnetwork. This could be done by using a blendmat i.e. and add attributes by hand to it which are then shown under the extra attributes.

                      What i want to achive is basically the same, a node that holds all values but not under the extra attribs i want them in a clear interface. The node itself will not do any calculation so it has to pass throug the output from a vraymat i.e to the shading group. So when you hit "graph material" button in hypershade this node will be displayed.

                      Comment


                      • #12
                        The TexAColor example should give you an idea how that can be done. You'll probably also need multiple output parameters. You can see an example for this in vray_texinvert, vray_texparticle and vray_texsampler.
                        V-Ray for Maya dev team lead

                        Comment


                        • #13
                          Originally posted by vlado View Post
                          Unfortunately there's not really much else that you can do... nVidia has a patent on encapsulating shaders (the mental ray "phenomenons" originally patented by mental images). That's why we never implemented such functionality in V-Ray at all. The patent in question is this one: https://www.google.com/patents/US6496190

                          Best regards,
                          Vlado
                          I was using a lot this when i was working with MR.
                          I don't know if we can do the same thing with VRay (because of this patent) but it can be great to find an alternative and have the possibility to "build" a custom network.
                          I know that in recent Maya, we can build custom AE template.
                          www.deex.info

                          Comment

                          Working...
                          X