How to create transparency channel for a material
-
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 ?
-
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
-
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).