turrican last edited by m_adam
I need to load in a normal map into a standard material using Python.
The scene is an imported FBX with over 100 materials. The color channel loads in "Texture_Colour.TGA", however the normal maps are not imported, even though they exist in the texture folder.
What I would like is to scan the texture folder for "Texture_Normal.TGA" and apply it to the relevant material.
Is this possible with Python?
m_adam last edited by
Hi @turrican welcome in the plugincafe community.
I moved your topic in the correct category and assigned tags, see (How to Post Questions) Please do it for your next topics.
Regarding your question, yes it's possible to do it in python. however, I suggest you contact maxon support to report the initial bug regarding the FBX importer.
Now you have to keep in mind here we don't code for you but help you to achieve what you want.
So the steps in python for doing it are:
- Loops over each material.
- Retrieves their name.
- Create a Bitmap Shader and assign it to the correct channel of the material (normal).
# Retrieve the first material of the current document mat = c4d.documents.GetActiveDocument().GetFirstMaterial() # loop over each material while mat is not None: # Do the things for each mat mat = mat.GetNext()
To create a bitmap shader (c4d.Xbitmap) and assign a texture to it find an example in shader_create_bitmap_r13.py.
To know the ID of the normal channel, just drop and drop it into the console, see Python Console - Drag and Drop.