In many DIRSIG installations (including the one at the DIRS lab), the included sample scenes are placed into read-only directories. What happens when you want to add additional materials and geometry? This post discusses a neat trick that can help.
The obvious, brute-force, method copies scene contents to a writable location (via cp -R). This is clearly a poor solution for complex scenes, such as Megascene1 which takes several gigs of disc space. Furthermore, copies may end up out of sync with any patches and updates applied to the read-only version.
Another approach reconstructs the scene directory in a writable location using symbolic links (UNIX ln command), making local copies only of files which need to be changed. This technique can be a pain to set up for complex scene directory layouts. Again, a local copy of the material database can become out of sync with the read-only one.
Alternatively, we can take advantage of the INCLUDE_FILE directive. For a material database, we'd make an intermediate file including both the scene's .mat file and a separate .mat with our additions.
Megascene1 cfgs normally point to"megascene.mat". Now, we make a new file called "intermediate.mat" in a writable location, pointing to that instead. This intermediate file has lines:
The obvious, brute-force, method copies scene contents to a writable location (via cp -R). This is clearly a poor solution for complex scenes, such as Megascene1 which takes several gigs of disc space. Furthermore, copies may end up out of sync with any patches and updates applied to the read-only version.
Another approach reconstructs the scene directory in a writable location using symbolic links (UNIX ln command), making local copies only of files which need to be changed. This technique can be a pain to set up for complex scene directory layouts. Again, a local copy of the material database can become out of sync with the read-only one.
Alternatively, we can take advantage of the INCLUDE_FILE directive. For a material database, we'd make an intermediate file including both the scene's .mat file and a separate .mat with our additions.
Megascene1 cfgs normally point to"megascene.mat". Now, we make a new file called "intermediate.mat" in a writable location, pointing to that instead. This intermediate file has lines:
- INCLUDE_FILE = megascene.mat
- INCLUDE_FILE = our_additions.mat
Where "our_additions.mat" contains the materials we want to add. Alternatively, we could just slap additional MATERIAL_ENTRY sections directly in "intermediate.mat". In either case, we must take care not to use any material ID more than once. Note that we now automatically stay up to date with changes to the read-only material database.
This trick can also append additional geometry with ODB files. As long as you're careful with the cfg's PATHS section, the INCLUDE_FILE method will allow for additions to read only scenes, such as target panels for algorithm testing.
This trick can also append additional geometry with ODB files. As long as you're careful with the cfg's PATHS section, the INCLUDE_FILE method will allow for additions to read only scenes, such as target panels for algorithm testing.
Comments