1
$\begingroup$

I just started learning blender and python.

Is it possible to write a script that does this?

  1. imports a 3d model from a folder
  2. creates 100 cameras with random positions (the 3d model should fit the picture)
  3. creates random exposure
  4. renders images from all 100 cameras and saves them
  5. does it with all 3d models in the folder
$\endgroup$
  • $\begingroup$ To my knowledge, Blender doesn't generate random numbers. This might have changed, though. $\endgroup$ – Lukasz-40sth Aug 2 at 8:11
  • 2
    $\begingroup$ @Lukasz-40sth noise.random() or random.random() makes it very easy to get random numbers. $\endgroup$ – Ray Mairlot Aug 2 at 15:33
0
$\begingroup$

I believe this is possible and not too difficult. The trick is: Do one iteration manually by clicking in the menus etc. and Blender will create most of the code for you. Then you just switch to the Scripting layout (or change one of your panels to Scripting -> Info type) and there is the code Blender used to perform your operations.

For example I just added a camera in my scene and I see this line:

bpy.ops.object.camera_add(enter_editmode=False, align='VIEW', location=(0, 37.462, -0.0662922), rotation=(1.5708, -0, 1.5708))

You then need to change the numbers into variables and make some for-loops and you are done in no time.

| improve this answer | |
$\endgroup$

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