Assigning an image to a Material



  • 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.



  • 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)


Log in to reply