Some notes on using the sparse pyro solver taken while watching Steven Knippings excellent Volumes III v2.0
Source points
Popnet
Setup a particle sim that we will use as source for our smoke sim.
Point Wrangle
Lets append a point wrangle to the particles. We will use the normailzed age to drive the density of the particles. We will use a ramp parameter and use the normalized age to drive the ramp. There is a built in attribute called nage (it will not show in the attr listed on the node but it is there) which is a shortcut for using @age/@life. We will make the ramp 1 at the beginnign and scale out over nage.
@pscale = chramp('density_ramp', @nage);
@density = 1.0;
Points Out
Lets add a Null abd call it “POINTS”
Source Volume
Volume Rasterize Attributes (Density)
Append a volume rasterize attributes to the “POINTS” null.
- Volume Rasterize Attributes
- Attributes: density
- Voxel Size: ch("../pyro/smokeobject_sparse1/divsize”)
- Driven by the simulation voxel size (which we have not created yet)
- Coverage Scale: 10
- The scale of the coverage (which is density by default)
- Particle Scale: 0.5 (read note below)
- Note! This is just a multiplier of the pscale, (could leave at 1 but in the lesson it was set at 0.5)
- Velocity Blur: On
- To make fast moving points appear smoother and less “stepped” we can use velocity blur
- Shutter: 1
- The longer the shutter is open the more it will be blured
- Shutter Offset: -1
- To make the blur “trail” the particle
- Blur Samples : 8
Volume VOP (Density Noise)
Lets add noise to our density volume. Append a volume vop and step in. We will use a 4d vector to sample antialias noise, fit the result and multiply it with the incomming density.
- Vector to Vector4
- connect P to the vec input and Time to fval4 (the fourth component)
- Anti-Aliased Noise
- Signature: 4D Input, 1D Noise
- Since density is a 1D attribute we will use a 1D noise.
- 4D Frequency: 2 2 2 1
- Amplitude: X
- Roughness: 0.8
- Signature: 4D Input, 1D Noise
- Hook up the hvec output to the pos input of the aa noise.
- Fit
- Destination min: 0.1
- We use the fit to remap potential negative values to the dest min value. If we raise the dest min we can make sure that we never get 0 density.
- Destination min: 0.1
- connect the aa noise output to the val input of ther fit node
Volume Rasterize Attributes (Velocity)
Append a volume rasterize attributes to the “POINTS” null.
- Volume Rasterize Attributes
- Attributes: v
- Voxel Size: ch("../pyro/smokeobject_sparse1/divsize”)
- Driven by the simulation voxel size (which we have not created yet)
- Coverage Scale: 1
- The scale of the coverage (which is density by default)
- Particle Scale: 0.5 (read note below)
- Note! This is just a multiplier of the pscale, (could leave at 1 but in the lesson it was set at 0.5)
- Velocity Blur: Off Maybe
- Note if the particles are moving fast there might be gaps in the velocity sourcing between frames, in that case we turn it on.
We could try having it off to introduce more variation to the sim, but for fast moving particles sources definitely keep it on.
- Note if the particles are moving fast there might be gaps in the velocity sourcing between frames, in that case we turn it on.
Volume VOP (Velocity Noise)
Since the velocity volume is rasterized from a single particle (and therefore only has one velocity attribute) the entire velocity volume have the same velocity. To introduce noise to the volume we will use a Volume VOP.
Append a the Volume VOP to the Volume Rasterize Attributes (Velocity) node and step in.
Since the default volume in a Volume VOP is set to density we need to explicitly import and export the velocity attribute.
- Create a Bind node and in the attribute Name field enter v and in the Type combobox select 3 Floats (vector)
- Create a Vector to Vector4 node and connect P to the vec input and Time to fval4 (the fourth component)
- Anti-Aliased Noise
- Signature: 4D Input, 3D Noise
- Since velocity is a 3D attribute we will use a 3D noise.
- 4D Frequency: 2 2 2 1
- Amplitude: 50
- Roughness: 0.8
- Signature: 4D Input, 3D Noise
- Hook up the hvec output to the pos input of the aa noise.
- Create an Add node
- Connect the output attribute v from the Bind node to the first input of the add node
- Connect the noise output from the AA Noise node to the second input of the add node.
- Create a Bind Export and in the attribute Name field enter v and in the Type combobox select 3 Floats (vector)
- Connect the sum output from the add node to the input of the Bind Export node.
Volume Velocity
Instead of a Volume VOP node we could use a Volume Velocity node to add velocity noise to our velocity volume (it has a volume vop inside and some other features). If we use a custom VOP node we might have more control.
Visualizing Velocity Volume
it might be usefull to visualize the velocity. To do this:
- Create a Volume Slice and append to the velocity volume rasterize attributes
- Create a Volume Trail and set the Volume Slice as first input and velocity volume rasterize attributes as the second input.
Merge Density & Velocity
We want to merge the density- and the velocity-volume so lets create a merge node and hook up the two volume nodes. When we do this the vieport visualization might look a bit weird since it is displaying the density aswell as the velocity volumes. The velocity voulme appears as a “square” volume block. You might also see that it is only appearing in some of the places, this is because negative velocities will not be visible.
To control the display of the volumes we can add a volume visualization node. Note that this does not delete or edit volumes it only lets us control the display of the volumes.
Volume visualization
- Volume Visualization
- Smoke
- Density Field: density
- Smoke
Source Out
Lets add a Null and call it “SOURCE” (connect the output from the volume visualization node)
Sparse Pyro Sim
DOP Network
Create a DOP Network and step in. Lets call it pyro_sim
- DOP Network
- Cache
- Cache Memory: 50000
- By default the cache memory is set to 5000 MB - 5GB. If the sim needs more RAM then that it will reuse the memoty already used in the beginning of the sim so we will not be able to play through the time line. Lets allow the sim to use 50 GB instead (or however much memory you have available to be used)
- Cache Memory: 50000
- Cache
Pyro Solver (Sparse)
Create a Pyro Solver (Sparse) and connect to output.
- Pyro Solver (Sparse)
- Simulation
- Advection/Reflection: Single-Project
- Advection-Reflection attempts to inject energy lost due to pressure projection back into the simulation. Enabling this option may exhibit better vortex retainment in the flow.
Disabled No reflection is performed; this is the recommended setting for simulations that involve non-zero goal divergence, such as explosions.
Single-Project Performs a single pressure projection per timestep and adds the removed velocity components back at the next step. This option is marginally slower than Disabled, but requires an extra vector field to be carried between timesteps.
Double-Project Performs two pressure projections and velocity advection passes per timestep. This option is a lot slower than Single-Project, but may yield better results and stability.
- Advection-Reflection attempts to inject energy lost due to pressure projection back into the simulation. Enabling this option may exhibit better vortex retainment in the flow.
- Advection/Reflection: Single-Project
- Shape
- Dissipation: Off
- Simulation
Create and merge in a Ground Plane between the output and the pyro solver.
Smoke Object (Sparse)
Create a Smoke Object (Sparse) and connect to the objects (1st) input of the pyro solver.
- Smoke Object
- Properties
- Enable Sparse Solving: On
- Voxel Size: 0.05 (lowrez)
- We copy this param and let it drive the voxel size of the volume rasterize attr node.
Note if we MMB click the smoke object node (or any other with volume fields) we get the dimensions of the voxels. Note that the dimensions are the bounding box of the volume and since it is sparse it might use less voxels then a standard pyro solver. To get a high rez volume we can aim for a 600600600 in rez or a max axis of 600.
- We copy this param and let it drive the voxel size of the volume rasterize attr node.
- Max Size: On
- Set a max size of the sim, by default it will expand as the sim evolves. This might be a good idea if the sims expands beyound the camera frustrum, no need to sim something we do not see.
Note Instead of entering values on the parms on the smokobject we can create a box in the sop level and copy the dimensions to this parm. It might be easier to do this because then we can easily see the sorce particles and make the box dimension fit.
When we copy the size and center parms we can RMB click > Copy Parameter on the parm name itself and then paste the relative ref on the destination parm. (no need to do it component by component).
- Set a max size of the sim, by default it will expand as the sim evolves. This might be a good idea if the sims expands beyound the camera frustrum, no need to sim something we do not see.
- Guides
- Visualization
- Active Region
- Displays which region of the sim that is being simulated.
- Active Region
- Visualization
- Properties
Volume Source (Density & Temperature)
Create a Volume Source and connect to the sourcing (3rd) input of the pyro solver.
Note! if we donĀ“t have an explicit temperature source volume we can use the density as temperature source. We do this by typing “density” in the source volume field of the temperature target field (multi parm at the bottom of the parametar tab added when we initialize to source smoke)
- Volume Source
- Input : specify if using context geometry or SOP path
- Initialize: Source Smoke
- Note that we first need to select something else then select source smoke to force the param to update.
- Volumes
- Enlarge Fields to Contain Sources: On
- When the voxel size of the smoke object is small and the sources is moving fast the source may be sourced outside an active region meaning it will not be used by the sim. If checked each target field will be enlarged to enclose its respective source volume.
- Operations: 3 (multiparm)
- (1st)
- Field Rank: Scalar
- Source Volume: density
- Target Field: density
- Operation: Add
- scale: 1
- (2nd)
- Field Rank: Scalar
- Source Volume: density
- Target Field: temperature
- Operation: Add
- scale: 0.1
- Since we set the coverage scale (for density attrib) on the volume rasterize attributes node to 10 and we are using density to drive temperature we set the scale to 0.1 to get a lower temperature.
- (3rd)
- Field Rank: Vector
- Source Volume: v
- Target Field: vel
- Operation: Add
- scale: 0.1
- Depending on the incomming velocity we adjust the scale to get the look that we want.
- Enlarge Fields to Contain Sources: On
Micro Solvers
Create a Merge node and connect it to the Forces (4:th) input of the pyro solver. Here we can add our various micro solvers.
Gas Disturb
Smaller noise features, the micro displacement between the smoke and the surrounding air. Roughing up the edge.
- Gas Disturb
- Settings
- Strength: 2.5
- Reference Scale: 0.2
- Roughly the size of the “noisy features”
- Settings
Gas Turbulency
Bigger displacement, macro wind current, large features.
- Gas Turbulence
- Scale: 0.015
- Swirl Size: 10
Gas Dissipate
- Diffusion: 0.01
- Time based blurring of the field. It can be nice to diffuse somewhat. It gives a contrast between older smoke (more blurred) and the newer (crisper, more detail)
- Evaporation Rate: 0.1
- If set at 0.1 == remove 10 % of the field every 1 second.
Post Sim
DOP Import Field
To import the fields from the pyro sim into the SOP level we will use a DOP Import Field
- DOP Import Field
- DOP Network: "../pyro_sim”
- Drag and drop the DOP Network node on the input line edit
- Default Object: “smokeobject_sparse1”
- Presets: Smoke
- When we select smoke in the presets combobox the fields associated with a smoke sim will be added in the multi attr section on the import tab. If you know that you do not need some of the fileds, delete them.
- DOP Network: "../pyro_sim”
To control the visualization and get a quick preview of the volumes append a Volume Visualization node to the DOP Import Filed node.
Volume Visualization
- Volume Visualization
- Visualization Mode: Smoke
- Density Scale: 2 Note
- Shadow Scale: 1.5 Note
- Note: Just test some values for density and shadow scale to get a quick visualization of the fields.
- Smoke
- Density Field: density