Skip to content

Implement KHR_animation_pointer in GLTF for animating custom properties #10164

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

Closed
aaronfranke opened this issue Jul 10, 2024 · 7 comments
Closed

Comments

@aaronfranke
Copy link
Member

Describe the project you are working on

I am working on making Godot suitable for games with real-time dynamically-loaded user-generated 3D content. For safety reasons, this means glTF files, since it's more sanitized to accept these than to accept arbitrary Godot scenes. Plus, the goal is to allow content to be engine-agnostic, not locking creators of this content into just using Godot, and to make it easy to create content in any non-Godot app, including Blender.

Describe the problem or limitation you are having in your project

Godot currently only supports the vanilla glTF animation system, which allows for animating position, rotation, scale, and blend shape weights. For other properties, such as the color of a light, the FOV of a camera, the albedo color of a material, the UV offset of a material, and more, you can't do it. However, there is a glTF extension that allows for animating many more properties: KHR_animation_pointer.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add support for importing and exporting glTF files with more advanced animations by implementing KHR_animation_pointer in Godot's GLTF module, allowing users to animate many more properties.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I've already done so here: godotengine/godot#94165

khr_anim_ptr.mp4

Test project: gltf_khr_animation_pointer.zip

These test files were created by the Khronos group, not me. The source is here: KhronosGroup/glTF-Sample-Assets#106

If this enhancement will not be used often, can it be worked around with a few lines of script?

For the general case, no. It would take many thousands of lines of script. For a more narrow case, it could be done with less, but the goal here is to implement a system that is extendable and allows animating many properties.

Is there a reason why this should be core and not an add-on in the asset library?

This must be core to Godot Engine because it requires a lot of low-level hooks to do it right, and other extensions need to be able to build on these features.

@aaronfranke
Copy link
Member Author

Implemented and merged here: godotengine/godot#94165

@aaronfranke aaronfranke added this to the 4.4 milestone Nov 19, 2024
@coderofsalvation
Copy link

coderofsalvation commented May 23, 2025

wow ❤️
stupid question: are these animations also preserved when exporting to glb?

did you have any luck animating alpha for transparent textures?

@aaronfranke
Copy link
Member Author

aaronfranke commented May 24, 2025

@coderofsalvation Yes, .glb is also GLTF, but just .glb instead of .gltf file extension and binary instead of text.

What do you mean by "animating alpha"? You can animate the alphaCutoff/alpha_scissor_threshold of a material.

@coderofsalvation
Copy link

coderofsalvation commented May 24, 2025

awesome, yes i meant both gltf/glb.

with alpha I meant opacity.

btw. do you have these test gltf's downloadable somewhere?
Would be great to try them out in Godot as blender does not have support for it yet.

update: I just noticed the links nvm!

@aaronfranke
Copy link
Member Author

@coderofsalvation Which glTF property corresponds to that?

@coderofsalvation
Copy link

coderofsalvation commented May 24, 2025

I'm afraid I don't know :/
Apologies, I'm reasoning mostly from a Blender perspective, where the Principled BSDF has a alpha (opacity)-slider.
I can automate that in blender in the animation-timeline, to fade in/out an object.
I guess I was hoping that KHR_animation_pointer would allow something similar..maybe there's another parameter which can achieve similar effect? (emission e.g.?)

UPDATE: found it

Image

Btw. I'm trying the examples in Godot 4.4 but (due to my newbie Godot skills) I can't modify the animations:

Image

Nevertheless, I think it's great to see Godot supporting gltf extensions, as it allows me to create nocode assets.
I really love the idea if bringing gltf-scenes to life, by introducing texture-scrolling without coding, something interoperable like this is really amazing.
Blender seems to a bit slower regarding gltf extension-adoption compared to Godot these days, so I was wondering if I could use Godot for enriching gltf models with extension-driven features.

@aaronfranke
Copy link
Member Author

aaronfranke commented May 24, 2025

@coderofsalvation Yes, you can use Godot as a "game asset SDK", in fact it would be great for that. Godot already includes built-in support for animation pointer, lights, texture transform, KTX & WebP textures, single root files (trying to get this in Three.js and UnityGLTF as well), and with an unmerged PR as you've seen, audio emitters.

Additionally, you can greatly expand Godot's glTF extension support by grabbing the omi-godot repository and adding the addon it to your project. This adds a bunch of things including environment/skyboxes, joints, spawn points, seats, and most fun of all, vehicles. There's also an unmerged PR for gravity fields like Super Mario Galaxy, but this requires an unmerged engine PR (#82878).

Godot's editor is lightweight and beginner-friendly, so it can be great as a tool to compose final game-ready assets following open standards, enriched with glTF extension data, ready to be imported into no-code game platforms. Much nicer than, say, VRChat which requires downloading the entirety of Unity to compose a proprietary asset just for VRChat.

However, I should mention that GitHub isn't the best place to ask for help. If anyone wants to contact me directly about the glTF pipeline, feel free to message me on Discord: aaronfranke.

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

No branches or pull requests

2 participants