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
Implement FB_ngon_encoding extension #622
Conversation
No, just the importer. I don't know much about the exporter side so I'm not sure how hard it would be. |
I don't think this PR needs to be blocked by export implementation, but, I do think we should sort out what's happening with the FB_ngon_encoding extension itself before merging this. @donmccurdy and I are restarting the conversation there, hopefully we can get that to converge soon. Depending how that goes, could this importer PR apply a subdivision modifier to any mesh that came in with this extension on it? |
@emackey The discussion on the FB_ngon_encoding PR seems to have faded out. No one seemed very hot on having this though :( IMO this is a really nice extension. Pretty much everyone who took a look at it said it was a really elegant solution for what it does. At least in the importer, it seems like it could co-exist perfectly fine with other extensions for encoding arbitrarily complex n-gons or subdivision data as an option for a simple and lightweight way to encode quads. If you want to do something else instead though, that's fine of course. Let me know. |
@scurest Thanks for adding export! This does look like a very nice implementation. The GitHub issue is stalled, but subdiv surfaces are still a hot topic for glTF. It may be some weeks yet before the dust settles, and it seems likely that some new extension name will be introduced before this is done. |
Per KhronosGroup/glTF#1620, the FB_ngon_encoding extension is likely complete. In its current form it will not become an official KHR_ or EXT_ extension, but we are still investigate alternatives that might — with the primary goal of supporting SubD. That being the case... do we want to merge this PR to Blender? After some discussion, I'm undecided. Pros: it's likely helpful as-is to Blender users. Cons: The FB extension may be superceded by an official extension at some point, and we'd probably want to drop support for the FB extension then. FB themselves may drop support for the extension eventually, as happened with 3D Posts. And we don't want to create a de-facto standard before we have the chance to ratify an official extension that would better support SubD. These are the risks inherent to supporting a vendor extension in widely-used tools. We could mitigate that somewhat by (1) putting this extension behind an export option, disabled by default, and/or (2) adding a warning in the tooltip and documentation that the option may be removed in the future. Because the extension allows graceful fallback when it's unsupported, the risks here seem lower than they'd be with many other vendor extensions. Or we could wait for an official version. Thoughts? |
Any more advanced extension that supersedes this extension, is likely to add additional filesize compared to this extension. For users who want just quads with no extra filesize, this extension will be quite useful. Pro: The future subdivision extension will need quad based source geometry anyway, so if there are more quad-glTFs to test, the future subdivision extension will have a better ecosystem of quad-glTFs that can easily convert to using the future official subdivision extension Supporting quads now -> quad-glTFs become more common place -> theoretical subdivision extension comes -> existing quad-glTFs can be easily upgraded to use the new subdivision extension because they have quad topology Not supporting quads now -> zero quad-glTFs in ecosystem -> theoretical subdvision extension comes -> no glTFs can be easily upgraded directly to use the new extension because there are zero quad-glTFs in the ecosystem -> theoretical extension now needs time to be integrated into applications like Blender and you would need to retopologize or re-export all existing glTF models to use quads before you can even use the new subdivision extension I highly recommend the Supporting quads now option.
|
Doesn't do n-gons for n>4.
Why was this branch closed? Is implementation of this extension still planned despite being stuck upstream? |
@JayFoxRox Unless an official extension is approved, or seems close to being approved, I don't think we are going to merge support for the extension here. Shipping half-finished extensions in Blender would create a mess that other glTF tools have to deal with. I would suggest adding feedback on the glTF repository (e.g. KhronosGroup/glTF#1687) if quad support is useful to you, and sharing what you can about your use cases. Thanks! |
Assimp already supports exporting glTF using this extension (which is fully backward compatible, so there's no risk of breaking anything): assimp/assimp#3695 |
@scurest I am having trouble updating your blender extension to the latest Blender. :( |
@fire Yeah, I know. Since this wasn't merged, I freely used the assumption that all polys are tris to optimize stuff. Are you doing the exporter or the importer? |
I got stuck on both the importer and the exporter.
|
You won't be able to do it with the extension system, it requires deep integration with the mesh code. For the exporter, I believe one poly becomes adjacent loop triangles with the same polygon_index, so you can use that to find out what are supposed to be quads. The importer will be simpler if you just rewrite all the first part of the mesh code from scratch (up to here). Skip the merge verts stuff too. You'll need to track the loop_counts, but I think you can ignore loop_starts and do them at the end with np.cumsum(loop_counts). |
@scurest I don't want to have a 6 month waiting cycle for Blender stable releases, can you devise a way to do ngons and subdiv gltf2 extensions? I'll see if I can do the importer first, since I have the castle_polly test model. |
No, not interested in working on this. |
Implements the
FB_ngon_encoding
extension in the importer.