Jump to content

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

 

Link to comment
Share on other sites

  • 2 weeks later...

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
Link to comment
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
Link to comment
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 !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...