Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to add Layers Shader - C++

    Cinema 4D SDK
    c++ r19 sdk
    3
    6
    746
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mfersaouiM
      mfersaoui
      last edited by mfersaoui

      Hello,

      How to add Layers Shader that contain two layers (Bitmap shader and Hue/Saturation/Lightness effects) with HSL -100 %.

      BaseMaterial *Mat = BaseMaterial::Alloc(Mmaterial);
      if (!Mat)
      	return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
      
      BaseContainer *Data = Mat->GetDataInstance();
      if (!Data)
      	return true;
      
      BaseShader* bsXlayer = BaseShader::Alloc(Xlayer);
      if (!bsXlayer)
      	return false;
      
      Data->SetLink(MATERIAL_ENVIRONMENT_SHADER, bsXlayer);
      Mat->InsertShader(bsXlayer);
      

      Thanks.

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by r_gigante

        Hi mfersaoui, thanks for reaching out us.

        With regard to your question, whilst it's actually possible to query for the layers belonging to a certain Layer Shader, it's not possible to programmatically add new layers with the current API implementation.

        Here you can find an old discussion on the argument.

        Best, Riccardo

        mfersaouiM 2 Replies Last reply Reply Quote 0
        • mfersaouiM
          mfersaoui @r_gigante
          last edited by

          @r_gigante
          Hi Riccardo,
          Thank you, I will try to import my material from a scene file.

          1 Reply Last reply Reply Quote 0
          • mfersaouiM
            mfersaoui @r_gigante
            last edited by

            @r_gigante

            I have another question, is it possible to edit the Blur Offset and Blur Scale of shader via c++?

            shader-blur.jpg

            Thanks.

            1 Reply Last reply Reply Quote 0
            • S
              s_bach
              last edited by

              "Blur Offset" and "Blur Scale" are parameters of the BaseShader class, so you should be able to access these parameters like any other parameter; if in doubt, they should be available in the shader's BaseContainer. See xbase.h.

              MAXON SDK Specialist

              Development Blog, MAXON Registered Developer

              mfersaouiM 1 Reply Last reply Reply Quote 0
              • mfersaouiM
                mfersaoui @s_bach
                last edited by

                @s_bach

                Thank you.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post