[model system] Binary pipeline
Posted: Sat Jan 25, 2014 6:02 pm
Hey there, I just merged (https://github.com/pioneerspacesim/pioneer/pull/2643) my initial work for model binary conversion. This is good because
- binary models load faster
- it's possible to create a lighter version of Pioneer without Assimp (let's say Android port)
- it's possible to add more preprocessing options to the "slow" loader
It's not connected to the modelviewer or game yet, I would like some opinions on workflow. First of all, a binary model (.sgm) contains the node structure, geometry, animations and material definitions. It does not contain textures, therefore a .sgm needs to be placed in the model's directory. In-game model loading would be changed to:
- look for modelname.sgm first
- if not found, look for modelname.model instead.
Ability to load .models in game should be retained for faster iteration. Binary models will never be checked into the game repository.
For creating the binary models, the options are:
1. Automated during gameplay
2. Manual per-model (dump button in modelviewer)
3. Scripted command line conversion.
Option #1 is not good, the models would need to be written under user directory instead and when you make changes to models you need to handle cache invalidation. Caused problems in the LMR days.
Option #2 can work for testing (I say we do add it) but not useful for building releases with binary models.
Option #3 is the best because it can be called from build scripts. Add a new option to the pioneer executable, or a new separate utility (preferred). A new utility can be tricky to add because if you want to run it on a headless build server it needs to work without creating a GL context (we'd have to add a dummy renderer + texture loading).
- binary models load faster
- it's possible to create a lighter version of Pioneer without Assimp (let's say Android port)
- it's possible to add more preprocessing options to the "slow" loader
It's not connected to the modelviewer or game yet, I would like some opinions on workflow. First of all, a binary model (.sgm) contains the node structure, geometry, animations and material definitions. It does not contain textures, therefore a .sgm needs to be placed in the model's directory. In-game model loading would be changed to:
- look for modelname.sgm first
- if not found, look for modelname.model instead.
Ability to load .models in game should be retained for faster iteration. Binary models will never be checked into the game repository.
For creating the binary models, the options are:
1. Automated during gameplay
2. Manual per-model (dump button in modelviewer)
3. Scripted command line conversion.
Option #1 is not good, the models would need to be written under user directory instead and when you make changes to models you need to handle cache invalidation. Caused problems in the LMR days.
Option #2 can work for testing (I say we do add it) but not useful for building releases with binary models.
Option #3 is the best because it can be called from build scripts. Add a new option to the pioneer executable, or a new separate utility (preferred). A new utility can be tricky to add because if you want to run it on a headless build server it needs to work without creating a GL context (we'd have to add a dummy renderer + texture loading).