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 create transparency channel for a material

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 540 Views
    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.
    • H Offline
      Helper
      last edited by

      On 13/02/2018 at 13:54, xxxxxxxx wrote:

      Hi,

      To insert a texture into the color channel , I applied the following lines of code with success:

      full_name_file = pathToTexture + '/' + texture_file
      shdr_texture = c4d.BaseList2D(c4d.Xbitmap)                    
      shdr_texture[c4d.BITMAPSHADER_FILENAME] = full_name_file      
      mymat[c4d. MATERIAL_COLOR_SHADER ]= shdr_texture                             
      mymat.InsertShader(shdr_texture)                              
      mymat.Update(True, True)

      Then,I tried to do the same thing to insert a texture in the transparency channel , with the following code:

      full_name_file = pathToTexture + '/' + texture_file
      shdr_texture = c4d.BaseList2D(c4d.Xbitmap)                    
      shdr_texture[c4d.BITMAPSHADER_FILENAME] = full_name_file       
      mymat[c4d. MATERIAL_TRANSPARENCY_SHADER ]= shdr_texture          
      mymat.InsertShader(shdr_texture)                                
      mymat.Update(True, True)

      However, this code had no effect because the transparency channel isn't created by default.

      Before the insertion of the texture, I think it is necessary to create the transparency channel for the material.

      How to proceed with python ?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 13/02/2018 at 16:18, xxxxxxxx wrote:

        I finally found the solution to my question.

        One line of code was enough to create the transparency channel.

        mymat[c4d. **MATERIAL_USE_TRANSPARENCY** ] = True
        

        But if you know a good documentation on this subject, don't hesitate  to take part

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 14/02/2018 at 04:47, xxxxxxxx wrote:

          Hi,

          in our C++ documentation we have a manual about Materials, actually the entire Materials ans Shaders Overview and all child pages might be interesting for you. While these pages are in our C++ docs and contain only C++ code snippets (yet), the general concepts are the same in Python.

          In order to find out about parameter IDs, I'd like to remind you of my suggestion in your other thread (Limit a material to a selection tag). You can either drag a parameter to the Command Line or take a look into the resource files directly (in this case (easily found by searching e.g. for Mmaterial) <Cinema 4D installation dir>/resource/modules/c4dplugin/description/mmaterial.res).

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