Houdini Tutorial Week 5

This week is going to be all about volumes and smoke, fire or explosion.

In Volumes we’ll learn to create and control combustion style simulations in the sparse pyro solver, and then take it further by using PDG to run a bunch of wedged sims so that we can work more efficiently. Custom simulation and post-simulation techniques, together with custom shader and lighting strategies, will allow us to create production quality work in ways that out of the box tools just can’t. After some compositing, we’ll end up with a great explosion – but more importantly, the knowledge and confidence to hack solvers and shaders to create all kinds of effects!

Atmosphere Volume

This shader simulates light scattered by a thin, uniform atmosphere. It produces shafts of light and volumetric shadows cast from geometric objects. It works with point, spot, and area lights, but not with distant or skylights. This is a scene-wide volume shader (or an atmosphere shader in Arnold’s terms).  

  • atmosphere_volume used to be called volumetric_scattering and should not be confused with volume rendering of fluid type objects.
  • atmosphere_volume only works with ‘local’ lights that have a precise location and size and inverse-square decay. It does not support lights at an infinite distance, such as the Skydome light or directional light.
  • Currently, atmosphere_volume does not compose well against volumes. This is because atmospheres return a single flat result that is opacity mapped on top of whatever is in the background of the pixel.

atmosphere_volume should be composited using an ‘additive’ mode such as ‘screen’ because volumetric scattering is the light that cannot be represented in the alpha channel.

The example below demonstrates the effect of atmosphere_volume through a medium. It consists of a polygon plane with a circular ramp texture connected to the opacity of a standard_surface shader. The spotlight is pointing at the plane and atmosphere_volume is enabled.  

https://docs.arnoldrenderer.com/display/A5AFMUG/Atmosphere+Volume

How to drop an ‘Atmosphere’ node in scene and connect it to volumetric material

  • Add an atmosphere.
  • Set it’s material to a fog light (v_foglight)
  • Add a light to the scene and point it at some geometry.
  • On the Atmosphere node under the Render tab set the light mask to the light you added.
  • Tweak the volume fog material to match your scene, as the help states, this is dependent upon your scene scale.
  • Sometimes people will put another piece of geometry between the light and the target geometry to help break up the rays, often this is just a plane with a noise based alpha material such as a gobo.

To use Atmosphere, select it under Scene Elements, in the 3Delight ROP.

The 3Delight Atmosphere shader allows rendering of atmospheric effects such as fog and smoke. The shader interacts with all lighting elements of the scene (environment, area lights, directional lights, mesh lights) and will be part of any Deep EXR file produced by the render.

Color — This controls the general colour of the atmosphere.

Density — Specifies the density of the atmosphere. Density is related to the amount of particles/molecules that block light. Increasing density makes objects disappear with distance. Density’s effect is also related to the scale of the scene. Scenes of a small scale need a higher Density to render the same effect as scene built using a larger scale.  

Super Reflective — This parameter enables rendering of volumes that reflect much more light that they absorb. This non-physical behaviour allows for more artistic freedom.  For example, it is possible to obtain distinctive glow around lights while avoiding the steep absorption of a high Density that makes objects invisible in the atmosphere. The default value of 0 ensures a physically plausible render.

The parameters of this shader have been designed to allow an artist-friendly specification of atmosphere’s look. The colour dialed in the UI will be the colour of the atmosphere. The often used absorption and scattering parameters provide non intuitive results since they require the use of visually unrelated colours in the UI.

This shader simulates fog using single scattering only. For multiple-scattering, it is recommended to create a VDB volume with constant density and use VDB Volume shader.

https://www.sidefx.com/docs/houdini/render/volumes.html

Concept

  1. Smoke is the display state of fog. For example, fog volume in ISO offset is directly a visual vector field
  2. ISO is a lot of small squares that always face the camera, such as SDF volume in ISO offset
  3. Poly is the normal model display, such as ISO surface and tetra mesh in ISO offset
  4. Volume is a vector field. By default, it is displayed in smoke mode, but this node has no value by default, so it can’t be seen. You can give an initial value at will
  5. SDF is the signed distance field, which is a common way to represent three-dimensional space in iconography. Similar applications include ray marching material, dfao in UE4 and so on
  6. In ISO display, it is also stored in voxel form, from which distance, direction and other data can be obtained
  7. VDB is an open VDB, which is an updated general volume data type. It can export VDB format as a general material, which contains a variety of density and other volume data
  • Convert VDB can convert the relationship between VDB and VDB
  • Convert volume can be converted to poly or fog display mode
  • Volume visualization can be used to visualize the display color of fog

It can be seen that because there are several display states and the voxel data generated by nodes are different, there are different conversion relationships

Examples

Create the material Arnold

Node — Atmosphere_volume > shader to out_environment > atmosphere

Out>environment>select the material of the volume

Change the density

Add the noise > rgb to atmosphere_volume >rgb density

Process1 — Smoke

Create the node — Circle > scatter > attribcreate (density) > value 1

Add color to see the details and the attribute is density

Add Attribnoise attribute names> float and density

Change the remap ramp and element size

So the result is that the density is not everywhere

Add the Volume Rasterize Attributes and choose the attribute of density

The Volume Rasterize Attributes SOP takes a cloud of points as input and creates VDBs for its float or vector attributes. Internally, this node utilizes the Volume Rasterize Particles SOP and is thus subject to its nuances and limitations.

  • Group — A group of points in the input to rasterize.
  • Attributes — Pattern specifying which attributes to create corresponding VDBs for.
  • Note — Only float and vector attributes can be rasterized.

change the particle scale

Drag the voxel size to particle scale and select relative channel reference to make the expression

Attribnoise > Animation > Animation Noise

Add the dopnet to do the simulation

Way1: Smokesolver +volumesource+gasturbulence+ smokesolver_sparse

The Smoke Solver is able to perform the basic steps required for a smoke simulation. Pyro Solver (Sparse) extends the functionality of this solver by adding flame simulation along with extra shaping controls.

This solver makes use of various field subdata on the object.

  • The object should have a scalar field density for the density of the smoke.
  • The object should have a vector field vel for the velocity at each voxel.
  • Optionally, the object can have a scalar field temperature for internal buoyancy calculations.

The essential building blocks of a smoke simulation are the object, solver, and sourcing. The Smoke Object (Sparse) node creates a dynamic object containing the required fields, which are then evolved by the solver as the simulation proceeds. The simplest smoke simulation needs the following data:

  • density scalar field that contains where and how much smoke is present;
  • temperature scalar field that’s used for buoyancy calculations;
  • vel vector field that captures the instantaneous motion of the smoke.

This solver takes care of ensuring these fields change in a manner consistent with smoke, but sourcing is responsible for injecting these quantities through the course of the simulation. For example, you may want to continuously add to density at the soot source or temperature to cause hot regions to rise.

Smokeobject_sparse

This DOP creates a smoke object with properly configured fields that can be evolved by a Smoke Solver (Sparse) or Pyro Solver (Sparse). The object will start out empty, and can be populated with smoke or heat using the Volume Source DOP.

Settings

Movement of the volume — temperature

The DOP Import Fields SOP is designed to streamline the common operation of importing many fields from fluid simulations into SOPs.

Presents: Smoke

Field — The scalar or vector field to extract from the object. It will be properly named, ie, the vel field will create vel.xvel.y, and vel.z named volumes. It will also be in a group named after the DOP object. While this is designed around importing fields, any geometry can actually be imported here.

Create the lights

The Volume Visualization operator adds detail attributes to the volume to allow for visualizations of volumes that requires multiple volumes to be joined together. For example, one may want to take a density volume and color it according to three separate Cd.x, Cd.y, and Cd.z volumes.

First there is the opaque smoke. This smoke occludes geometry behind it. It also casts shadows from light sources. Finally, a diffuse color can be specified for what light colors it reflects rather than absorbs.

Second there is an emissive, glowing, component. This field is added directly to the final image, washing out but not occluding geometry behind it. This is useful for fire-style effects. It can also be useful for visualizing data because it allows interior detail to shine through the outer layers.

Fire colour — temperature and choose physical blackbody

Gasturbulence — Creates and applies a global turbulence field. This turbulent velocity field is modulated by the Control Field and lookup ramps provided. This controls where and with what magnitude the turbulence shows up, so you can ensure it occurs only in the regions of the sim you want.

  • Time Scale — Specifies a scale factor that relates DOP time to the simulation time for this microsolver. A value greater than one means the simulation time advances faster than the DOP time. A value less than one causes the simulation to appear to run in slow motion relative to the DOP time. Several expression functions such as doptime exist for converting from global times to simulation times and vice versa.
  • Scale — Magnitude of turbulence applied to specified velocity field.
  • Swirl Size — Initialized (base) swirl size value. Measured in worl units. This value is derived from frequency.
  • Grain — The amount of influence added bands of  Turbulence have, relative to the initial Swirl Size.
  • Pulse Length — How fast the noise moves. Higher values will result in slower movement.
  • Seed — Defines initial noise offset
  • Attenuation — Defines the gradual loss of intensity.
  • Influence Threshold — When to apply Turbulence, based on the specified Density Field.
  • Turbulence — Levels of turbulence to apply relative to the initial Swirl Size For smoother transitions, use lower values.

Way2: smokeobject + volumesource + smokesolver + smokesolver

change the size

Use the bounding box with the Lattice node to create a deformation cage for the input geometry.

Expression — size

Alt + E to make the windows bigger

Expression — centre (for transform)

made the expression to the smokeobject

Gasresizefluiddynamic — The Gas Resize Fluid Dynamic DOP is a microsolver used in building larger fluid simulations. The Fluid Solver and Smoke Solver DOPs allow microsolvers to be added before or after the main solver step to extend or tweak the simulation. Alternatively, advanced users may attempt to build an entire new solver out of microsolvers.

The Gas Resize Fluid Dynamic DOP will resize the fields required for different types of fluid simulations according to a reference field. A SOP Solver is used to recalculate the new bounds every timestep. This resizing is done with the Gas Resize Field DOP so it does not affect the actual voxel sampling, just the total number of voxels.

unselect the max bound > clamp to Max so the bound size will change according the volume

Process2 — Fire

Pyrosolver_sparse — This node is an extension of the Smoke Solver (Sparse). It considers an extra simulation field (flame, which captures the presence of flames) and adds some extra shaping parameters to allow for more control over the emergent look.

remove the temperature attribute of attribnoise and volumerasterizeattributes

add the attribute of source of density and target field of flame

frame lifespan and change the scale of temperature weight

make the pyrosolver_sparse > shredding bigger to add more details

Add the disturbance

Add gasvortexconfinement and confinement scale 0.5

Gasvortexconfinement — The Gas Vortex Confinement DOP applies vortex confinement to a velocity field. This is a force which amplifies existing vortices with the intent of undoing the diffusion that occurs during the diffusion stages of the fluid solver.

Confinement Scale — The strength of the vortex confinement.

Add gaswind and merge (direction)

The Gas Wind DOP is a microsolver used in building larger fluid simulations. The Fluid Solver and Smoke Solver DOPs that allow microsolvers to be added before or after the main solver step to extend or tweak the simulation. Alternatively, advanced users could try to build an entire new solver out of microsolvers.

The Gas Wind DOP applies a wind force, adjusting the velocity field in the direction of the ambient wind direction

fileache $HIP/sim/fire/$F4.vdb

Convertvdb — This node converts sparse volumes, or VDBs, into other types. It provides some extra options not available through the Convert SOP. This also allows the conversion of volumes into VDBs.

For converting to polygons, the second and third inputs can be optionally supplied. The second input provides a reference polygon surface for converting the volume, which is useful for converting fractured VDBs back to polygons. The third provides additional VDB fields which can be used for masking (which voxels to convert to polygons), and/or for specifying an adaptivity multiplier.

Add convertvdb + vdbvectormerge + primitive

primitive

reduce by half the the amount of data that we save to disk — write 16-Bits Floats

and set the render settings the save to the sisk

Render

  • Arnold render
  • Arnold material
  • Arnold light

invisible the particle only the arnold_volume and hide the flame so the render will be normal

Material ( Volume)

add the volume_sample_float + ramp_rgb1 + standard_volume

Standard_volume

The standard_volume is a physically-based volume shader. It provides independent control over volume density, scatter color and transparent color. Blackbody emission is used to render fire and explosions directly from physics simulations.

Each component can be controlled by a volume channel coming from the volume object, with other parameters acting as multipliers on the channel. Optionally the channel can be left empty, and a custom shader like Volume Sample or a procedural texture may be connected instead, to manipulate each component with more control.

However, be warned that the evaluation of a shader network for volume rendering is much more expensive than for surface shading because the shader network is called many times per ray, once per ray march sample. So, in a production environment, it’s best to use as few shaders as possible, ideally having just the standard_volume shader doing all the work.

https://docs.arnoldrenderer.com/display/A5AFHUG/Standard+Volume

with ramp_Rgb > black body

Ramp color preference

Viewport

Render

Process3: Explosion

Add scatter and vdbfrompolygons

Pyrosource

PyroSource — The Pyro Source SOP converts its input geometry into points suitable for sourcing pyro and smoke simulations. This SOP adds specified attributes to the generated points, which can be rasterized and imported into desired DOP fields by the Volume Source node. Pyro Source also contains a handful of initialization presets for driving common simulation scenarios.

Input geometry. When Mode is set to Surface Scatter or Volume Scatter, the geometry must correspond to a surface; in the latter case, the surface must also have a resolvable interior.

VolumeRasterizeAttribute — The Volume Rasterize Attributes SOP takes a cloud of points as input and creates VDBs for its float or vector attributes. Internally, this node utilizes the Volume Rasterize Particles SOP and is thus subject to its nuances and limitations.

Attiurbute — density

Add the pyrosolver and go to sourcing and remain density and temperature

PyroSolver — The Pyro Solver is a wrapper around a DOP network to simplify the running of Pyro solves.

The first input provides the sources for the Pyro simulation. This should be a set of named volumes. The exact names required are determined by the Sourcing tab. The Pyro Source SOP and Volume Rasterize Attributes SOP are useful tools for creating source volumes.

The second input provides the collisions for the Pyro simulation. It should be a SDF VDB, such as the second output of the Collision Source SOP or the main output of the VDB From Polygons SOP. If the collision is animating, points with a v attribute can be used to describe the motion. The two outputs of the Collision Source SOP can be merged and used as the second input to provide this.

Cooling rate means how fast does the temperature disappear

Make the density scale smaller to make the fire effect more clear

Add the density and divergence to make it expands quickly

make the visualization mode > smoke and change the density scale and shadow scale

outcome

Add the attribcreate

pyro solver add the density and field flame

make it is super easy to tweak the values — Minimal OpenCL Solve

The solver has the ability to perform a Minimal OpenCL Solve, which is useful for very rapid prototyping. This checkbox is located on the Advanced tab, and allows for interactive manipulation of parameters during a running simulation, which can give you quick feedback of their effects on the simulation.

When this checkbox is turned on, some features of the solver are turned off to to ensure that all simulation data can stay in video memory, avoiding costly copies that are necessary when only Use OpenCL is turned on.

Open the Shape > dissipation and disturbance and shredding and turbulence

Shape

The shape of the resultant smoke can be greatly changed by tweaking the settings that are located in this section. Depending on values of these parameters, simulation results may fall anywhere between simple laminar smoke flow to small fires to huge explosions.

Dissipation reduces the density of smoke over time, so that it fades and eventually disappears. It is important to set an appropriate value for the Clamp Below parameter when performing a sparse simulation. Otherwise, tiny density values will linger and unnecessarily inflate the active simulation region.

Disturbance and shredding apply random forces to break up the simulation. Former exerts linear accelerations and is useful for breaking up smooth smoke caps. The latter rotates velocities to redirect the flow. Shredding is effective at adding chaotic motion without speeding up or slowing down the flow; it is especially useful for fire simulations, which are dominated by vertical licks when no shredding is used.

Turbulence can be used to add powerful large-scale noise to the simulation velocities.

Each shaping operation has a checkbox to turn it on and a scaling factor to specify how strongly to apply it. There is also a tab containing further parameters for each built-in operator. A common theme here is the control field, which can be used to spatially attenuate strength of the shaping operator. When enabled, value of the Control Field is fitted from the Control Range to 0-1; this is further passed through theControl Ramp if Remap Control Field is enabled. The remapped control value is then applied as a scaling factor on top of the global strength.

So give the same Arnold volume and the material

Explosion material

Render only the standard volume

the emission > blackbody

Temperature so to change the brightness of the fire centre

Blackbody intensity

Collision

VDB from Polygons > Distance VDB > Collision

Making collision field by VDB and the initialize > collision

Key the sphere transform frames

Arrtibute pointv and distance VDB > collision / surface

Add a volumesource and merge to source the collision

The Volume Source node imports SOP data into DOP fields and geometry. This node is capable of merging an arbitrary number of SOP volumes and VDBs with fields, as well as importing and destroying simulation particles.

This entry was posted in Houdini & Lighting. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.