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
    • Recent
    • Tags
    • Users
    • Login

    Assigning an image to a Material

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 183 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 19/12/2013 at 06:55, xxxxxxxx wrote:

      Hi,

      I'm translating a C.O.F.F.E.E program to Python.

      I want to set the Texture of the Color, Bump, Alpha Channel.

      Part of my code that work:

      mat[c4d.CHANNEL_COLOR] = True           
                mat[c4d.MATERIAL_COLOR_COLOR] = Diffuse
                mat[c4d.MATERIAL_COLOR_BRIGHTNESS] = 1.0

      mat.Update(True, True)

      I have a jpg image path in the variable TextureMap
      But i don't know how to set the Channel in python.

      Thank for any help.

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

        On 19/12/2013 at 08:43, xxxxxxxx wrote:

        Like this:

          
          bitmap = c4d.BaseList2D(c4d.Xbitmap) # create bitmap   
          bitmap[c4d.BITMAPSHADER_FILENAME] = 'texture.jpg' # path or name if relative texture path  
          mat[c4d.MATERIAL_COLOR_SHADER]= bitmap # assign bitmap to color channel  
          mat.InsertShader(bitmap) # insert bitmap   
        

        You can also use 'InsertUnder(bitmap)' and should use it if you insert a shader in another shader. For example in a filter: filter.InsertUnder(bitmap)

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