Random flashing lights

Question Materials and Textures

I want to create random flashing Christmas lights but I am a newbie in shading. I already have modeled my little light bulbs in my scene. What would be the next steps?

1 love
Reply
  • Martin Bergwerf replied

    HI Marie delama ,

    There are countless ways of doing that.

    Here's an example of a simple Shader that does that (all Lights use the same Material):

    X-mas.png

    Graph Editor uses T > Linear Interpolation and SHIFT+E > Linear Extrapolation and then a Stepped Interpolation Modifier.

    I think the rest is clear, but feel free to ask if you have any questions left.

    2 loves
  • Marie Delagrave(delama) replied

    Dear Martin Bergwerf: first, thank you for your help. I hope you are a patient person, because I have many questions...!

    My project is an animated Christmas card. I modeled my cat (who is always the theme of my annual card ☺️), put a fir texture on it and I want to «wrap» him with little flashing white lights, like if he was the Christmas tree. 

    I followed your «recipe» of nodes (you can see that it is in French; it wasn't easy for me to translate...) and for the color, I chose white, but I am not sure if it's ok.

    I have a problem with the Graph Editor: I don't see my bulb (which is selected) in the left box. By the way: I notice that some bulbs are grey and some are black: what does that mean? They are supposed to be similar. 🤔

    Maybe I don't see my bulb in the Graph Editor because there is a filter, but I'm not at ease with that. Here are some captures.

    my project.png

    bulb selected.png

    graph editor.png

    ph editor filter.png

    1 love
  • Martin Bergwerf replied

    "[...] I don't see my bulb (which is selected) in the left box [...]"

    You might need to Select the Node, that has the animated Value (in my case the White Noise Texture) in the Shader Editor. Alternatively, you can disable the little arrow icon:

    Lights_01.png

    A white color for the Lights is fine. When some lights are grey, that could be the intensity of the Lights (Strength in the Emission Shader, or the Value in the Multiply Node). I also changed the View Transform in the Color Management to  Khronos, but that is optional.

    And I Added a glow in the Compositor, as you can see , but that is also optional, of course.


    1 love
  • Martin Bergwerf replied

    And you can also give the non-lit bulbs another material, for instance a Glass BSDF like so:

    Lights_02.png

    ...or a Transparent BSDF, so you would only see the lights, when they are lit.

    1 love
  • Marie Delagrave(delama) replied

    I deselected the arrow. I select the bulb in the 3D Viewer and the node White Noise Texture (even if it doesn't look «selected»)  but I still don't see the bulb in the Graph Editor... 😕

    1 love
  • Marie Delagrave(delama) replied

    I switched to the timeline and it looks like this: 

    2-18 à 12.45.34.png

    Why are there these yellow marks at that image???

    1 love
  • Martin Bergwerf replied

    The yellow marks are the Keyframes (clés).

    But you can't change the Interpolation and extrapolation there, nor can you add any Modifiers there (like the Stepped Interpolation).

    I wonder why the White Noise Node doesn't look Selected...that might have something to do with why you can't see anything in the Graph Editor...

    Also, make sure all your bulbs have the same Material.

    1 love
  • Marie Delagrave(delama) replied

    I know the yellow marks are keyframes. But why are they there?

    I checked: all my bulbs have the same Material.

    1 love
  • Martin Bergwerf replied

    And double check the Filter, this is what it should look like:

    Lights_03.png

    1 love
  • Marie Delagrave(delama) replied

    You put it in French: so kind! I have three more items than you: is a problem?2-18 à 13.29.20.png

  • Martin Bergwerf replied

    Oh, did you maybe 'forget' to insert Keyframes in the W of the White Noise Texture Node?


    1 love
  • Martin Bergwerf replied

    Those extra fields in the Filter are no problem.

    1 love
  • Marie Delagrave(delama) replied

    Hum... How do I do that? When I touch the W and type I, it writes I in the value!

    Oh oh oh! I just hover (?) the W and... tadam!!! 

    2-18 à 13.36.41.png

    What do I have to do next???


    1 love
  • Martin Bergwerf replied

    You'll need two Keyframes at least (the Values don't matter, as long as they are not the same):

    Lights_04.png

  • Martin Bergwerf replied

    And then follow this:

    Lights_05.png

    1 love
  • Martin Bergwerf replied

    You can change the speed of the blinking here:

    Lights°à-.png

    1 love
  • Marie Delagrave(delama) replied

    It works!!! But it's very frenetic. (But you've already answered to that.) Also, there is at least one or two bulbs which don't work even if they have the same material.

    And if you're not tired of me (!), I would like more subtility. I think you explained before.

    1 love
  • Martin Bergwerf replied

    If some bulbs don't work, that might be, that they coincidentally get a 0 all the time, that should change if you let the blinking run longer.

    Also, maybe your computer can't render the changes fast enough (try looking at them frame by frame, see if the light up then).

    I you need it more subtle (if I understand that correctly), apart from changing the speed, you could also try another 4D Texture and play with the Settings (specifically the "échelle"):

    Lights_06.png

    1 love
  • Marie Delagrave(delama) replied

    When you say « that should change if you let the blinking run longer», do you mean that I should maybe make it run for, let's say, 300 images?

    I checked each image and that bulb (which is the last, number 23) doesn't light. Maybe if I create another one and change it (like if it was «toasted»)???

    I will try another 4D Texture. But the Glow you showed earlier is interesting: to which node do I have to connect that?

    1 love
  • Martin Bergwerf replied

    Yes, that's what I meant, let it run longer (maybe even 500 Frames).

    You could definitely try creating a new one, that often fixes things that are misbehaving.

    The Glow is 1 Node in the Compositor. If you want to see it in the 3d View as well, you'll have to enable the Compositor there as well, like this:

    Lights_07.png

    1 love