jnsmalm / pixi3d

The 3D renderer for PixiJS. Seamless integration with 2D applications.
https://pixi3d.org
MIT License
752 stars 43 forks source link

Add Mesh Quantization support #192

Closed nevermemo closed 9 months ago

nevermemo commented 9 months ago

This PR adds support for KHR_mesh_quantization extension. To handle geometry data, it retains normalized information for gltfAttribute and passes it to associated buffer. This does not work for animations directly so they are de-normalized after interpolations.

This PR partially addresses issue https://github.com/jnsmalm/pixi3d/issues/89

PS: I added a change in serve/src/index.js so served page can be used with PixiJS DevTools.

jnsmalm commented 9 months ago

Wow, nice! Sorry for the late response, I'm quite busy right now. I'll take a look at this soon!

jnsmalm commented 9 months ago

@nevermemo Do you have any gltf models with this feature so we can add some tests for it?

nevermemo commented 9 months ago

@jnsmalm You can use AnimatedMorphCube-meshquant.glb @goldenratio shared in the issue. Model renders fine without the changes but animation weights are normalized so cube stretches to almost infinity. For normalized primitives, I used testModelBlank.glb.zip. It is one of my experimentations using gltfpack. Vertexes render just fine but texture wrap is way off without the changes. I used Model Viewer to compare and make sure it works as intended.

jnsmalm commented 9 months ago

@nevermemo Thanks for adding this! I'll create a new release after the weekend.

nevermemo commented 9 months ago

You are welcome. I have been using pixi3d for a while but I never had gone deep into the source code before. It is such an ingenious way of integrating 3d into pixijs using already existing tools and implementing many more. I really love your work and it is a pleasure to contribute to such an open source project.