8
$\begingroup$

I would like to generate several renders of a static scene, each render being a different size (eg 1024x1024, 512x512 etc). Other than the size, each render will be identical.

Is there a way of doing this using, say, the command line, or a script? I am currently doing this by manually changing the dimensions within the render panel every time, but I was wondering if there's a quicker way.

I am using Blender Internal in this specific instance.

Many thanks

$\endgroup$
  • $\begingroup$ Both great answers, many thanks user320 and tobkum. $\endgroup$ – jennyp Oct 8 '13 at 15:12
8
$\begingroup$

Yes, there is a way to do this from one blender file. You have to create new Scenes, using the Link Objects method (available from the Info header) then you can change the render settings just like you normally would. (Also see Can I set render settings by individual scenes? for more info about scene copying options.)

enter image description here

enter image description here

enter image description here

Note:

  • As previously mentioned by tobkum, in your case where the resolutions sizes are multiples of one another you might be better off just rendering out the largest one and then re-sizing the smaller ones.

  • As previously mentioned by gandalf3, you can also make sure you have a large enough render to encompass all the different sizes/aspect ratios, then crop/scale in the compositor.

After doing this, you can automate rendering these by batch rendering multiple scenes from the command line.

$\endgroup$
  • $\begingroup$ I'm curious, what's the reason for a full copy instead of linked objects? $\endgroup$ – Haunt_House Oct 8 '13 at 12:40
  • 1
    $\begingroup$ You can also use linked copy, but I am not sure it it lets you set the render settings independently. I do not have blender available right now. Maybe someone can confirm? $\endgroup$ – user320 Oct 8 '13 at 12:56
  • 2
    $\begingroup$ It certainly does. So I would recommend to 'link objects' since it won't double the file size. It's still a new scene, so the scene settings can be changed. Just all the objects are borrowed. Another advantage: you can change something and the change will affect both scenes. Even better is the approach to have your main data in a background scene and just the camera in the different scenes. Then everything you do in the main scene (also duplication) shows everywhere. Pity the file output node seemingly doesn't incorporate different sizes. Maybe just use Phatch for it. $\endgroup$ – Haunt_House Oct 8 '13 at 13:07
  • $\begingroup$ sorry, about no giving credit, will not happen again. Did not know that was necessary gor here. $\endgroup$ – user320 Oct 9 '13 at 0:28
8
$\begingroup$

You could also render the maximum size and then plug some Scale nodes into the compositor followed by File Output nodes. That way you only have to render once, and the smaller resolutions will be generated by the big one. (set the Scale node to Absolute and choose the size in the X and Y fields below)

$\endgroup$
  • $\begingroup$ This does work if the resolution is scaled linearly in x and y. But what if it lets say widescreen and 4:3? $\endgroup$ – user320 Oct 8 '13 at 13:54
  • $\begingroup$ @user320 True, I figured from the original question that this might work in that case, since he gave the examples 1024x1024, 512x512 etc. $\endgroup$ – tobkum Oct 8 '13 at 13:58
  • $\begingroup$ I agree in this case there is no need to re-render. $\endgroup$ – user320 Oct 8 '13 at 14:03
  • $\begingroup$ @user320 You could also make sure you have a large enough render to encompass all the different sizes/aspect ratios, then crop/scale in the compositor $\endgroup$ – gandalf3 Oct 8 '13 at 20:26
  • $\begingroup$ If all outputs are the same aspect ratio I would scale down to another file in the compositor. If I was after multiple aspect ratios I would combine this with @user320 answer of multiple scenes. Probably two scenes one for 4:3 and one for 16:9 with possible camera adjustments to ensure good framing. $\endgroup$ – sambler Oct 9 '13 at 13:44
3
$\begingroup$

I have used the following script from my toolbox to address a similar problem. I have adapted my script as per your question.

import bpy

# Original scene
source = bpy.context.scene

# Resolutions at which to render wedges
resolutions = [100, 50, 25]

# This list will contain the wedges to be created in next step 
wedges = []

# Create the wedges
for i in range(0, 3):
     bpy.ops.scene.new(type='LINK_OBJECTS')
     scene = bpy.context.scene
     scene.name = '{0}.{1}'.format(source.name, i+1)
     scene.render.filepath = '//{0}.'.format(scene.name)
     scene.render.resolution_percentage = resolutions[i]
     wedges.append(scene)

# Set the screen to display the original scene     
bpy.context.screen.scene = source

# Render the wedges
for scene in wedges:
    bpy.ops.render.render(write_still=True, scene=scene.name)
    bpy.data.scenes.remove(scene)

del wedges

You can copy/paste this into a text editor in a running session of blender, save the bland file with your scene setup, and then hit ALT+P in the text editor to run the script.

The script in action

This script can also be used to render from the command line like so

blender -b filename.blend -P wedges.py
$\endgroup$
  • $\begingroup$ Satishgoda, I have only just seen this reply to my original question. I wanted to thank you very much, as well as the other contributors, for such helpful replies. Thank you - your script works beautifully! $\endgroup$ – jennyp May 27 '14 at 9:36

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.