Leaderboard
Popular Content
Showing content with the highest reputation on 03/11/2020 in all areas

Is there a way to art direct the "voronoifracturepoints"? How can I control where it places the groups of points?1 point

1 point

1 point

I sometimes have extremely slow nodes and deleting the contents of 'houdini_temp' in User/<Username>/AppData/Local/temp has always resolved it.1 point

More fun 13.lesson. projectione.h /*! \fn vector2 one_sphere(vector2 z; float r) \brief Project \f$z \in C\f$ to \f$S^1\f$. Project \f$z \in C\f$ to \f$S^1\f$ with radius \f$r\f$. \param z the direction in \f$C\f$ to project to \f$S^1\f$ \param r the radius of \f$S^1\f$ \return the point \f$z \frac{r}{\mid z \mid}\f$ */ vector2 one_sphere(vector2 z; float r) { return z / length(z) * r; } /*! \fn vector two_sphere(vector z; float r) \brief Project \f$z \in R^3\f$ to \f$S^2\f$. Project \f$z \in R^3\f$ to \f$S^2\f$ with radius \f$r\f$. \param z the direction in \f$R^3\f$ to project to \f$S^2\f$ \param r the radius of \f$S^2\f$ \return the point \f$z \frac{r}{\mid z \mid}\f$ */ vector two_sphere(vector z; float r) { return z / length(z) * r; } /*! \fn vector2 stereo2(vector c) \brief Stereographic projection from \f$S^2\f$. Stereographic projection from \f$S^2\f$ into \f$C\f$. \param c the vector in \f$S^2\f$ to project into \f$C\f$, , must not be \f$(0, 0, 1)\top\f$ \return the stereographic projection to \f$C\f$ */ vector2 stereo2(vector c) { float x = c.x; float y = c.y; float z = c.z; return set(x, y) / (1z); } /*! \fn vector stereo3(vector4 c) \brief Stereographic projection from \f$S^3\f$. Stereographic projection from \f$S^3\f$ into \f$R^3\f$. \param c the vector in \f$S^3\f$ to project into \f$R^3\f$, must not be \f$(0, 0, 0, 1)\top\f$ \return the stereographic projection to \f$R^3\f$ */ vector stereo3(vector4 c) { float x = c.x; float y = c.y; float z = c.z; float w = c.w; return set(x, y, z) / (1w); } /*! \fn vector4 stereo3_inv(vector c) \brief Inverse of the stereographic projection from \f$S^3\f$. Inverse from \f$R^3\f$ into \f$S^3\f$ of the stereographic projection. \param c the vector in \f$R^3\f$ to reproject into \f$S^3\f$. \return the projection into \f$S^3\f$ */ vector4 stereo3_inv(vector c) { float x = c.x; float y = c.y; float z = c.z; return set(2*x, 2*y, 2*z, length2(c)1) / (length2(c)+1); } vector stereo3_e4(vector4 c) { return set(c.x, c.y, c.z) / (1.c.w); } vector stereo3_e4_inv(vector c) { return set(2*c.x, 2*c.y, 2*c.z, length2(c)1) / (length2(c)+1.); } /*! \fn vector sphere_inversion(vector z; vector center; float scale) \brief Sphere inversion Perform a Möbius tranformation to project every point inside the the unit sphere in \f$R^3\f$ to outside and vice versa. \param z the original vector in \f$R^3\f$ \param center the center of the sphere \param scale the radius of the sphere \return the inverted vector */ vector sphere_inversion(vector z; vector center; float scale) { // Compute translation, then transform in the origin and retranslate vector translation = set(center.x, center.y, center.z); vector transformed = z  translation; return transformed / length2(transformed) * pow(scale, 2) + translation; } complex.h *! \fn vector2 cmul(vector2 z; vector2 w) \brief Multiply two complex numbers Multiply two arbitrary complex numbers. \param z first factor \param w second factor \return \f$z \cdot w\f$ */ vector2 cmul(vector2 z; vector2 w) { float x = z.x; float y = z.y; float u = w.u; float v = w.v; float real = x*u  y*v; float imaginary = x*v + y*u; return set(real, imaginary); } /*! \fn vector2 cdiv(vector2 w; vector2 z) \brief Divide one complex number by another complex number Divide one arbitrary complex number by another nonzero complex number. \param w divident \param z divison \return \f$\frac{w}{z}\f$ */ vector2 cdiv(vector2 w; vector2 z) { float x = z.x; float y = z.y; float u = w.u; float v = w.v; float divisor = pow(x, 2) + pow(y, 2); float real = (u*x + v*y) / divisor; float imaginary = (v*x  u*y) / divisor; return set(real, imaginary); } /*! \fn vector2 cpow(vector2 z; int n) \brief Compute the \f$n\f$th power of a complex number Compute the \f$n\f$th power of a complex number, for \f$n \in N\f$. \param z the complex number \param n the exponent \return \f$z^n\f$ */ vector2 cpow(vector2 z; int n) { float x = z.x; float y = z.y; float r = length(z); float phi = atan2(y, x); return pow(r, n) * set(cos(n*phi), sin(n*phi)); } /*! \fn float real(vector2 z) \brief Give the real part of a complex number Give the real part of a complex number represented by the first component of a two element vector. \param z the complex number \return the real part \f$a\f$ of \f$z = a + ib\f$ */ float real(vector2 z) { return z.x; } /*! \fn float img(vector2 z) \brief Give the imaginary part of a complex number Give the imaginary part of a complex number represented by the second component of a two element vector. \param z the complex number \return the imaginary part \f$b\f$ of \f$z = a + ib\f$ */ float img(vector2 z) { return z.y; } /*! \fn vector2 e_to_the_is(float s) \brief Give a point on the onesphere. Give a point on the onesphere parameterized by \f$s\f$ in the parametric form. \param s the real parameter \return the point \f$(\cos s, \sin s) \subset C\f$ */ vector2 e_to_the_is(float s) { return set(cos(s), sin(s)); } vector4 f; p@f; float n = chi("n"); float k = chi("k"); int j = @ptnum; float cosine = cos(($PI*j) / (2.*n)); float sine = sin(($PI*j) / (2.*n)); vector2 cosine_exp = cosine * e_to_the_is($PI  $PI/(k+1)); vector2 exp_neg = e_to_the_is( $PI/4); vector2 exp_pos = e_to_the_is($PI/4); vector2 sine_exp_neg = sine * exp_neg; vector2 sine_exp_pos = sine * exp_pos; float j_mod_4n = j % (4*n); if( j_mod_4n < n ) { f.x = cosine; f.y = 0; f.z = real(sine_exp_neg); f.w = img(sine_exp_neg); } else { if( j_mod_4n < 2 * n ) { f.x = real(cosine_exp); f.y = img(cosine_exp); f.z = real(sine_exp_neg); f.w = img(sine_exp_neg); } else { if( j_mod_4n < 3 * n ) { f.x = real(cosine_exp); f.y = img(cosine_exp); f.z = real(sine_exp_pos); f.w = img(sine_exp_pos); } else { if( j_mod_4n < 4 * n ) { f.x = real(cosine); f.y = 0; f.z = real(sine_exp_pos); f.w = img(sine_exp_pos); } else { f.x = cosine; f.y = 0; f.z = real(sine_exp_pos); f.w = img(sine_exp_pos); } } } } p@f = f;1 point

1 point

1 point

sticking behavior is supported in new POPs, you just need to provide pospath, posprim, posuv and stuck attributes which is quite straightforward using scatter and attribcreate ts_pop_stick_release.hip1 point

Methods to Stir Up the Leading Velocity Pressure Front We need to disturb that leading velocity pressure front to start the swirls and eddies prior to the fireball. That and have a noisy interesting emitter. Interesting Emitters and Environments I don't think that a perfect sphere exploding in to a perfect vacuum with no wind or other disturbance exists, except in software. Some things to try are to pump in some wind like swirls in to the container to add some large forces to shape the sim later on as it rises. The source by default already has noise on it by design. This does help break down the effect but the Explosion and fireball presets have so much divergence that very quickly it turns in to a glowing smooth ball. But it doesn't hurt. It certainly does control the direction of the explosion. Directly Affecting the Pressure Front  Add Colliders with Particles One clever way is to surround the exploding object with colliders. Points set large enough to force the leading velocity field to wind through and cause the nice swirls. There are several clever ways to proceduralize this. The easiest way is with the Fluid Source SOP and manipulate the Edge Location and Out Feather Length and then scatter points in there then run the Collide With tool on the points. Using colliders to cut up the velocity over the first few frames can work quite well. This will try to kick the leading pressure velocity wave about and hopefully cause nice swirling and eddies as the explosion blows through the colliders. I've seen presentations where smoke dust walls flowing along the ground through invisible tube colliders just to encourage the swirling of the smoke. You can also advect points through the leading velocity field and use these as vorticles to swirl the velocity about. The one nice thing about using geometry to shape and control the look, as you increase the resolution of the sim, it has a tendency to keep it's look in tact, at least the bulk motion. As an aside, you could add the collision field to the resize container list (density and vel) to make sure the colliders are always there if it makes sense to do so. Colliders work well when you have vortex confinement enabled. You can use this but confinement has a tendency to shred the sim as it progresses. You can keyframe confinement and boost it over the first few frames to try and get some swirls and eddies to form. Pile On The Turbulence Another attempt to add a lot of character to that initial velocity front is to add heaping loads of turbulence to counter the effect of the disturbance field. You can add as many Gas Turbulence DOPs to the velocity shaping input of the Pyro Solver to do the job. Usually the builtin turbulence is set up to give you nice behaviour as the fireball progresses. Add another net new one and set it up to only affect the velocity for those first few frames. Manufacturing the turbulence in this case. In essence no different than using collision geometry except that it doesn't have the regulating effect that geometry has in controlling the look of the explosion, fireball or flames, or smoke. As with the shredding, turbulence has it's own visualization field so you can see where it is being applied. Again the problem is that you need a control field or the resize container will go to full size but if it works, great. Or use both colliders and turbulence pumped in for the first few frames and resize on the colliders. Up to you. But you could provide some initial geometry in /obj and resize on that object if you need to. Hope this helps...1 point

Temperature Field and Divergence Field and what to do about it Combed straight velocities lead to mushroom puffs. Large directional forces lead to combed straight velocities. The pressure wave leading the divergence field leads to combed straight velocities. So what to do? Looking at Temperature first, it is directly used with Gas Buoyancy to drive the intensity whereby the upward direction is multiplied by temperature and then added to vel. Temperature is also used to burn fuel at an ever increasing rate with higher temperatures which then ultimately affects the divergence field. Temperature is also used by some of the shaping tools to inject noise or trigger confinement within the simulation, amongst other fields. Temperature and Gas Buoyancy DOP High temperature values fed in to the Gas Buoyancy DOP will affect the velocity field quite effectively, in a singular direction no less, the buoyancy direction. This inherently leads to nicely combed velocity with higher temperature values and large amounts of buoyancy as the simulation evolves which leads to nice mushrooms leading the way. Just like in real explosions and initial bursts of hot smoke/steam. But the director always wants more "character". That's fine and manageable in most cases as the velocities aren't that large, especially in smoke simulations where the temperature is driven by the sources. In the case of explosions, the burning of fuel can create very high temperatures and cause large upward velocities. Working Temperature with Disturbance By default the Disturbance field affects temperature. It is also cited as one way to break up or diminish the mushrooms. But how and why? And does it work? Using disturbance is designed to add noise to the temperature field around the simulation. This is one way to try to kick or disturb the rising velocity field, in an indirect way though. For Pyro, temperature is used to ultimately affect vel in two ways: Buoyancy and Combustion (which inevitably drives the divergence field). What is Divergence? Well it's randomly generated noise. It's not time coherent turbulence. Yep. If you dive down in to the Gas Disturbance DOP, in to the disturb_field Gas Field VOP you will find a lowly random VOP that is fed a vector 4 (vector P and an animated offset) and generates random incoherent noise per substep. If this sounds desperate, well it kinda is. But it works very well in some cases to etch the leading edge of the velocity to cause eddies that then form ripples and swirls. Think volcano smoke. Disturbance can be applied to temperature and it will eventually have an effect, or you can have it work directly on the velocity for a brute force immediate effect to try to etch away at that leading velocity front generated by the rapidly expanding divergence field. if it is strong enough and if it is localized to just around the evolving sim so that our container doesn't resize to maximum and take too much memory and take too long to simulate, it can work very well. Perhaps this is why the shelf tools only allows for a small value relative to the velocities that are present in an explosion or fireball: it doesn't really work for these types of sims at it's defaults. We have all of the necessary tools to implement this well enough. The Gas Disturbance DOP built in to the Pyro Solver and exposed as the Disturbance parameters can do this. It has support for a control field and even a ramp with min and max threshold values to really dial this in, if you have a field to use that is... For Smoke and combustion fire type simulations (no explosions), you can gleefully use the density field as both your Threshold Field to control the cutoff threshold for the disturbance and as the field to control the amount of disturbance you want. Or use temperature as the Control Field as with rising smoke, the temperature tends to lead the density. For fast rising smoke, you can set the Control Field to temperature and then use the Control Range to say 0 and 0.1 to try to etch the velocity field prior to it being run over by the advancing wave. For Explosions, there is feint hope. Unless you envelop the entire container with shredded velocity, there is no other field at your disposal to use to control where the disturbance should be applied. Yes you can create an additional field containing an expanded divergence field to try this, but there's better ways to coax swirls in the initial part of the explosion. In the end, as with all the other shaping tools, it comes down to magnitude. If the magnitude of the previous frame's velocity is much larger than the velocity shaping amplitude, knowing that velocities are for the most part added or subtracted in most simulation engines, you aren't going to see much effect, especially after the NonDivergent step gets rid of most of this random pressure hash anyway. When you are dialling in a sim, you have to have the vel on for display and adjust the Visualization Range (working the leading red envelope) to get an idea as to where the velocity is fastest and what those values are (in Houdini units per second). If you have a velocity of 10 in the leading velocity pressure front and you set disturbance amplitude to 0.5, you know it won't have much of an effect. One thing that will have an effect is to apply Disturbance directly to vel for explosions and apply it within the divergence, burn, temperature or any other field that's playing a role in the fireball itself. But not to the surrounding area unless again you bypass the resizing of the container. Heck you don't even need to bypass the resize container DOP. If you are resizing on density and vel, the container will max out after the second or third frame anyway. And you can live with completely incoherent noise that for the most part is wiped out by the NonDivergent counter pressure field. Divergence and Burning Fuel The divergence field in explosions and fireballs is the main contributor to mushroom caps over the first second or so. It will comb the velocity vectors perfectly straight in the leading pressure wave advancing in front of the density, temperature, fuel, whatever. We know why. It's the NonDivergent step trying to remove any pressure across the timestep outside of the divergence field. It makes perfect sense then that when carefully inspecting the velocity around the leading edge of the divergence, you will find the greatest velocities. Divergence pushing outward creating a large pressure front causing the NonDivergent step to add a very large counter pressure field that gives you that front of straight combed velocity. Large amounts of burning fuel (fuel + temperature = burn, divergence (gas expansion) then uses burn and fuel to drive the expansion of the sim) leads to a strong divergence field. Gas Buoyancy affects vel very effectively and divergence allows for rapid expansion. How do the explosion and fireball shelf tools try to avoid mushrooms? Well we see that the timescale is reduced for both options in an attempt to add enough time to evolve interesting swirls in the simulation as it evolves. But for many cases doesn't give you that nice character over the first few frames of the simulation. We also see Disturbance added but at a meagre 0.75 Shredding is set to 1. Shredding is a very nice tool for adding character to fire. As it's name implies, within the threshold tolerance of the effect, the velocity field is either stretched along a gradient direction or compressed. It is the transition between the two that gives you the real nice licks of fire. Shredding defaults to 1 and it has visualization option to see where this shredding occurs and how strong it is by it's color in relation to the velocity. If you look at the shredding, by default it is being applied along the surface of the temperature field where the Threshold Width is being set. Again this won't work for the first second of the explosion. Same for Turbulence and Confinement. They too work within the fireball and not the leading edge of the explosion. so what to do?1 point

Coarse SubSteps If you have an expanding gas field front that from frame 1 to 2 or frame 2 to 3 travels one or two Houdini units and substeps are set to 1, you will get combed straight velocity vectors which means mushroom caps. No matter how much turbulence or confinement you set on your Pyro Solver DOP, there simply isn't enough time to evolve these fields and have an effect on the result. More substeps means smaller velocities to deal with between substeps making things more manageable too. In an attempt to keep substeps at 1, you can manufacture noise and pump that in to vel but in the end two things will happen: The NonDivergent step will take your noise and negate most of it, or you end up pumping in so much noise because it isn't working with smaller values you tried earlier, that it swamps the entire effect and it looks like a fractal hash and not that nice evolving fireball. Oh and if you really pump in tons of noise in to vel, it too can create many smaller velocity fronts pushing ahead and you end up with smaller mushroom caps! Doh... This is in essence what the Gas Disturbance DOP does. The Pyro Solver has a Gas Disturbance DOP in it's logic and those parameters are promoted up to the top asset interface but we're concerned about substeps right now and allowing enough time for turbulence and confinement to create the nice swirls on the leading edge of the explosion. So it's coming down to sub steps to try and allow for a lot more character around the leading pressure front for fast evolving explosion type simulations. Two ways to go about this: Brute force increase the global substeps for the entire DOP network, or use the Pyro Solver Substeps in the Advanced tab. Brute Force Global Substeps For explosions, the huge almost instantaneous velocities happen at the first 510 frames. It would be nice to keyframe animate the Sub Steps parameter, but you can't (DOPs is that way). If you set the global substeps to get enough detail in the first few frames you have to carry those substeps through the rest of the sim when things are moving a lot slower and those substeps are no longer required. Not that great. No wonder everyone tries to inject their own pumps to affect vel to avoid global substepping. Pyro Solver Substeps The Pyro Solver exposes minimum and maximum substepping logic to control when and how the Pyro Solver will substep. This sounds interesting and could be just what we need. But what is CFL Condition? No it isn't the Canadian Football League even though we know that 3 downs rule and 4 downs are for those that can't deal 3. It's named after a couple guys who in the '20's, that's 1920's, who were trying to figure out the frequency of data samples they required in order to map and predict fluid simulations and pressures/resistance to flow with fast moving collision objects (that be ships). The help note on the actual Gas SubStep DOP explains it quite well: timestep will be reduced if the velocity field will move only 1 voxel in a timestep. A CFL of 2 will allow it to move 2 voxels in a timestep. Or something like that. You can find it on wikipedia. You can set your minimum substeps to 1 and your maximum substeps to a high enough value such that if the CFL Condition is exceeded, more substeps will occur when the simulation has large velocities and less when the velocity is smaller. Hopefully this gives enough time to let the turbulence and other methods to stir up the vel field kick in. Keyframe Timescale There is a third option to controlling sub steps but that is to keyframe animate the Timescale. Yes more than valid to do this to slow down the sim at the start and then speed up when the huge velocities subside. As a matter of fact, the shelf tools set Timescale to 0.65 as an attempt to get a good looking explosion or fireball without having to resort to substeps. But this is not an automatic method. This requires intervention if you want to animate the timescale. This means you have to run the sim and evaluate. Then you keyframe the timescale and you end up with an entirely different simulation. Then you move your keys, run again. Then you increase the resolution of the simulation and everything changes again. In many ways, it's worth to at least give the min and max substeps a go and see if you can dial in the CFL Condition to get a happy balance. As you increase the resolution of the simulation, the CFL condition measured in voxels will allow substeps to run up a bit faster to the max without too much of a change in the final result.1 point

I've wanted to tackle mushroom caps in pyro sims for a while. Might as well start here... Three things that contribute greatly to the mushroom caps: coarse substeps, temperature field and divergence field. All of these together will comb your velocity field pretty much straight out and up. Turning on the velocity visualization trails will show this very clearly. If you see vel combed straight out, you are guaranteed to get mushrooms in that area. If you are visualizing the velocity, best to adjust the visualization range by going forward a couple frames and adjusting the max value until you barely see red. That's your approximate max velocity value. Off the shelf pyro explosion on a hollow fuel source sphere at frame 6 will be about 16 Houdini units per second and the max velocity coincides with the leading edge of the divergence filed (if you turn it on for display, you'll see that). So Divergence is driving the expansion, which in turn pushes the velocity field and forms a pressure front ahead of the explosion because of the Project NonDivergent step that assumes the gas is incompressible across the timestep, that is where where divergence is 0. I'm going to get the resize field thingy out of the way first as that is minor to the issue but necessary to understand. Resizing Fields Yes, if you have a huge explosion with massive velocities driven by a rapidly expanding divergence field, you could have velocities of 40 Houdini units per second or higher! Turning off the Gas Resize will force the entire container to evaluate which is slow but may be necessary in some rare cases, but I don't buy that. What you can do is, while watching your vel and divergence fields in the viewport, adjust the Padding parameter in the Bounds field high enough to keep ahead of the velocity front as that is where you hope for some nice disturbance, turbulence and confinement to stir around the leading edge of the explosion. or... Use several fields to help drive the resizing of the containers. Repeat: Use multiple fields to control the resizing of your sim containers. Yep, even though it says "Reference Field" and the docs say "Fluid field..", you can list as many fields in this parameter field that you want to help in the resizing. In case you didn't know. Diving in to the Resize Container DOP, there is a SOP Solver that contains the resizing logic that constructs a temporary field called "ResizeField", importing the fields (by expanded string name from the simulation object which is why vector fields work) with a ForEach SOP, each field in turn, then does a volume bound with the Volume Bounds SOP on all the fields together using the Field Cutoff parameter. Yes there is a bit of an overhead in evaluating these fields for resizing, but it is minor compared to having no resizing at all, at least for the first few frames where all the action and substepping needs to happen. Default is density and why not, it's good for slower moving sims. Try using density and vel: "density vel". You need both as density will ensure that the container will at least bound your sources when they are added. Then vel will very quickly take over the resizing logic as it expands far more rapidly than any other field in the sim. Then use the Field Cutoff parameter to control the extent of the container. The default here is 0.005. This works for density as this field is really a glorified mask: either 0 or 1 and not often above 1. Once you bring the velocity field in to the mix, you need to adjust the Field Cutoff. Now that you have vel defined along side density, this Field Cutoff reads as 0.005 Houdini units per second wrt the vel field. Adjust Field Cutoff to suit. Start out at 0.01 and then go up or down. Larger values give you smaller, tighter containers. Lower values give you larger padding around the action. All depends on your sim, scale and velocities present. Just beware that if you start juicing the ambient shredding velocity with no Control Field (defaults to temperature with it's own threshold parameter so leave there) to values above the Field Cutoff threshold, your container will zip to full size and if you have Max Bounds off, you will promptly fill up your memory and after a few minutes of swapping death, Houdini will run out of memory and terminate. Just one of the things to keep in mind if you use vel as a resizing field. Not that I've personally done that... The Resolution Scale is useful to save on memory for very large simulations, which means you will be adjusting this for large simulations. The Gas Resize Field DOP creates a temporary field called ResizeBounds and the resolution scale sets this containers resolution compared to the reference fields. Remember from above that this parameter is driving the Volume Bound SOP's Bounding Value. Coarser values leads to blurred edges but that is usually a good thing here. Hope that clears things up with the container resizing thing. Try other fields for sims if they make sense but remember there is an overhead to process. For Pyro explosions, density and vel work ok. For combustion sims like fire, try density and temperature where buoyancy contributes a lot to the motion.1 point