GitXplorerGitXplorer
j

synthblend

public
3 stars
1 forks
4 issues

Commits

List of commits on branch master.
Unverified
9103feb7e9bb34d121bf8c0df931bcceaf4878b6

Fix shadow positioning

jjohnsutor committed 4 years ago
Unverified
a9c2237122f9406a68db4b7d5f3aab4afecdcade

Add shadow catching to blender script

jjohnsutor committed 4 years ago
Unverified
32d157e861cf705d0674d8d7138b9499d5f6425a

Add new background images

jjohnsutor committed 4 years ago
Unverified
9ee6a575f4676a22a32e4d3e21f5340a3d246b4f

Add stochastic offset to object position

jjohnsutor committed 4 years ago
Unverified
9b138994989235de035e426a97325de64012ca0e

Update README

jjohnsutor committed 4 years ago
Unverified
f79c85c89f2ea6b55d90542fa733a26662043568

Merge branch 'master' of https://github.com/johnsutor/synthblend into master

jjohnsutor committed 4 years ago

README

The README file for this repository.

SynthBlend

Basic Render

A library for generating simple synthetic images from withing Blender. Imposes a 3D model onto a predetermined background

Requirements

This library requires a Blender install of version >= 2.80. In order to work with models not already within the models directory, you must name your object the same as your file name.

Getting Started

There are no external dependencies to install for synthblend.py, though if they exist in the future, they may be installed with

pip install -r requirements.txt

To start running the script, you must change your current directory into the location of your Blender install. For example,

$ cd "C:\Program Files\Blender Foundation\Blender 2.83"

Next, run the script by specifying running a Python script in Blender in headless mode. For a basic working script (assuming that your synthblend directory is stored at C:\synthblend\), run

$ .\blender -b --python C:\synthblend\synthblend.py -- -w C:\synthblend\synthblend.py

This will generate an image taken from a random angle, and output it to C:\synthblend\renders\

Usage

.\blender -b --python <Location of synthblend.py> -- -w <Work Directory>

Generates a synthetic image with the supplied model, mesh, and background image

Options

-b --backgrounds Specify the backround images subdirectory
-bb --bounding_box {YOLO} Specify which bounding boxes to use (default is None)
-m --models Speficy the .dae object models and meshes subdirectory
-r --renders Specify the final renders subdirectory
-ra --radius Specify the spherical coordinate radius for the camera-background system
-rc --render_count Specify the current render count. NOTE This will not create more renders, this is only useful as a naming convention when generating large amounts of synthetic data.
-pmin --phi_min Specify the minimum angle phi (angle from the vertical), in radians, to rotate the camera-background system. Must be between 0 and pi / 2, inclusive.
-pmax --phi_max Specify the maximum angle phi (angle from the vertical), in radians, to rotate the camera-background system. Must be between 0 and pi / 2, inclusive.
-tmin --theta_min Specify the minimun angle theta (angle about the horizontal), in radians, to rotate the camera-background system. Must be between 0 and 2 * pi, inclusive.
-tmax --theta_max Specify the maximum angle theta (angle about the horizontal), in radians, to rotate the camera-background system. Must be between 0 and 2 * pi, inclusive.

Model Directory Structure

Although there is some degree of lee-way in how you choose to organize your directories, the models directory is strict in terms of how files and subdirectories within it should be formatted. Within the models directory, models should be made available in the .dae file format. Additionally, each .dae object should have the same name as its accompanying file. Otherwise, blender will not be able to locate the object. To specify the meshes applicable to each object, create a directory within the models directory that shares the same name as the .dae file. In this directory that contains the meshes to be applied at random to the .dae model, the naming conventions for the image formats does not matter.