Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to make ozz-skin-sapp.cc example generic, fails to load more complex .ozz animations #144

Open
medvednikov opened this issue Jun 8, 2024 · 3 comments

Comments

@medvednikov
Copy link
Contributor

Trying to make the amazing ozz-skin-sapp.cc example load any .ozz file.
Testing it with ozz-animation/build/samples/skinning/sample_skinning (.ozz files and my ozz-skin-sapp.cc are attached).

ozz-animation/build/samples/skinning/media/skeleton.ozz
ozz-animation/build/samples/skinning/media/animation.ozz
ozz-animation/build/samples/skinning/media/mesh.ozz

First of all, it prints

Unsupported Animation version 7.

So maybe the ozz-animation dependency needs to be updated?

I increased MAX_JOINTS to the upper limit, and the IO buffers:

// IO buffers (we know the max file sizes upfront)
static uint8_t skel_io_buffer[32 * 10240];
static uint8_t anim_io_buffer[96 * 10240];
static uint8_t mesh_io_buffer[3 * 10240 * 10240];

I got assert failures:

603         // assume one mesh and one submesh
604         printf("meshes size=%d, parts.size=%d\n", meshes.size(), meshes[0].parts.size());
605         //assert((meshes.size() == 1) && (meshes[0].parts.size() == 1));
...
614         std::cout<< "num_vertices = " << num_vertices  << " x3 = " << num_vertices * 3 << "; x4 = " << num_vertices * 4 << std::endl;
615         std::cout<< "normals.size = " << meshes[0].parts[0].normals.size()  << std::endl;
616         assert(meshes[0].parts[0].normals.size() == (num_vertices * 3));
617         std::cout<< "joint_indices.size = " << meshes[0].parts[0].joint_indices.size()  << std::endl;
618         //assert(meshes[0].parts[0].joint_indices.size() == (num_vertices * 4));
619         std::cout<< "joint_weights.size = " << meshes[0].parts[0].joint_weights.size()  << std::endl;
620         //assert(meshes[0].parts[0].joint_weights.size() == (num_vertices * 3));
meshes size=10, parts.size=4
num_vertices = 3228; x3 = 9684; x4 = 12912
normals.size = 9684
joint_indices.size = 3228
joint_weights.size = 0

Was the example built just for this demo, or should it be possible to make it handle any .ozz animation?

Thanks

ozz-skin-sapp.zip

@floooh
Copy link
Owner

floooh commented Jun 9, 2024

The example has a lot of hardwired assumptions (like a very low max number of joints in the skeleton). Just increasing the IO buffer size definitely won't be enough. It's probably better to start with one of the official ozz-animation samples and port them back to sokol.

@medvednikov
Copy link
Contributor Author

I did increase the MAX_JOINTS const.

It's unfortunate that it's hardwired. I'm not skilled enough in 3D dev to make it generic, and the ozz-animation renderer is ~5k lines of OpenGL.

@medvednikov
Copy link
Contributor Author

Not entire 5k needs to be translated. As I understand, only DrawSkinnedMesh(), LoadSkeleton(), and LoadAnimation().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants