In this example application, we demonstrate how to import custom objects from the Stanford 3D Scanning Repository.
Before running this example, rename user_config.yaml.example
to user_config.yaml
and modify the contents appropriately for your system, as described in our Getting Started tutorial.
You can control the behavior of this example by setting the following parameters in your user_config.yaml
file, e.g.,
SPEAR.PAKS_DIR
is a directory containing scene data in the form of PAK files.SPEAR.PAKS_VERSION_TAG
is the name of a custom version tag for the PAK file we generate in this example.
In order to run this example, you need to build a PAK file containing the Stanford assets as follows.
# download mesh data
python download_dataset.py
# create symlink within the SpearSim project named Stanford
python ../../tools/update_symlinks_for_external_content.py --create --external_content_dir stanford --unreal_project_content_dir Stanford
# import mesh data into the Stanford directory and generate list of assets to include within PAK file
python ../../tools/run_editor_script.py --script /absolute/path/to/spear/examples/import_stanford_dataset/import_dataset.py --unreal_engine_dir path/to/UE_5.5
# build PAK file containing the assets within the Stanford directory
python ../../tools/build_pak.py --pak_file path/to/paks-dir/version-tag/stanford.pak --cook_dirs_file cook_dirs.csv --include_assets_file include_assets.csv --unreal_engine_dir path/to/UE_5.5
# remove Stanford symlink to restore the SpearSim project to its original state
python ../../tools/update_symlinks_for_external_content.py --remove --external_content_dir stanford --unreal_project_content_dir Stanford
Once you have built a PAK file, you can run this example as follows.
python run.py
When running this example, the config parameter SPEAR.PAKS_DIR
must be set to path/to/paks-dir
, and SPEAR.PAKS_VERSION_TAG
must be set to version-tag
, to match the --pak_file
command-line argument you specified when building a PAK file.
You should see a game window appear with the imported custom objects placed in the scene.