5
$\begingroup$

I am trying to use Geo Nodes to control my animated shader on multiple objects. What I want is to use an object so that when it comes closer to objects, it starts to animate and eventually becomes completely red when it has passed by.

This is how I animated the shader, and how I want it the look when I control the distances with a proximity node.

shader animation

And this is how i built ut:

shader nodes

Next I used Geometry proximity and attribute node to put in the FAC for the Less than node,

What I have done is that I have used the Proximity node and Attribute and put in the FAC for the Less than node so when I comes closer the more the objects would become red.

This is how I built it:

geo nodes

Unfortunately, the result is like this:

Problem

Here are the blender files:

Edit:

Tried @Lutzi solution with:

Position>Separate>X with Object Info of the cube > Separate>X

printscreen nodes

Result:

animation test

Is it possible to make the shader animation linger on and at the same time move onto the next one?

@Lutz solution:

$\endgroup$
9
  • 1
    $\begingroup$ What about just testing the x-positions ? As you stated your question, it'd solve it. $\endgroup$
    – Lutzi
    Commented Jul 5 at 15:03
  • $\begingroup$ I get the same resualt when using x-position $\endgroup$
    – N03
    Commented Jul 5 at 15:04
  • 1
    $\begingroup$ I meaned without Geometry Proximity, just comparing Position>Separate>X with Object Info of the cube > Separate>X ? $\endgroup$
    – Lutzi
    Commented Jul 5 at 15:11
  • 2
    $\begingroup$ Ultimately the problem here comes down to the fact each frame in Blender is rendered separately. So at the end of the animation the logic "doesn't know" it is not the start of the animation. You can be smart about it, and instead of calculating distance, you can check the object X, and "clamp it" (if x is higher than self x, then consider it to be 0, otherwise calculate the difference), or you can use some Blender feature that holds state, the most appropriate here would be a simulation zone. $\endgroup$ Commented Jul 5 at 15:32
  • 1
    $\begingroup$ I feel like this would be far easier if you used dynamic paint and vertex colors. $\endgroup$
    – TheLabCat
    Commented Jul 5 at 16:46

2 Answers 2

4
$\begingroup$

As Lutzi said, you can use the simulation zone, so that your "old values" won't get deleted on each frame.

If you are using this node tree:

enter image description here

and this shader node tree:

enter image description here

you will get:

enter image description here

$\endgroup$
4
  • $\begingroup$ Thank you very much for your response, I truly appreciate it. I have attempted to follow your solution, but unfortunately, I am unable to get it to work. Could you please help me understand why? I've uploaded the file in the edit $\endgroup$
    – N03
    Commented Jul 9 at 9:56
  • $\begingroup$ Sorry, I forgot to mention your nick @Chris and now I cant edit the post! $\endgroup$
    – N03
    Commented Jul 9 at 14:12
  • 1
    $\begingroup$ [1]: i.sstatic.net/65mhEhtB.png -> you didn't put "dist" in the store named attribute node and you did put a value (dist) in the group output. Delete the value from the group output and enter "dist" into the store named attribute node. $\endgroup$
    – Chris
    Commented Jul 9 at 15:49
  • $\begingroup$ Thanks that worked very well! if I want the animation, like I showed in the first GIF in the thread, how do I add it? Again, many thanks! @Chris $\endgroup$
    – N03
    Commented Jul 10 at 16:34
4
$\begingroup$

Simple dynamic setup with Geometry Nodes

I'm using an empty as a controller. I didn't see why you would want to use Geometry Proximity so I took the liberty to discard your cube controller.

Here is the most simple setup I can think of :

enter image description here

The idea is to store at which frame the face has been activated. By doing that, we can measure how long since activation. Here are the steps :

  • Initialize default value for activationFrame (should be negative and far greater than the duration of lingering activation, i.e. if we want faces to stay activated 50 frame, let's use -1000 to be safe).
  • Inside the Simulation Zone, test the distance and update the activationFrame if needed.
  • At the very end, we can simply choose the condition on which a face is activated or not.

enter image description here

You could add a lot of improvements here and there, for example you could store in each face for how long it should stay activated (to do before Simulation Zone). That way, you can add randomness.

Also, concerning the materials you should follow the answer of Chris instead of mine. Having 2 materials doesn't make sense and you can't have both at the same time, so it won't be smooth.

$\endgroup$
7
  • $\begingroup$ Thanks for your response. I'm trying to get your solution to work, but I don't understand what I'm doing wrong. I've uploaded the file in the thread @Lutzi. $\endgroup$
    – N03
    Commented Jul 10 at 9:12
  • 1
    $\begingroup$ My screenshot is misleading : the last subtract node should have inputs switched, so that we get current - activationFrame. Also, I strongly recommend you to use the Spreadsheet window. $\endgroup$
    – Lutzi
    Commented Jul 10 at 10:12
  • $\begingroup$ If I understand you correctly, the Named Attribute will be in the lower socket and Scene Time in the upper socket of the Subtract node? Thank you for your response! $\endgroup$
    – N03
    Commented Jul 10 at 10:38
  • 1
    $\begingroup$ Yes, if you want to keep the Less Than node as is. $\endgroup$
    – Lutzi
    Commented Jul 10 at 10:46
  • $\begingroup$ Thanks so much for your help. I’m still having trouble getting it to work. Do you have any other tips? @Lutzi $\endgroup$
    – N03
    Commented Jul 10 at 10:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .