Consider multi-mesh API?
See original GitHub issueHad the chance to try this tool out today, and was quite happy with the result:
before | after |
---|---|
I’m thinking of using geo-ambient-occlusion as the starting point for a lightweight browser-based AO baking GUI, where for example a user could drag in a glTF model, bake AO, adjust settings, and export the result. To make that useful, I’d need to be able to support models containing several meshes and materials, and have each mesh occlude the others.
What do you think about adding a multi-mesh API:
const geoao = require('geo-ambient-occlusion');
const aoSampler = geoao({resolution})
.add(positions1, {transform1, cells1})
.add(positions2, {transform2, cells2})
.add(positions3, {transform3, cells3});
for (let i = 0; i < 256; i++) aoSampler.sample();
const [ao1, ao2, ao3] = aoSampler.report();
This can be accomplished without modifying the library (by packing and unpacking vertices into a single array) but I could imagine it being useful to others, and wanted to check before I implemented it in application code. If you don’t have the time to do something like this, would you be interested in a PR? Or does it seem too complex for the scope of this project?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:6 (1 by maintainers)
Top GitHub Comments
That’s correct, yes – this tool can be used with files containing multiple meshes, but each mesh’s occlusion is computed in isolation.
Thanks, great to hear you’re open to the idea! It’s likely to be at least a few weeks before I could look into this seriously. I’ll comment here before I start in case you decide to give it a shot. 😃