Blender Studio
  • Films
  • Projects
  • Training
  • Characters
  • Tools
  • Blog
  • Join
  • BLENDER.ORG

    • Download

      Get the latest Blender, older versions, or experimental builds.

    • What's New

      Stay up-to-date with the new features in the latest Blender releases.

    LEARNING & RESOURCES

    • Blender Studio

      Access production assets and knowledge from the open movies.

    • Manual

      Documentation on the usage and features in Blender.

    DEVELOPMENT

    • Developers Blog

      Latest development updates, by Blender developers.

    • Documentation

      Guidelines, release notes and development docs.

    • Benchmark

      A platform to collect and share results of the Blender Benchmark.

    • Blender Conference

      The yearly event that brings the community together.

    DONATE

    • Development Fund

      Support core development with a monthly contribution.

    • One-time Donations

      Perform a single donation with more payment options available.

Training Highlights
Stylized Rendering with Brushstrokes
Geometry Nodes from Scratch
Procedural Shading Fundamentals
Stylized Character Workflow

Training types
Course Documentation Production Lesson Workshop

Training categories
Animation Geometry Nodes Lighting Rendering Rigging Shading
Film Highlights
Wing It!
2023
Charge
2022
Sprite Fright
2021
Spring
2019
Project Highlights
Project DogWalk
Interactive
Gold
Showcase
BCON24 Identity
Showcase
Fighting with Grease Pencil
Article
Course
Scripting for Artists
Blender Versions
Videos
  1. 01

    Introduction & copy-pasting

    Free
  2. 02

    Names & Objects

  3. 03

    Stuff on Lists

  4. 04

    Data Types

  5. 05

    Collections: Mass-Rename of Objects

  6. 06

    Blender Collections

    Free
  7. 07

    For vs. While

    Free
  8. 08

    Your Own Operator

    Free
  9. 09

    From Script to Add-on

    Free
  10. 10

    User Interfaces

    Free
  11. 11

    Custom Properties

    Free
  12. 12

    Asset Linking

    Free
  13. 13

    Roast my Add-on

    Free
  14. 14

    The Roast of Nature Clicker

    Free
  15. 15

    Modal Operators

    Free
  16. 16

    Readability & Understandability

Tech
  1. 01

    Updating F-Curves

  2. 02

    Render 10,000 OBJ files

  3. 03

    Mass-Rename Bones & Vertex Groups

  4. 04

    Rendering from 'all' angles

Login to view this content

Join Blender Studio for just €11.50/month and get instant access to all of our training and film assets!

Login Join Blender Studio
Sybren Stüvel
Sybren Stüvel Author
License CC-BY
Report Problem
Tech

Render 10,000 OBJ files

This is the second video in a series of “tech videos” in which Sybren discusses concrete problems seen on Stack Exchange. This video is all about loading 10,000 individual OBJ files and rendering them to 10,000 images.

  • Use of pathlib.Path to access the filesystem
  • Loading, rendering, and subsequently removing from memory, individual OBJ files
  • Breaking out of loops with the break statement.

Links from the video

  • The question on Stack Exchange
  • Python's pathlib module
  • The break statement

The Slides

Slides are only visible to Blender Cloud susbcribers

Join to leave a comment.

3 comments
gagan.zedinteractive
gagan.zedinteractive
April 15th, 2019

Hi Sybren

First of all thank you very much for making these wonderful tutorials These tutorials are very helpful.

I need some help from you to achieve some functionality.

I have tried loading fbx files and rendered them through this scripting.

Apart from this i want to achieve the following working -

  1. I want to open blender files located at a given path.
  2. Change textures of some objects in that blender file
  3. Set angle of the camera
  4. Render the scene and save the render at a given location.

This will go in a loop for many blender scenes same like you did for .obj files but instead i want to do the same for blender whole scene file with proper lighting.

From above points I have checked the 1 and 4 point and i hope i will be able to achieve the 2 and 3 point also. But my problem is when i open a blender file using following script -

obj_root = pathlib.Path("I:/PythonBlender/first.blend") bpy.ops.wm.open_mainfile(filepath= str(obj_root))

the old file running the python scripts is closed and this new first.blend file is opened in blender. I want my python scripts to keep running and the scenes should load as an addon. and remove the addon scenes after rendering is finished.

Please help me achieve this functionality. Thankyou so much

Jarosław Dzedzej
Jarosław Dzedzej
Oct. 21st, 2020

*@gagan.zedinteractive* not sure if it will work, but I think you should try appending the scene to the current blend file instead of opening a new .blend (as you are in fact running a separate instance of blender) , this I guess should leve the script running and allow you to interact with the additional scene in your original .blend (not sure how to do it in python though)

Show more replies
Sybren Stüvel
Sybren Stüvel
April 25th, 2022

@gagan.zedinteractive You can start another Blender instance from Blender itself. That's the easiest way to get this kind of processing done. Run blender --help to see all the possible options. Probably the form you'd want to use is blender.exe thefile.blend -P thescript.py, where thescript.py takes care of everything that needs to happen with that particular file.

Films Projects Training Blog Blender Studio for Teams
Pipeline and Tools
  • CloudRig
  • Blender Kitsu
  • Brushstroke Tools Add-on
  • Blender Studio Extensions
Characters
  • Mikassa
  • Whale
  • Ballan Wrasse
  • Snow
Studio
  • Terms & Conditions
  • Privacy Policy
  • Contact
  • Remixing Music
Blender Studio

The creators who share.

Artistic freedom starts with Blender The Free and Open Source 3D Creation Suite