I'm trying to render an animation simultaneously from 32 points of view and integrate the result in a composed animation.

I followed this answer: How to create a render layer in blender python

and this one: How to combine renders from multiple cameras

However using:

for i in Hs:
 for j in Ws:
   newscene.name='scene_h_'+ str(i)+'_w_'+str(j)
   new_render_layer =  scene.render.layers.new('rl_h_'+ str(i)+'_w_'+str(j)) 

Each scene render.layers.active is equal to:


Or in other words, whatever scene is selected the following is true:

bpy.context.scene.render.layers.active.name == "RenderLayer"

Also the scenes would always miss only the last render layer created

 e.g.   rl_h_0_w_4 not in scene_h_0_w_4 but scene_h_0_w_4 in scene_h_0_w_5

How can I associate each scene to a different render layer and compose them in the final scene?

  • 1
    $\begingroup$ Related blender.stackexchange.com/questions/52231/… $\endgroup$ – Duarte Farrajota Ramos Dec 12 '18 at 2:15
  • 1
    $\begingroup$ if you ffind out, let me know because thats seems pretty useful. $\endgroup$ – eromod Dec 12 '18 at 4:15
  • $\begingroup$ @eromod I found the error... This line new_render_layer = scene.render.layers.new('rl_h_'+ str(i)+'w'+str(j)) has a typo. Should be new_render_layer = newscene.render.layers.new('rl_h_'+ str(i)+'w'+str(j)) $\endgroup$ – Dimitri Ognibene Dec 12 '18 at 14:04

Actually there was a typo. The following script creates a new scene and a new render layer making it the active one for that scene

for j in range(N_PERSP_x):
   bpy.context.screen.scene.name='scene_h_'+ str(j)+'_w_'+str(j)
   new_render_layer =  newscene.render.layers.new('rl_h_'+ str(j)+'_w_'+str(j))        
   newscene.render.layers.active = new_render_layer

You can check the results with:

for scene in bpy.data.scenes:
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.