Mine is a basic 3D CAD drawing application written in C++
I am trying to integrate cycles in my application. I could build cycles scene and session in memory. Now I need to bake textures of each object and export the scene. I could not find how to bake textures. Spent more than a year but no luck. Tried exploring how blender is doing but lost in its RNA and python stuff.
Can you please provide a code sample?
Thanks in advance.
The difficulty is that much of the baking code is implemented in Blender. For Cycles you can evaluate shaders at specified coordinates on triangles, while the logic for rasterization and baking high-to-low poly is implemented inside Blender.
Thank you @boberfly and @brecht
I think, I am progressing well with your support.
My meshes have both UV Channels. (Texture UV and Unwrapped UV).
How to tell Cycles which channel to take?
It looks like we need to calculate UV at each pixel it seems. Basically I need to populate bake_data after the below step. Please help.
I did some looking into the bake code a while back, still haven’t found the time to finish the project I started, but I’ve been writing down my notes and they may help you – Help: Information on Cycles Bake code