In this example we demonstrate how to switch materials.
Execute in the BlenderProc main directory:
python run.py examples/material_randomizer/config.yaml examples/material_randomizer/scene.obj examples/material_randomizer/output
examples/material_randomizer/config.yaml: path to the configuration file with pipeline configuration.examples/material_randomizer/scene.obj: path to the object file with the basic scene.examples/material_randomizer/output: path to the output directory.
Visualize the generated data:
python scripts/visHdf5Files.py examples/material_randomizer/output/*.hdf5
- Loads
scene.obj:loader.ObjectLoadermodule. - Creates a point light:
lighting.LightLoadermodule. - Sets two camera positions:
camera.CameraLoadermodule. - Selects materials based in the:
manipulators.EntityManipulatormodule. - Renders rgb:
renderer.RgbRenderermodule. - Writes the output to .hdf5 containers:
writer.Hdf5Writermodule.
{
"module": "manipulators.EntityManipulator",
"config": {
"selector": {
"provider": "getter.Entity",
"conditions": {
"type": "MESH"
}
},
"cf_randomize_materials": {
"randomization_level": 0.5
}
}
},The focus of this example is the fucntionality of the manupulators.EntityManipulator module, which allows us to change the material of the objects randomly.
- Sets the
randomization_levelto 0.5, which means that a material has the change of 0.5 to be replaced with another one.
Select the pool of objects for which we randimize materials with certain probability, and select material substitute. If no getter.Material is called, a random material from all of the materials will be used as substitution.
Check object_manipulation for more information about selectors.
Check the scenenet_with_cctextures for a more advanced example of the MaterialManipulator.
- camera_sampling: More on sampling for cameras.
- light_sampling: More on sampling for lights.

