Skip to content

Ability to target ShaderMaterial uniforms via animations #28333

Closed as not planned
@Bug-Reaper

Description

@Bug-Reaper

Description

Tried to target arbitrary THREE.ShaderMaterial <float> uniform value with an animation, doesn't work.

let starsTrack = new THREE.NumberKeyframeTrack(".material.uniforms.res.value", [0,1], [.1,.05]);
// Doesn't work :(

Or hacky work-around (also didn't work):

obj.value = obj.material.uniforms.res.value
let starsTrack = new THREE.NumberKeyframeTrack(".value", [0,1], [.1,.05]);
// obj.value changes but obj.material.uniforms.res.value does not change

Solution A

Upgrade THREE.PropertyBinding.parseTrackName() to support binds to material.uniforms.name.value. Can we just have a fallback that allows to target any property (no matter how deeply nested) as long as that property exists?

Solution B

Hoist a shared reference of all THREE.ShaderMaterial uniform values to the top-level of the material object. This would hoist a reference to uniform values high enough to be targeted by the current animation implementation.

Additional context

I'd imagine solution A is more desirable. Unclear to me if there's a limitation that prevents how deep the animation targeting can reach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions