atteneder / glTFast

Efficient glTF 3D import / export package for Unity
Other
1.24k stars 250 forks source link

Feature request: Smoothing angle #493

Open JPhilipp opened 2 years ago

JPhilipp commented 2 years ago

I'm working a lot with low-poly models, like the massive Creative Commons licensed Google Poly archive. When using e.g. TriLib on GLTF files and disabling Import Normals, one can get a nice curved look by using the Smoothing Angle (see bottom pipe); the same is also available on some of Unity's native mesh imports. In glTFast, I can't seem to find such a feature (see top pipe). But maybe I'm looking in the wrong place -- any help much appreciated!

pipe2

The test pipe (CC-licensed by CreativeTrio): pipe.zip

Thanks!

atteneder commented 2 years ago

Hi,

I see glTFast primarily as an importer/exporter and that's where my focus will be foreseeable future.

Mesh editing operations like merging/welding verts and calculating normals best be done in a 3D authoring tool prior to exporting the final glTF. Also, doing this at runtime would slow loading down.

That being said, I don't rule out that this is desirable for design-time import and I'll leave the request open to get a feel about its demand.

Thanks

JPhilipp commented 2 years ago

I hear you, but maybe these arguments help you see the issue:

  1. Unity's native OBJ importer too allows setting Normals to Calculate and then sliding the Smoothing Angle. So it's not only useful, it also follows the Unity native expectations.
  2. The 3D author cannot possibly know during export time which style the developer using the model would prefer, as both lowpoly smoothed and lowpoly unsmoothed surfaces have their design use case. (And in fact, for Unity asset archives, the author would have relied on that setting to be togglable in Unity.) It all depends on the project style.
  3. There's already massive libraries out there (I'm using a 30.000+ models archive myself); by having glTFast support the smoothing, their usefulness just doubled.

Still hoping I don't have to go back to TriLib as I like for the library to be open source, and your iteration and support is also great!

JPhilipp commented 2 years ago

For the moment, I found this script which does a good job when added to all child meshFilters after glft.Load() success. It also throws errors on some models, but I'll see if they can be fixed.

atteneder commented 2 years ago

If anyone wants to volunteer integrating it, will accept PRs. Note: make sure you're not infringing any copyright laws.

Integration for design-time/Editor imports is the easiest. Just hook it into GltfImporter.OnImportAsset where all imported meshes are iterated.

Runtime requires meeting glTFast's performance standards (running on threads/C# Jobs without useless memory allocations), which is more sophisticated to implement.