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

Create a minimalistic 100% optimal tool example #6

Closed
gwihlidal opened this Issue Oct 19, 2018 · 8 comments

Comments

Projects
None yet
2 participants
@gwihlidal
Copy link
Owner

gwihlidal commented Oct 19, 2018

Currently, the only example is demo, which is a monolithic feature matrix of the entire API. It would be very helpful to create a minimalistic tool example that shows only shows the necessary calls to optimize a mesh for 100% GPU (and optionally, CPU packing/encoding improvements).

Likely this would be a simple docopt\clap command line tool that takes an obj/gltf2, optimizes it, and saves out the optimized version.

Bonus points would be to preserve information from the original mesh (morph targets, materials, etc.) so the output from the tool could be usable in actual game or demo pipelines, instead of only writing out vertices and indices for the result.

@gwihlidal

This comment has been minimized.

Copy link
Owner Author

gwihlidal commented Oct 19, 2018

For now, the best example in the demo is the opt_complete method - this is the recommend 100% GPU path; packing and encoding can be optionally added.

@TimvanScherpenzeel

This comment has been minimized.

Copy link

TimvanScherpenzeel commented Jan 11, 2019

Hi @gwihlidal,

I was looking through the codebase of meshoptimizer and with the latest release 0.10 it ships with a WebAssembly decoder and JavaScript mesh loader. It can load files processed by meshencoder.cpp.

Would it be an idea to replicate this meshencoder as a basic example in Rust? This way we can leverage the WebAssembly / Javascript in meshoptimizer for free and have a useful demo to ship along with this project.

Kind regards,

Tim

@gwihlidal

This comment has been minimized.

Copy link
Owner Author

gwihlidal commented Jan 12, 2019

Hi Tim,

Sure, if this is something you plan to use I can look into that. I'm preparing a new release of the crate which includes 0.10 support, so I'll check this out while I'm at it.

  • Graham
@TimvanScherpenzeel

This comment has been minimized.

Copy link

TimvanScherpenzeel commented Jan 12, 2019

That is great, thank you.

I'm planning to use it in a tool to make a custom mesh format for a WebGL engine I've been working on.
I've used Draco compression (with glTF, through Node.js) in the past but have been looking at creating some tooling in Rust for learning purposes and more control. So it would definitely be useful to me 👍

@gwihlidal

This comment has been minimized.

Copy link
Owner Author

gwihlidal commented Jan 12, 2019

Very cool! Are you looking for a direct port of meshencoder.cpp to rust (i.e. takes an obj file path, writes out a .optmesh), or are you wanting a generic library/function that takes some abstract geometry data (not tied to .obj, such as .gltf/.glb) and returns an .optmesh binary, such that you write the CLI tool that calls this functionality?

@TimvanScherpenzeel

This comment has been minimized.

Copy link

TimvanScherpenzeel commented Jan 12, 2019

I think for this crate it makes most sense to directly port meshencoder.cpp to keep it in line with the meshoptimizer package. I think the .obj -> .optmesh works fine for now as it shows the crate working the same as the main library as users can copy over the relevant parts they consider necessary.

That said, outside of this crate, I think it also makes sense to look at, like you stated above, taking in a glTF file and outputting an optimised version with the original data intact. But I can see how that might be quite complex as I don't think the gltf-rs crate currently exports as of yet and I would advise against rolling your own as glTF can get really quite complex. You would also have to be aware of keeping the glTF file spec compliant (which Draco is through a custom extension) and can therefore only really optimise in place then rather than use the custom .optmesh structure similar to how the current demo exports an .obj.

For my own project, seeing as it is specifically written for my engine anyways, I don't have to worry about spec-compliancy or the ability to transform it back to human readable text.

@gwihlidal

This comment has been minimized.

Copy link
Owner Author

gwihlidal commented Jan 13, 2019

Hi Tim,

I just released v0.1.5 of the crate which includes 0.10.0 support, and also includes a mesh encoder port to rust as an example. I think this change is sufficient to close this issue.

Thanks for the suggestion!

Cheers,
Graham

@gwihlidal gwihlidal closed this Jan 13, 2019

@TimvanScherpenzeel

This comment has been minimized.

Copy link

TimvanScherpenzeel commented Jan 14, 2019

Hi Graham,

Thank you for your work over the weekend 👍!
It will be of much use to me.

Kind regards,

Tim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment