-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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 preliminary support for bezier patch subdivision surfaces #79738
Conversation
Are you familiar with this encoding? KhronosGroup/glTF#1620 |
I went with Ultra Engine's proposal for quads since I think there's value in having a low level GL_QUADS-like primitive. Ngons should probably be considered a (slightly) higher level feature to be implemented separately. Using meshlets for this purpose may be a promising direction. Unlike |
Formal spec https://github.com/UltraEngine/glTF/blob/main/extensions/2.0/Vendor/ULTRA_primitive_quads/README.md @aaronfranke if youre interested |
For the record I would like this, but need some review from @clayjohn and others. |
Incidentally, I initially wrote this PR against Godot core for convenience sake, and to make it easier to investigate feasibility. However, it's becoming evident that this mainly affects the importer, so it should be possible to move most of this into an official glTF-focused GDExtension and avoid impacting non-3D users of Godot, if this is desired. Tessellation shaders will still need to involve core if they're ever implemented, though. |
Assuming I'm reading this PR right, there's actually a bit of a use for bezier patches in core, hell quake 3 used them extensively. I was going to implement them myself for my own q3 style map system too. |
Let me know when this is ready for merge review. |
Hopefully this is adequate for the first pass, since it's all I can find the time for right now. Some functionality (such as bones) is still missing though, so only merge this if it's useful as-is (essentially static meshes only) and it's acceptable for the missing features to be added later. |
What do I need to get bones functionality? |
|
I haven’t had any rendering team approvals, but I can look into bones. Since theres a lack of rendering team approvals, the probability of merge is lower. |
I salvaged the branch here https://github.com/V-Sekai/godot/tree/quad-bezier-surfaces as I am still interested in this. |
GREEN: Original lowpoly quad model ||| YELLOW: Bezier patch control points after preprocessing ||| RED: Final tessellated model ||| BLUE: Catmull-Clark subdivision for comparison ||| WHITE: Quad/Bezier patch borders
Circle test. Note how bezier patch subdivision surfaces (RED) need fewer points than Catmull-Clark subdivision surfaces (BLUE) to create rounder circles.
Bevel test. Support loops work the same way for both surfaces.
Bezier patch vs Catmull-Clark pros:
Cons:
Contents of this PR:
This allows the rest of Godot's rendering system to remain blissfully quad-unaware. Note that I haven't checked thoroughly to see if quads won't be clobbered by mesh processing somewhere, but at least with the basic testing I've done so far, quads are preserved correctly from import to render.
PrimitiveMesh
es now always outputs in this format