KeKe 0 Posted July 4, 2004 hi, I'm having trouble of some question......the question from my course.. My task is required to be able to simulate the fire, explosion, sparkle effects by just using simply primitives, but not the particle systems that has been done in Houdini... In other words, I want to make the effect by just using expression language and primitives such as polygon or sphere to make the special effects above, but all tutorials I can find is using the particle system provided in the houdini or the iso surface which is not allowed in my assignment..... could any "expert" help me out on this?.. Great thanx! Share this post Link to post Share on other sites

old school 585 Posted July 5, 2004 You can use a point SOP and expressions to push points around. If that isn't fair then give up or kick the person that gave you the challenge in the shins. The basic idea is to start with a grid or a brickered circle then pass this through a sort SOP to randomize the points followed by a point SOP which spreads the points around and provides the dynamics then a clip SOP to cut the points off below 0 in Y then finally an Add SOP with the option "Delete Geometry But Keep The Points" on. Now you have your points moving so copy or instance whatever you want to them. The trick is in the expressions in the point SOP and the Position parameters. Utilize the following functions with some descriptions and examples: rand($PT + different_seed) Great for getting random starting positions for your points but don't put any $T or $FF inside the rand(). It will look like crap. e.g.: rand($PT + 1.01) rand($PT + 10.01) rand($PT + 100.01) The next three functions utilize spacial noise: noise(x,y,z) turb(x,y,z) sturb(x,y,z) These noise functions allow you to sample in to them given an x y z position in space. Different values for x y and z lead to different values but in a smooth continuous fashion unlike rand(). This means that if you feed in two values of x y and z that are very close in value, the difference will be very small. When dealing with spatial noise functions, you need to approach them in the following manner providing a seed "s", frequency multiplier "f", and offset "o". You animate by multiplying the offset "o" with time ($T or $FF). You then add to the function a global offset "O" to the position and that is where the rand function comes in to play. noise($TX*f + s + $T*o, $TY*f + s + $T*o, $TZ*f+s+$T*o) + O*rand($PT + s) Repeat ad nauseum in all the translate fields. Interject rand() inside the noise() for added randomness and start playing around. Provide different values for seed "s" everywhere. Play with different values of offset "o" for x y and z. noise(tx_val, ty_val, tz_val) Great for getting nice gradual smooth motion in all directions. e.g.: noise($TX*0.5+1.01+$T*0.2 + rand($PT*50.01), 1, $TZ*0.5+1.01+$T*0.2 + rand($PT*500.01)) noise($TX*2+10.01 + rand($PT*1.01), $TY*2+$T*0.5+10.01 + rand($PT*10.01), $TZ*2+1.01) + rand($PT*1000.01)*5+$T-5 noise($TX*0.5+100.01+$T*0.2 + rand($PT*700.01), 2, $TZ*0.5+100.01+$T*0.2 + rand($PT*7000.01)) Repeat for turb() and sturb(). Turbulence has a more chaotic look to it. There are nice sharp transitions that may animate better. There used to be a saying back in the PRISMS days that all one needed to complete an entire effects shot was a grid and the point SOP. Then there is VEX and VOPs. You can do everything that the point SOP did above but in VEX using VOPs. Everything still applies. VOPs are more elegant when doing more complicated point manipulations. Check out the VEX Mountain SOP as an example of VEX code. You would simply replace the point SOP with your vex SOP. The breakdown of a typical spatial noise function still applies. With the looping functions in VOPs, you could write a trivial expensive dynamic system yourself. Not for beginners. Share this post Link to post Share on other sites

KeKe 0 Posted July 5, 2004 hi, thanx old_school.... but even the ones you're talking about makes me a big headeche... ...I'm totally unfamiliar with expression language, I'm just thinking about creating a sparkle effects when a bullet hits a metal plate...but not using the particle system in the Houdini I'm thinking about using rand() to generate the number of sparkles to be initially emitted, and then write a projectile motion fucntion to control each sparkle to fall down due to gravity... what (in an easy way) would you do in this case?? my approach (although haven't figured out how) is to dynamically generate sparkles using copy on some primitives like sphere or box, and then put the projectile motion function in the translate field, once each sparkle is out of a range, the sparkle gets deleted (don't know how this would be complished)......however, I still haven't figured out how, or whether my approach would work... sorry for the confusion, I probably haven't described my question clear, I don't really need to create a particle system afterall.... Share this post Link to post Share on other sites

Mario Marengo 27 Posted July 5, 2004 Hi Keke, As far as I know, the only way to create particle dynamics is to create particle dynamics... if you know what I mean Either you use the particle system provided by Houdini, or you roll your own. The set of problems that need to be solved is the same either way. The only thing that may influence your approach is how "realistic" you want your dynamics to be, which may allow you to cut some corners; but, in general, rolling your own system (whether using expressions or VEX) is not "easy" (it's not that hard either, but it gets a little involved, mathematically speaking). You describe your imaginary solution like this: 1. "I'm thinking about using rand() to generate the number of sparkles to be initially emitted" 2. "then write a projectile motion fucntion to control each sparkle to fall down due to gravity" So; assuming you want to come up with your own solution to the above (without using Houdini's particle system), then I would describe your first task to be the following: A). Forget Houdini, forget the expression language, and forget VEX. Pretend you've never seen or heard of them in your life... no; really. B ). Assume you can easily achieve step #1 of your problem statement above. There are many ways, and all of them are simple. So just take it as given that you can have a bunch of randomly positioned prims/polys with as many attributes as you need (velocity, forces, etc.). In other words; forget about trying to solve step#1 -- this forum can likely provide you with 100 ways to do it C). Now that you have all your primitives "birthed" (in theory), go ahead and, in your own words, solve step#2. i.e: how does each particle move in time, given their initial state? Only after you've clearly stated how each particle's position is to evolve in time, can you have a hope of describing it using VEX, or MEL, or Houdini's expression language, or OpenGL, or C++, or.... you get the picture P.S: In case you decide to go googling for ideas, here are some tips: *) The "birthed particles" would be the "Initial Value" or "initial state" part of an Initial Value Problem or IVP. *) The equations that arise from systems like these, involve derivatives of some functions (in this case, the functions will likely come from F=ma), and are known as Ordinary Differential Equations, or ODE. *) Solving ODE's is usually hard/impossible to do analytically, so there are *lots* of iterative numerical methods that arrive at a solution by integrating in little steps. The simplest to understand is called the Euler Method, but it is also the least accurate.... others include: Modified Euler (aka 2nd order Runge-kutta), Midpoint, 4th order Runge-Kutta, Verlet (good for particles), etc... google away! Good luck! Share this post Link to post Share on other sites

TheDunadan 1 Posted July 5, 2004 I'm not sure what your teacher/tutor has in mind with this challange, but I assume he wants you to get an better understanding by manually recreating a particle system. After all a particle that is used for all these effects isn't anything else, but a point with a physics engine that drives the point's motion. The Point SOP allows you to manually / by expressions etc. change the point attributes, such as position, color... old school gave you quite a detailed anwser on possible expressions that could be used to drive the positions of the points and suggested pretty much what you have in mind: using a rand() functions to create the initial starting positions and possible rand values for other "helper attributes" you might want to create. For animation though (after the inital creation/positioning of the particles) you cannot use a rand() function, but beed to use more "stable" noise/turbulance functions. Noise seems random, but has a major advantage: it is continous, while a rand() function will give you a random new value each time you evaluate it --> your *manually animated point particles* would jump like mad --> looks horrbible and completly unrealistic. I assume with projectile motion function you're referring to a simpified version of the 2. newton law of motion ?! Generally, a particle dynamics engine would do pretty much the same, but use the differential equation form of newtons 2nd law, as this is more flexible. Forces can be added to each other, and by integrating * X'' = F over m * with X'' being the second deriviation of the position X (--> acceleration), F the force (gravity in your case) and m the mass, you can simulate objects that are effected by multiple forces. A particles engine would likely use a ODE-Solver here (ordinary diff equation), but since you know all your forces in advance and the function won't change you can directly integrate the function twice and you get the formula that describes the particles motion. The good thing, now you have something like "x = g/2 * t^2" and you can directly evaluate the function at a specific point in time. With $T or $FF you can access the current time/frame in houdini and using the online doc on expression in Houdini you should have little trouble to convert your formulas into expressions. If you'd want to do a somewhat more sophisticated simulation, have a look at the CHOP's. With CHOP networks you have access to integration operators and other mathematical opertions that allow you to work with the differential equation forms of these formulas. Hopefully this makes a few things a bit clearer Jens Share this post Link to post Share on other sites

KeKe 0 Posted July 5, 2004 hey, Thanx TheDunadan, your solution is exactly the way I'm searching for. Actually I've done the most part of the particle system, and just like you pointed out, I'm stuck on that rand() thing, and you said noise is continous means a big solver to me...Thanx.. and to Mario Marengo: although I don't understand your solution, I'm still much appreciated! but TheDunadan, I'm stuck on the problem that I want to "dynamically" create the sparkles initially, and then maintain those number of sparkles as they falling down....however, it seens like everytime I run the script, it gives me the same initial number, which is not what I want....all I can do now is just using the "pre-placed" sparkles and animated them...also, I can't dynamically generate them to fall down in different direction........is there a way to solve this??... Thanx.. Share this post Link to post Share on other sites

Mario Marengo 27 Posted July 6, 2004 Hi keke, and to Mario Marengo:although I don't understand your solution, I'm still much appreciated! You're welcome; but what I was trying to give you was a method, not a solution. Since this is an assignment for school, I figured *you* should be the one coming up with the actual solution, yes? Actually I've done the most part of the particle system, and just like you pointed out, I'm stuck on that rand() thing ? I'll leave that one for Jeff and Jens. Cheers! Share this post Link to post Share on other sites

TheDunadan 1 Posted July 6, 2004 I hope I didn't spoil all the fun on the assignment My intention was only to clarify a few things. On the pixar homepage http://www.pixar.com/companyinfo/research/index.html you can find a good start on particle simulations and try grabbing a copy of the "Advanced Rendermanbook" or "Texturing and Modeling: A Procedural Approach". They should clarify any questions regarding noise / rand / turbulance. If you should run into a houdini specific problem, I guess everyone will be happy to answer it, but you gotta figure out the rest yourself otherwise. // mario: in case you read this, I would be intrested if you've implemented/worked with a verlet ODE solver; I wrote not too long ago a rigid body engine and for realtime simulations higher-order runge-kutta solvers were simply too slow. I menaged to speed up the collision detection / contact forces algos quite a bit, but I ended with euler as ODE-solver for the realtime part. (Though runge-kutta or other solvers with adaptive step control gave more predictable results and the solution is far from perfect). You know roughly how fast verlet is compared to runge-kutta of 3rd order ?! Share this post Link to post Share on other sites