Announcement

Collapse
No announcement yet.

Handling VRayMaterial from C++

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

  • Handling VRayMaterial from C++

    Hello!,
    First of all, this is my first topic. Thus, forgive me if this is not the right place to request help.
    Despite the fact my company has a license I cannot open a topic in the SDK forum.

    My issue is related with VRay sdk for 3dsMax 2018.

    Is there any way to handle the VRayMaterial in a native manner? I mean, handling VRayMaterials without using the paramblock interface.

    Thanks for your help,
    Jesus

  • #2
    Hello,

    Can you elaborate a bit more - what do you need to do with the VRayMtl ?

    Best regards,
    Yavor
    Yavor Rubenov
    V-Ray for 3ds Max developer

    Comment


    • #3
      Thanks for the quick answer Yavor,

      I just need to check some material properties, but trying to guess every single combination of (Parameter block - Parameter) id is rough.
      Thus, I would like to have something like VRayMtl.h where I can access the class definition.

      I attach a code just to give a hint of what I'm asking:

      Code:
      // This is how I'm accessing the properties right now
      void actOnAColor(Mtl* material) {
          // This is the intended way of getting properties in 3ds Max sdk if I'm not wrong
          IParamBlock2 *paramBlock = material->GetParamBlock(VRayMtlParameters::vrayMtl_old_id );
          if (paramBlock != nullptr) {
              Color color = paramBlock->GetColor(VRayMtlParameters::pb_diffuse_color);
              // Do whatever you want with the color.
          }
      }
      
      
      // This is how I would like to access the properties
      void actOnAColor(Mtl* material) {
          VRayMtl *mtl = dynamic_cast<VRayMtl *>(material);
          if (mtl != nullptr) {
              Color color = mtl->GetDiffuseColor(); // Or something similar
              // Do whatever you want with the color.
          }
      }
      Best regards,
      Jesus
      Last edited by jesus_e; 23-08-2018, 01:09 AM. Reason: Add missing colon

      Comment


      • #4
        Actually the param block way is the right way. VRayMtl itself reads the values from the param block in the beginning of the render.
        From the example code I see you've already found the pb2vraymtl.h header that has the IDs of all the params. You should use the GetParamBlockByID function with the values from the first enum (vrayMtl_basic_id, vrayMtl_BRDF_id...).

        If there are params you have trouble finding - list them here and I can check.

        Best regards,
        Yavor

        Yavor Rubenov
        V-Ray for 3ds Max developer

        Comment


        • #5
          Yes, I've found that header.
          I guess I'll stick to the right way.
          Thanks for your help.


          Best regards,
          Jesus

          Comment

          Working...
          X