# Generating Individual Assets

This tutorial will help you generate images, .blend files, or baked OBJ/USD/etc files for any asset of your choosing.

## Example Commands

Shown are three examples of using our `generate_individual_assets.py` script to create images and .blend files. If you want to create asset files in another format (e.g. OBJ, FBX, USD) you should first generate blend files then use our [](./ExportingToExternalFileFormats.md) docs to bake them to the format of your choosing. 

```bash
mkdir outputs
python -m infinigen_examples.generate_individual_assets --output_folder outputs/corals -f CoralFactory -n 2 --save_blend
python -m infinigen_examples.generate_individual_assets --output_folder outputs/seashells -f Seashells -n 2 --save_blend
python -m infinigen_examples.generate_individual_assets --output_folder outputs/chunkyrock -f ChunkyRock -n 2 --save_blend
```

<p align="center">
  <img src="./_static/images/individual_assets/coral.png" width="150" />
  <img src="./_static/images/individual_assets/seashells.png" width="150" />
  <img src="./_static/images/individual_assets/chunkyrock.png" width="150" />
</p>

Running the above commands will save images and .blend files into your `outputs` folder. You can customize what object is generated by changing the `-f` argument to the name of a different AssetFactory defined in the codebase (see the file `tests/test_meshes_basic.txt` for a partial list).

Please run `python -m infinigen_examples.generate_individual_assets --help` for a full list of commandline arguments.

## Generate many different assets in one command

:warning: There are a small number of assets which are used in the main system but are not included in the tests/infinigen/assets/*.txt lists for various reasons. You can read the commented lines in `tests/infinigen/assets/list_nature_meshes.txt` for a partial list. There are also other types of procedural generators (lighting, colors, scatters, volumetrics, animations, etc) besides meshes/materials, which add diversity to the main rendering system but are not included in the commands below.

Generate one of each mesh in the unit tests list:
```bash
python -m infinigen_examples.generate_individual_assets --output_folder outputs/corals -f tests/infinigen/assets/list_nature_meshes.txt -n 1 --save_blend
python -m infinigen_examples.generate_individual_assets --output_folder outputs/corals -f tests/infinigen/assets/list_indoor_meshes.txt -n 1 --save_blend
```

Generate one of each material in the unit tests list:
```bash
python -m infinigen_examples.generate_individual_assets --output_folder outputs/corals -f tests/infinigen/assets/list_nature_materials.txt -n 1 --save_blend
python -m infinigen_examples.generate_individual_assets --output_folder outputs/corals -f tests/infinigen/assets/list_indoor_materials.txt -n 1 --save_blend
```

## Creating OBJ, USD, FBX and other file formats

You can use the `--export` flag to export each generated asset to a format of your choosing. Please see [ExportingToExternalFileFormats](./ExportingToExternalFileFormats.md) for details and limitations regarding exporting. 

Examples:

```bash

# Save a coral as an OBJ with texture maps
python -m infinigen_examples.generate_individual_assets --output_folder outputs/corals -f CoralFactory -n 1 --render none --export obj

# Save a bush as OpenUSD 
python -m infinigen_examples.generate_individual_assets --output_folder outputs/bush -f BushFactory -n 1 --render none --export usdc

# See the full list of supported formats
python -m infinigen_examples.generate_individual_assets --help
```


