Giter VIP home page Giter VIP logo

Comments (7)

RemusMar avatar RemusMar commented on June 2, 2024 1

If you want to control the ShaderMaterial uniforms via a specific animation, all you need is a simple function based on animation.time and clip.duration.
Example: https://necromanthus.com/Test/html5/Lara_shader_controlled.html
In this case:

		function animate() {
			uniforms1.time.value = 5 * mixer1.clipAction( clip1 ).time / clip1.duration;

In you case it will be something like
uniforms.res.value = 0.1 - 0.05 * mixer.clipAction( clip ).time / clip.duration;
That's all and nothing more.

from three.js.

Mugen87 avatar Mugen87 commented on June 2, 2024 1

If you think a PR for #25028 would be approved, we can close this as duplicate and I'll throw some effort to that battle.

A solution for #25028 would be welcome. We need it anyway if we want to support the glTF extension with core features.

from three.js.

Bug-Reaper avatar Bug-Reaper commented on June 2, 2024

Dug into parseTrackName, bind, and findNode which is where most of the things break magic happens.

I think it's possible, may try to draft something when I get a chance.

from three.js.

Mugen87 avatar Mugen87 commented on June 2, 2024

I believe this issue is a duplicate of #25028. It is also related to KHR_animation_pointer, see #24108.

from three.js.

RemusMar avatar RemusMar commented on June 2, 2024

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

Did you try this approach?
https://necromanthus.com/Test/html5/Lara_shader.html

		let uniforms1 = {
			time: { type: "f", value: 1.0 },
			resolution: { type: "v2", value: new THREE.Vector2() }
		};
// ...
		function animate() {
			let delta = clock.getDelta();
			uniforms1.time.value += delta * 5;

from three.js.

Bug-Reaper avatar Bug-Reaper commented on June 2, 2024

Thanks Mugen!

I believe this issue is a duplicate of #25028. It is also related to KHR_animation_pointer, see #24108.

Yea #25028 would address this. Looking at the code I had lost some of my ambition for fixing every nested property case since it seems easier to address just the case of uniforms.name.value as a one off. That said I think addressing this as a one-off pushes the can further down the road and could possibly impede future refactors similar to #24108.

If you think a PR for #25028 would be approved, we can close this as duplicate and I'll throw some effort to that battle.

from three.js.

Bug-Reaper avatar Bug-Reaper commented on June 2, 2024

If you want to control the ShaderMaterial uniforms via a specific animation, all you need is a simple function based on animation.time and clip.duration. Example: https://necromanthus.com/Test/html5/Lara_shader_controlled.html In this case:

		function animate() {
			uniforms1.time.value = 5 * mixer1.clipAction( clip1 ).time / clip1.duration;

In you case it will be something like uniforms.res.value = 0.1 - 0.05 * mixer.clipAction( clip ).time / clip.duration; That's all and nothing more.

Thanks so much @RemusMar that's a really cool approach. Honestly it'd be easiest for me to just use TWEEN and call it a day (more flexibility to cycle through non-linear arbitrary values).

from three.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.