I'm trying to speed up a script that has to generate a black and transparent object (those are the only two RGBA colors), and use the pixel data coming from pictures of it shot from multiple angles. At the moment I'm using Blender Internal to render the whole scene for every position and then reload the saved images inside PIL to use the pixel data.
I would like to avoid having to save every image just to use said data.
I found out that:
rendering without write_still=True is not useful to me, since I can't access the rendered image or its data without saving it to a filepath;
baking doesn't seem to work either.
I think baking might be the way, but my code isn't outputting a different render for every camera position. What I'm doing is:
# setup image to bake to bpy.data.images.new('test', 500, 500, alpha=True) # uvm in my code is an existing uvm, but this works as an example uvm = bpy.data.objects['Plane'].data.uv_textures['uvmPlane'] # unwrap test on the uv layer for d in uvm.data: d.image = D.images['test'] # setup baking and bake bpy.data.scenes['Scene'].render.bake_type = 'FULL' bpy.ops.object.bake_image()
The output is the same transparent and black texture that exists on the Plane object, regardless of the camera position.