crispr_boi Posted March 23, 2022 Share Posted March 23, 2022 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 Quote Link to comment Share on other sites More sharing options...
crispr_boi Posted April 1, 2022 Author Share Posted April 1, 2022 @konstantin magnus do you maybe have an idea Konstantin? Quote Link to comment Share on other sites More sharing options...
Alain2131 Posted April 2, 2022 Share Posted April 2, 2022 (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. 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 April 2, 2022 by Alain2131 2 1 Quote Link to comment Share on other sites More sharing options...
crispr_boi Posted April 3, 2022 Author Share Posted April 3, 2022 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. 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 1 Quote Link to comment Share on other sites More sharing options...
crispr_boi Posted April 3, 2022 Author Share Posted April 3, 2022 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. Quote Link to comment Share on other sites More sharing options...
crispr_boi Posted April 3, 2022 Author Share Posted April 3, 2022 I also turned up the amplitude of the popwind in theRBDbulletsolver, to make the pieces travel a larger distance. 1 Quote Link to comment Share on other sites More sharing options...
Alain2131 Posted April 3, 2022 Share Posted April 3, 2022 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. I'm glad this is working out for you though ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.