Skip to content

Implement KHR_node_visibility in the GLTF module #93722

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Jun 28, 2024

Implements KHR_node_visibility KhronosGroup/glTF#2410 in Godot, which allows glTF nodes to be marked as not visible. Both import and export are supported.

Details: The glTF visibility system works the same as Godot's visibility system, only affecting visuals, which makes this really easy to implement. Since this extension was extremely simple, I decided to just implement it in GLTFDocument rather than writing a GLTFDocumentExtension class for it. I also made it a required extension on export, to ensure that user assets are always rendered correctly (EDIT: Required by default, but users can customize this on export). However most scenes don't contain invisible objects, so this won't impact most scenes.

Test file: cube_visibility_example.zip

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this proposal at the gltf meeting so I agree with it. Did not test yet.

@fire
Copy link
Member

fire commented Jun 28, 2024

We had a lengthy discussion of the support of the visibility extension if we make it required.

Required extension for something cosmetic is a bad idea IMHO

Required extensions will make godot look bad and create a support headache

@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from b8c324c to 37f1c31 Compare June 28, 2024 23:14
@aaronfranke
Copy link
Member Author

Updated the PR to make this configurable on export:

Screenshot 2024-06-28 at 4 14 08 PM Screenshot 2024-06-28 at 4 15 35 PM

@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from 37f1c31 to f5914c3 Compare June 29, 2024 15:42
@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from f5914c3 to 4daccf4 Compare August 4, 2024 05:41
@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from 4daccf4 to aab1a20 Compare August 21, 2024 04:36
@akien-mga akien-mga changed the title Implement KHR_node_visibility in the GLTF module Implement KHR_node_visibility in the GLTF module Aug 21, 2024
@akien-mga
Copy link
Member

Shouldn't we wait for Khronos to approve the draft proposal before merging its implementation? If they reject it, but we merge it, we'd be stuck maintaining a non-standard extension.

@aaronfranke
Copy link
Member Author

@akien-mga Indeed, we can wait for approval. I doubt this will change but I cannot absolutely guarantee that.

@fire
Copy link
Member

fire commented Aug 26, 2024

We discussed on Thursday that the moment Khronos ratifies the extension we are clear to merge.

@aaronfranke
Copy link
Member Author

aaronfranke commented Sep 28, 2024

Marking as draft to prevent accidental merging before ratification. However, the code is complete and ready for review (well, it has already been reviewed, but more review is welcome too).

@aaronfranke aaronfranke marked this pull request as draft September 28, 2024 11:51
@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from 2549d1a to 754fb24 Compare October 30, 2024 07:42
@yankscally
Copy link

Honestly, it is only a single bool, its not that deep. and, it has a lot of value to godot when blender and godot share this eye icon in the same panel. I think it's worth supporting and then hotfixing later if Khronos happen to change their mind.

@aaronfranke
Copy link
Member Author

KHR_node_visibility support has been added to the BabylonJS game engine: BabylonJS/Babylon.js#15754

@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from d4c1816 to 7c9901f Compare December 16, 2024 01:56
@aaronfranke aaronfranke modified the milestones: 4.4, 4.x Feb 13, 2025
@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from 7c9901f to 266c520 Compare March 8, 2025 10:59
@fire
Copy link
Member

fire commented Mar 8, 2025

My thinking at this time is we should add this to 4.5 and if KHR_mode_visibility is not released we ship it in Godot Engine 4.5.

Any arguments?

@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from 266c520 to 5b244f2 Compare March 9, 2025 08:21
@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from 5b244f2 to 373103c Compare March 29, 2025 11:17
@lyuma
Copy link
Contributor

lyuma commented Apr 13, 2025

I think the fact that BabylonJS added visibility should be a good argument that Godot could add it as well. Is there a reason to wait for ratification?

@aaronfranke
Copy link
Member Author

@lyuma I would be happy to go through with this. Can you give it a review/approval?

@aaronfranke aaronfranke force-pushed the gltf-khr-node-visibility branch from 373103c to 8459f4c Compare April 13, 2025 20:49
@aaronfranke aaronfranke marked this pull request as ready for review April 13, 2025 21:16
@aaronfranke aaronfranke requested a review from a team as a code owner April 13, 2025 21:16
@aaronfranke aaronfranke requested a review from lyuma April 15, 2025 17:18
Copy link
Contributor

@lyuma lyuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

If there is a place to write documentation, it might be good to document a bit more clearly what "Include & Required" means.
Perhaps instead of visibility mode, some terminology like "hidden nodes" might be easier for users to understand since the visibility mode only affects nodes which are hidden.

@fire fire moved this from Ready for review to Approved, Waiting for Production in Asset Pipeline Issue Triage Apr 24, 2025
@Repiteo Repiteo modified the milestones: 4.x, 4.5 Apr 24, 2025
@Repiteo Repiteo merged commit 500e0d5 into godotengine:master Apr 24, 2025
20 checks passed
@github-project-automation github-project-automation bot moved this from Approved, Waiting for Production to Done in Asset Pipeline Issue Triage Apr 24, 2025
@Repiteo
Copy link
Contributor

Repiteo commented Apr 24, 2025

Thanks!

@aaronfranke aaronfranke deleted the gltf-khr-node-visibility branch April 24, 2025 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

7 participants