Hello Devtalk!
I’m currently working on a script to bake a normal map from a texture.
But after some hours of research, I have a colorspace problem on the exported normal map.
Description of each steps:
- Loading Python modules
- Managing custom args via the argparse module
- Activate the builtin addon “import images as planes” and import my texture
- Scale the object 3 times to avoid seams on the border when rendering
- Applying a subsurf (needed for displacing)
- Replace the shader of the object with the correct shader (with displace activated) and load the texture inside of it
- Duplicate the object, scale it down 3 times and applying an empty material
- Select both objects and bake
- Save the baked image
- Delete the temporary object used to bake
When I open my saved image, the normal looks very weird (yellowish instead of purplish blue).
When I did the same steps but import the image as plane by hand, all worked as expected and the final exported map is correct.
This is all my files: https://1drv.ms/u/s!AmJL0Awo6vVNjZUz9yhDAQXt8WdwuQ?e=EOm4z6
Thank you,
Léo D.