Accessing V-Ray Material Parameters [SOLVED]



  • On 04/01/2017 at 02:22, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   16+ 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hi there,

    I simply cannot get this to work. Please help!
    I try to set the color and to exchange Texture links within an Advanced VRay material and its Advanced Bitmap Shader.
    This is what I have so far (getting the link to a V-Ray Advanced Material from a Texture-Tag and trying to read out the shader loaded to the Diffuse Layer 1 -> Diffuse Color Texture slot) :

    BaseTag* TexTag = MyObjekt->GetTag(Ttexture);
    if (TexTag)
    {
         BaseMaterial* Material = ((TextureTag* )TexTag)->GetMaterial(true);
         if (Material)
         {
              if (Material->GetType() == 5703)
              {
                   // Material is of Type V-Ray Advanced Material
                   GeData Vray_data;
                            Material->GetParameter(DescID(4100), Vray_data, DESCFLAGS_GET_0); // VRAYMATERIAL_COLOR1_SHADER -> Texture link field in the material
                            BaseShader *shader = static_cast<BaseShader*>(Vray_data.GetLink(doc, 0));

    }
         }
    }



  • On 05/01/2017 at 01:42, xxxxxxxx wrote:

    Hi Arndt, thanks for writing us.

    With reference to your code I'd say it looks fine at a least from a Cinema 4D SDK point of view. So I guess, there must be something happening on the V-Ray implementation side. Unfortunately the MAXON SDK Support team has no information about it, hence I suggest you to directly ask the VRAYforC4D guys (LAUBlab) or somebody in our community can help out.

    As side note please I also invite you to make use of the

    tag to include your code snippets in order to improve code readability.

    Best, Riccardo



  • On 05/01/2017 at 06:11, xxxxxxxx wrote:

    Hi Riccardo,

    thanks for your reply. I will try to contact LaubLab directly then.



  • On 06/01/2017 at 05:46, xxxxxxxx wrote:

    Hi Arndt,

    may be try this code instate.

      
    BaseTag* TexTag = Mein Objekt->GetTag(Ttexture);  
    if (TexTag) {  
      BaseMaterial* Material = static_cast<TextureTag*>(TexTag)->GetMaterial(true);  
      if (Material) {  
          if (Material->GetType() == 1020295) {  
              // Material ist ein V-Ray Advanced Material  
              BaseContainer *bc = Material->GetDataInstance();  
              BaseShader *shader = static_cast<BaseShader*>(bc->GetLink(VRAYMATERIAL_COLOR1_SHADER, doc));  
      
          }  
      }  
    }  
    

Log in to reply