-
Notifications
You must be signed in to change notification settings - Fork 257
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 extension KHR_animation_pointer #596
Implement extension KHR_animation_pointer #596
Conversation
commit 78c674f Author: Mike Nisbet <[email protected]> Date: Thu Apr 13 23:31:59 2023 +0100 Enumerate lookups behind a check commit 1a78ee4 Author: Mike Nisbet <[email protected]> Date: Thu Apr 13 19:31:15 2023 +0100 Pointer utility class commit 07c8da2 Author: Mike Nisbet <[email protected]> Date: Thu Apr 13 12:11:24 2023 +0100 KHR_animation_pointer materials commit 05d4fd4ce661dff670de209b7f8fe00e6d03369d Author: Mike Nisbet <[email protected]> Date: Thu Apr 13 12:09:56 2023 +0100 More refactoring, materials 'complete' per spec commit a22bb9aa572a025d2f237b38fcb00884548ae4f7 Author: Mike Nisbet <[email protected]> Date: Thu Apr 13 11:15:20 2023 +0100 remaining supported material values in example, but many dupes still missing commit 585aa46 Author: Mike Nisbet <[email protected]> Date: Thu Apr 13 10:14:08 2023 +0100 refactor to make more generic commit 8391db8 Author: Mike Nisbet <[email protected]> Date: Wed Apr 12 18:01:31 2023 +0100 Tidy up, roughness commit 585f322 Author: Mike Nisbet <[email protected]> Date: Wed Apr 12 17:14:59 2023 +0100 formatting tidy up commit 4469656 Author: Mike Nisbet <[email protected]> Date: Wed Apr 12 17:11:24 2023 +0100 Cache material lookups commit 7ec045d Author: Mike Nisbet <[email protected]> Date: Wed Apr 12 16:17:25 2023 +0100 Texture Offset, Scale commit 07c6e53 Author: Mike Nisbet <[email protected]> Date: Thu Apr 6 12:04:50 2023 +0100 tidy up commit aaa1329 Author: Mike Nisbet <[email protected]> Date: Thu Apr 6 11:47:02 2023 +0100 Generic lookup commit ac6a9de Author: Mike Nisbet <[email protected]> Date: Wed Apr 5 15:33:24 2023 +0100 Hardcoded color animation commit b288278 Author: Mike Nisbet <[email protected]> Date: Fri Mar 31 15:38:15 2023 +0100 Read pointer path
I noticed this is implementing material animations as MaterialPropertyBlock animation, which apply to the whole Renderer.
where the nodelist is every node which uses that material, such as:
The consequence of this implementation choice is any glTF document which uses multiple primitives on a single mesh node will cause all materials on that primitive to be animated, which is not correct. For example, imagine a stoplight as a mesh with 4 primitives/materials: the base chassis of the stoplight, the green bulb, yellow bulb and red bulb. A hypothetical animation document may animate red emission to 0 and animate green emission to vec4(0,1,0,1) to simulate a slight changing to green. In the Unity implementation, this will animate all baseColor on the mesh node to the same color, which will even include the base material defining the stoplight chassis itself. As for implementing this properly, there are a few possibilities, but none will be easy, and some may have runtime performance implications.
Some questions I have with
|
Hey @lyuma, thanks for the review! On materials, I was aware of the multiple material targeting problems that might arise (great example by the way), however I think glTFast is already assigning one gameobject/renderer per primitive right now for separate reasons? @atteneder feel free to correct me here! On camera animations:
|
@atteneder : any plan on merging this PR ? We will be interested. (there seems to be a renewed activity on the PR for the extension from the interactivity group, I'm hoping the extension get merged/ratified at some point in the near future) |
|
@ptc-rgrasset I'm most definitely interested in this work! I just haven't had the time to go into review, sorry about that. @mikeskydev Yes, the CLA assistant is legit. Thanks to all who signed already ❤️ |
Replaced by Unity-Technologies#7 in the Unity fork, and updated to v6. (Is this the right move?) |
@mikeskydev great move! :) |
Implements KHR_animation_pointer, Closes #592.
2023-04-20_16-39-04.mp4
Main pointers:
Camera animations have been implemented with a helper GameObject due to the required recalculations needed from the raw animation values.
Extensions
If preferred I can break out extension animations into their own PRs for greater focus. For example,
KHR_texture_transform
necessitates moving some code from material initialisation in C#, to the shaders. I have done this for the shadergraph shaders, but not the built in one. To save changing all shadergraphs, I packed the previous vec2rotation
property with both the new scalarrotation
and the boolflipY
that's required for KTX textures.This PR is sponsored by Envoke.