1
$\begingroup$

How can I have a part of an object be an emission shader and then have the emission move up the object ans start at the bottom again?

So for instance: I have a cylinder that has a normal principled shader and a ring that is an emission shader. I then want to have that emission part move up and down the cylinder. So that the glowing part moves up and down the cylinder. Or have it start at the bottom, move up and start at the bottom again. I am assuming I could just make a separate object with an emission shader that moves up and down the cylinder. But I would love to learn how to do it in 1 shader. If possible at all.

$\endgroup$
3
$\begingroup$

Try something like this. All I did was separate the Z value of the object's vector, and run it through a Wave texture (scaled really small so it's a single band), and then control it's size even further with a ColorRamp, and it's position with a Mapping Node.

To change the position of the ring (in realtime), I used a Value Node with the value set to #frame (just type it in the box) - this makes the value change with the frame number when you animate. To control the up/down motion of the ring, I used a Math Node set to sine, as it will return a value that cycles between -1 and 1 as the input (frame number) increases. I connected this to the location input of the mapping node (which only affects the Z axis, due to the separation of axes beforehand).

The other math nodes that are there are to slow down the speed of the up down motion (Divide), and to change it's up and down range (Multiply) - you may need to adjust these values based on your preference and/or the size of your object.

Lastly I used this "moving ring" as a mask between my normal material and an Emission Shader:

EmissionRing

$\endgroup$
4
  • $\begingroup$ Ow wow! I am not going to pretend I fully understand what's going on here. But you got it working and it's giving me a lot of new stuff to learn! Thanks a bunch man! To add to that. You have it moving up and down right now. But i reckon there's no such thing as a sawtooth wave in Blender right? $\endgroup$ – MarcusMcBride Feb 2 at 18:06
  • $\begingroup$ The #frame doesn't seem to work for me. It moves when adjust the number manually, but the numbers don't change when using #frame. Any idea why that is? Or what I am missing? $\endgroup$ – MarcusMcBride Feb 2 at 20:30
  • $\begingroup$ Are you "playing" the scene (with whatever button you chose to play - I use spacebar)? $\endgroup$ – Christopher Bennett Feb 2 at 20:34
  • $\begingroup$ Yes I was! But the issue was that I literally typed #frame instead of frame. Also might be nice to know: arctangent instead of sine gives a 'one way lighting'. Thanks again man $\endgroup$ – MarcusMcBride Feb 2 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.