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).
[model system] Binary pipeline
Re: [model system] Binary pipeline
So it will convert both the .model and say .dae files to an .sgm?
From a modelers perspective, 2. and 3. looks reasonable.
It theory there should be no difference between an .sgm and a .model-.dae model, which would warrant a visual utility to check the outcome of the conversion, right?
From a modelers perspective, 2. and 3. looks reasonable.
It theory there should be no difference between an .sgm and a .model-.dae model, which would warrant a visual utility to check the outcome of the conversion, right?
Re: [model system] Binary pipeline
Yes, then one needs to only distribute .sgm + textures at minimum.nozmajner wrote:So it will convert both the .model and say .dae files to an .sgm?
Modelviewer should have binary save/load test functions (which it had, but I didn't merge). It could save 1) directly in the model directory (requires permissions), 2) userfiles/data/models/modelname/ or 3) separate directory under userfiles, which will require a manual copying step before the model can be loaded.
Re: [model system] Binary pipeline
I just added modelviewer functionality to test the binary conversion. F6 dumps the current model into userfiles/binarymodels/modelname.sgm. You have to manually copy it to wherever the original .model resides, and then you can load the .sgm file through model file picker. The results should be identical.
It's not good workflow, because the conversion should be automated, but good enough for testing.
I didn't make the game read binary files yet.
It's not good workflow, because the conversion should be automated, but good enough for testing.
I didn't make the game read binary files yet.