Import: import UV scrolling animations using EXT_property_animation #776
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements importing animations that scroll UVs by animating a
KHR_texture_transform/offset
property with theEXT_property_animaton
extension.UVScrollExample.zip
Only animations that ONLY target the offset property are handled; if the rotation or scale is also animated, it gets ignored. The reason is that the curves will need to be resampled at a higher rate to handle the change in UV space between glTF and Blender (for example, a constant offset and simple linear ramp for rotation in glTF would require a sinusoidal offset in Blender). Even if the more general case were implemented, it's still desirable to have a separate codepath for handling only-offset animations because you can do it without resampling.
Also UV scrolling animations are much more common than animating the scale or rotation.
Outline of the implementation
BlenderMaterialAnim.anim
for each animation in the fileEXT_property_animation
gets rearranged so we can lookup a sampler from what it targetsKHR_texture_transform
that has only its offset property animated gets processedKHR_texture_transform
object needs to be looked up because we need the constant rotation and scale values to do the glTF<->Blender UV changebaseColorTexture.mapping
) which is set in themake_texture_block
function from Import: Factor texture node creation out into its own function #696