RBD setup - Need blinking firefly material

   1087   3   2
User Avatar
Member
11 posts
Joined: June 2021
Offline
Hi! I have an RBD setup where fireflies need to follow a curve and then all fly into a jar and stay in the jar. I have solved that part, but now I need an emission material (I am using Octane) that can blink on and off in an art-directable way on a per-sphere basis. (I don't want them to blink on and off in unison. It needs to look random.)

So I have 100 spheres following a curve using a curve force in an RBD bullet solver and then they land in a collider jar and fly around. This is already set up, I just need to figure out how to use some attribute to time shift my animated emission material so each connected piece goes off and on at separate times.

I've tried using a "for each connected piece" loop and that gets me a class attribute, but I'm stuck on how to use that within the Octane shader to offset the timing of each piece.

I've attached the file here so you can see what I have so far. Any help would be appreciated!

P.S. There is another post on the Indie forum about this same thing (albeit not in an RBD setup) (https://www.sidefx.com/forum/topic/80769/), but A. I can't figure out how exactly to set up the Cd attribute noise within the Octane shader, and B. I'd really like to figure out the time-shift-per-piece issue for this and future setups.

thanks,
Dan

Attachments:
fireflies_for_SideFX.hiplc (1.9 MB)

User Avatar
Member
60 posts
Joined: Nov. 2021
Offline
i have posted a sugggestion using VEX in the other thread, i've written a bit more how to use it there so maybe you wanna take a look there as well, here's the code

i@id = @ptnum;
float seed = chf('seed');
float speed = chf('speed');
float rand = rand(@id + seed) * PI;
float randintensity = chf('randintensity');

rand = lerp(1, rand, randintensity);
rand = sin(@Time * speed + rand);
rand = fit11(rand, 0, 1);
rand = chramp('falloff', rand);

vector colorramp = chramp('colorramp', rand);

@Cd = colorramp;

make sure to put the wrangle right after the solver before the unpack and when unpacking transfer the Cd attribute. of course you could also use a float value instead of Cd if you want to feed it into the emission strength. also if you want the speed of the pulses to vary from particle to particle, you could add a rand/noise function to the speed variable
Edited by eaniix - Aug. 15, 2023 00:17:23

Attachments:
fireflies_for_SideFX1.hiplc0.hipnc (1.9 MB)

User Avatar
Member
2567 posts
Joined: June 2008
Offline
What you can do is generate a unique i@id and use that to create an attribute that blinks on and off using the sin() function. Route that attribute to you Octane emission strength on your material.
// Randomly offset the frame.
float blink_speed = 0.3;
float value = sin((@Frame+fit01(rand(i@id),1,1024))*blink_speed);

// SIN is expected to return -1 to 1.
// By fitting to only -0.5 to 0.5, we create a type of hold/clamp effect
// to emulate a blink.
f@Alpha = fit(value,-0.5,0.5,0,1);
Edited by Enivob - Aug. 14, 2023 19:54:51

Attachments:
firefly_blink.gif (399.8 KB)
ap_fireflies_for_SideFX.hiplc (1.9 MB)

Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
11 posts
Joined: June 2021
Offline
This worked, thanks so much! I tried both options and ended up using Eaniix's setup because I found it easier to art direct the fireflies using the falloff channel. But thank you both so much for taking the time to respond! I have attached a low quality render as an example of the updated setup and the updated project file.

Now I need to figure out how to make the reflections on the glass jar from the fireflies be less distracting, but keep the specular reflections from the rest of the environment on the glass material. Any ideas there?

Attachments:
fireflies_for_SideFX.hiplc (3.6 MB)
RGB source_256sample test.mp4 (12.0 MB)

  • Quick Links