Announcement

Collapse
No announcement yet.

Maya attribute ---> translator ----> vrscene : lost.

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

  • Maya attribute ---> translator ----> vrscene : lost.

    Hi,
    I have a problem : i create a tool where the user sets a settings on Maya attribute. After the tool gets the user setting of the Maya attribute and modifies the vrscene in Python Scene access.
    The problem is : i don't know how to find the Maya attribute in the vrscene.

    Here a example :
    The user does something on the attribute checker1.color1 of a Maya checker node.

    In the vrscene, i will have :
    Code:
    TexChecker checker1 {
      compatibility_with=1;
      alpha_from_intensity=0;
      invert=0;
      color_mult=AColor(1, 1, 1, 1);
      color_offset=AColor(0, 0, 0, 1);
      alpha_mult=1;
      alpha_offset=0;
      nouvw_color=AColor(0.5, 0.5, 0.5, 1);
      uvwgen=place2dTexture1;
      white_color=VRayUserColor1;
      black_color=AColor(0, 0, 0, 1);
      contrast=1;
    checker1.color1 in Maya is checker1.white_color in the vrscene.

    Another example with material.
    The user does something on the attribute VRayMtl1.color in Maya.
    In the vrscene, i will have :
    Code:
    BRDFDiffuse VRayMtl1@diffuse {
      color=Color(0, 0, 0);
      color_tex=VRayUserColor1;
      transparency_tex=checker1;
      roughness=0;
      use_irradiance_map=1;
    }
    VRayMtl1.color in Maya is VRayMtl1@diffuse.color_tex in the vrscene.

    If it is reflection attribute for example, VRayMtl1.reflectionColor in Maya is VRayMtl1@glass.color_tex in the vrscene.

    So the problem is : how can i find the relation between the Maya attribute and the vrscene attribute ? There is a hidden command ?
    Or what is the best approach please ?

    Thank you
    Last edited by bigbossfr; 07-09-2013, 07:22 PM.
    www.deex.info

  • #2
    You can probably get the V-Ray plugin that corresponds to a given Maya material using the exportMaterial() Python function (or exportTexture()), but the relationship between the attributes can be very complicated. May I ask for some more details on what you want to do?

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

    Comment


    • #3
      I will send you an email .
      www.deex.info

      Comment


      • #4
        Hi Vlado,
        Did you receive my email ?

        Thank you.
        www.deex.info

        Comment


        • #5
          Yep, I need to think a bit more about it though.

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

          Comment


          • #6
            So, in VRay installation, there is a file : C:\Program Files\Autodesk\Maya2013\vray\shaders\desc.txt

            With this file, i have the vray attributes and the Maya attributes relation.
            So, it will be very easy in Python to do a file parser (i can do this for you if you want ), like :
            getDesc("mayaNodeType.mayaAttribute")

            Example in desc.txt :
            Code:
            TexFresnel VRayFresnel {
              "white_color" texture "frontColor" texture INPUT
              "black_color" texture "sideColor" texture INPUT
              "fresnel_ior" number "IOR" number INPUT
              "refract_ior" number "IOR" number INPUT
              "" texture       "outColor" texture OUTPUT
              "" texture       "oc" color OUTPUT
              "" texture_red   "outColorR" number OUTPUT
              "" texture_green "outColorG" number OUTPUT
              "" texture_blue  "outColorB" number OUTPUT
              "" texture_alpha "outAlpha" number OUTPUT
            }
            And the command will return a class like :
            import vray.utils as vr
            myNode = vr.getDesc("VRayFresnel.sideColor")
            print myNode.vrayAttrName
            result : "black_color"

            print myNode.vrayAttrType
            result : "texture"

            print myNode.mayaAttrName
            result : "sideColor"

            print myNode.mayaAttrType
            result : "texture"

            print myNode.mayaAttrRes
            result : "INPUT"

            The problem is : it is missing some nodes ! I see nothing about VRayMtl for example.
            I don't know if you can add all nodes it this little .txt ?

            What do you think Vlado ?
            www.deex.info

            Comment


            • #7
              Originally posted by bigbossfr View Post
              The problem is : it is missing some nodes ! I see nothing about VRayMtl for example.
              I don't know if you can add all nodes it this little .txt ?
              This file is use only for the simple nodes, where the exporter would be straight forward to write in C++.
              When the export logic is complex - we do not use the desc.txt file, but instead we do write it in pure C++.
              The export logic is pretty complex, when it comes to exporting VRayMtl (it is exported in multiple plugins if all features are enabled/used)

              So we don't have any plans to add support for VRayMtl or other complex materials/textures in this file.
              Adding such support would mean that we should extend the syntax of the file to include programming language features (if, loops, etc),
              which are not easy to do and also it will defeat the purpose of the file - being simpler.
              V-Ray developer

              Comment


              • #8
                Originally posted by t.petrov View Post
                This file is use only for the simple nodes, where the exporter would be straight forward to write in C++.
                When the export logic is complex - we do not use the desc.txt file, but instead we do write it in pure C++.
                The export logic is pretty complex, when it comes to exporting VRayMtl (it is exported in multiple plugins if all features are enabled/used)

                So we don't have any plans to add support for VRayMtl or other complex materials/textures in this file.
                Adding such support would mean that we should extend the syntax of the file to include programming language features (if, loops, etc),
                which are not easy to do and also it will defeat the purpose of the file - being simpler.
                Yes, i saw that when we use a VRayMtl with just diffuse, the exporter write just a brdf diffuse in the vrscene for example...
                It is a very good optimization

                So, i don't know what is the best approach.
                Perhaps the solution is to give a input list of maya node attributes ([bla.visibility, vraymtl.color]) on an attribute in the vraySettings node, and when the exporter in called, the exporter gets this list, tracks attributes, and stores the result in the a vrscene attribute with the same order (or dictionary) ?
                www.deex.info

                Comment

                Working...
                X