Jump to content
crispr_boi

Help combining two setups. Time offset RBD sim along Z axis controlled by spectrum chops shape

Recommended Posts

I wanted to ask for advice on combining two setups.

One is using spectrum chop to displace the points of a line along P.y independently.

The other one is a RBD bullet sim. A POP Wind is moving the fractured pieces of a box away from their original position. Using a time shift the sim's progression can be offset along the z axis and the offset is controlled by a chramp.

Now I want the data from the the spectrum sop to instead of displace the points along P.y fit the amplitude from 0 to 1 and remap (?) it to the frame range of the pre-calculated sim, currently frame 1 to 50.

I sorted the the simulation points along the z axis and would like to use the audio spectrum to drive their time offset, instead of the P.y.

Need to figure out the maximum amplitude of the spectrum chop and fit it to the last frame of the sim?

Attached is the .hip containing both setups and an audio file (royalty free track used by the tutorial creator of: Houdini CHOP Talk 3 Audio Processing 1 - Audio Spectrum https://www.youtube.com/watch?v=J754SLvE7BQ)

The audio doesn't matter, I just wanted to provide anything.Downfall.wav

The line's points are evenly spaced, but the bullet sim points obviously aren't, so I would like that to remain unchanged..

retimed_sim_1.mp4

retime_sim_with_chops.hiplc

Downfall.wav

retimed_sim.thumb.png.f69ba800ff41cbe2958cd825ed7a66cf.png

 

Share this post


Link to post
Share on other sites
Posted (edited)

Hi Kilian,

If I understand correctly, you want to "apply" the simulation where there are peaks in the curve, correct ?

You already have a line with the correct animation applied to it. Doesn't that look like a ramp already ?..
What I would do is sample directly from the line instead of using chramp. (This code requires the "channel_audio_import" node to be the third input of your wrangle)

float end = 50.0;
float frame = (@Frame + v@P.z*10) % end ;

float pos = fit(frame , 1, end, 0.0, 1.0);
pos = chramp("AnimCurve", pos);

// These two lines are the only difference
float sample = 1 - relbbox(0, @P).z; // You can visualize this with "v@Cd = sample;". A 0 to 1 value in the relative bounding box.
pos = primuv(2, "audio", 0, set(sample, 0, 0)); // Sample the audio attribute of the line based on sample

v@P = primuv(1, "P", @ptnum, set(pos, 0, 0));
[...] // rest of the code is untouched

Now, the result might not be what you expected. This clamps when "audio" is higher than 1, so you might want to do some post-process on the audio.
line_sample_result.gif.f339b9b939ceb29be4743a1d3d67731b.gif

retime_sim_with_chops.hipnc

Hopefully that's what you want !

 

P.S. I found that reducing the amount of points in the line yields a better result, you might want to try that (50 points instead of 498).
Try it to see if you like that.

Edited by Alain2131
  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
16 hours ago, Alain2131 said:

Hi Kilian,

If I understand correctly, you want to "apply" the simulation where there are peaks in the curve, correct ?

You already have a line with the correct animation applied to it. Doesn't that look like a ramp already ?..
What I would do is sample directly from the line instead of using chramp. (This code requires the "channel_audio_import" node to be the third input of your wrangle)


float end = 50.0;
float frame = (@Frame + v@P.z*10) % end ;

float pos = fit(frame , 1, end, 0.0, 1.0);
pos = chramp("AnimCurve", pos);

// These two lines are the only difference
float sample = 1 - relbbox(0, @P).z; // You can visualize this with "v@Cd = sample;". A 0 to 1 value in the relative bounding box.
pos = primuv(2, "audio", 0, set(sample, 0, 0)); // Sample the audio attribute of the line based on sample

v@P = primuv(1, "P", @ptnum, set(pos, 0, 0));
[...] // rest of the code is untouched

Now, the result might not be what you expected. This clamps when "audio" is higher than 1, so you might want to do some post-process on the audio.
line_sample_result.gif.f339b9b939ceb29be4743a1d3d67731b.gif

retime_sim_with_chops.hipnc

Hopefully that's what you want !

 

P.S. I found that reducing the amount of points in the line yields a better result, you might want to try that (50 points instead of 498).
Try it to see if you like that.

 

Awesome! Thank you so much! This looks exactly like the what I wanted to achieve. <3

 

 

  • Like 1

Share this post


Link to post
Share on other sites

In my opinion it looks better with a lot of pieces. Something like 350 scatter points in the fracture, but no secondary fracture and especially no chipping.

I love it, thank you very much.

Share this post


Link to post
Share on other sites

I also turned up the amplitude of the popwind in theRBDbulletsolver, to make the pieces travel a larger distance.

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, crispr_boi said:

In my opinion it looks better with a lot of pieces. Something like 350 scatter points in the fracture, but no secondary fracture and especially no chipping.

I meant the points in the line, not the fracture.
line_sample_result.thumb.gif.e591bf6ec6864e743791dc55e6fd83cf.gif

I'm glad this is working out for you though !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×