Articles

Houdini Grain Source: Setting Up Granular Simulations From Any Shape

Includes one exclusive complete course

The exclusive course — a full production tutorial you won't find anywhere else, never sold alone.

Best Seller
Most Loved
Tutorial Camera Rig

ADVANCED CUSTOM CAMERA RIG

ANIMATION · CONSTRAINTS · CUSTOM UI

BUILD A FULLY CUSTOM CONSTRAINT-BASED CAMERA RIG IN HOUDINI WITH A CUSTOM UI PANEL. DESIGN FLEXIBLE SYSTEMS FOR PRECISE, CINEMATIC CAMERA ANIMATION ON ANY PROJECT.

€29.99

Freebies
Free Studio HDRI Pack box by Artivoxa showing 60 studio lighting setups with softboxes wrapped around the packaging

Studio HDRI Collection

ASSETS · EXR & HDR · 60 HDRIS

DOWNLOAD 60 STUDIO HDRIS CAPTURED IN A REAL PHOTO STUDIO. LIGHT YOUR PRODUCT AND BEAUTY RENDERS LIKE A PHOTOGRAPHER — SOFTBOX, LANTERN, STRIP AND GRID SETUPS, READY FOR ANY RENDERER.

FREE

ARTILABZ™

Everything You Need to master Houdini.

ARTILABZ™ gives you unlimited access to all Houdini courses, 3D assets, simulation files, textures and tools. updated every month.

01

Premium Houdini Tutorials

Full access to every course — fluid simulation, procedural FX, brand visuals and more.

02

Monthly New Content

Fresh tutorials and assets added every month — your library grows with you.

03

Instant Access to Everything

The moment you join, the full library is yours — no drip-feed, no waiting.

04

Project Files Included

Every tutorial comes with the full Houdini scene file — open every node, learn every detail.

FROM 14.99€/MONTH

Houdini Grain Source: Setting Up Granular Simulations From Any Shape

Houdini Grain Source: Setting Up Granular Simulations From Any Shape

Ever found yourself battling with particle sources in complex geometry? Do your attempts at a consistent granular spread fall short when you switch to intricate shapes? You’re not alone in wrestling with these challenges.

Many artists spend hours setting up scattered points, only to see uneven density or wasted simulation time. The maze of SOP nodes and attribute tweaks can leave you confused about the right path to a stable granular simulation.

That’s where Houdini and its Grain Source SOP come in. This powerful tool lets you define any surface or volume as a seed for your grains, giving you precise control over distribution and behavior, even on the most irregular forms.

In this guide, you’ll learn how to configure the Grain Source from scratch, assign key attributes, and troubleshoot common pitfalls. By the end, setting up reliable granular simulations from any shape will feel straightforward and repeatable.

What is the Grain Source operator and when should you use it in Houdini?

The Grain Source operator is a DOP-level node designed to convert geometry into a cloud of points ready for granular simulations. It samples input shapes—volumes, surfaces or packed geometry—and generates per-particle attributes such as mass, density, activation and velocity. By centralizing these tasks, it streamlines the setup of any grain-based effect.

Under the hood, the Grain Source operator builds an internal SDF or point cloud representation of your input. It creates a dynamic population of particles whose spacing, friction and rest density you can control. Attributes like “active” flags let the solver know when and where to emit new grains. You can fine-tune seed patterns, jitter and distribution density, ensuring reproducible and artifact-free results across iterations.

Use the Grain Source operator whenever you need a robust, procedural way to feed grains into a Vellum or POP-based solver. It excels at:

  • Initializing a pile of sand or sugar in a container for static or animated collapse.
  • Continuously feeding particles from an arbitrary geometry—hoses, funnels or custom shapes.
  • Switching between different source shapes mid-simulation, leveraging per-frame activation controls.
  • Converting complex mesh surfaces to grains without manual point scattering or extra SOP work.

How do I prepare geometry and attributes (density, normals, velocity) for grain sourcing?

Before emitting grains, you need clean geometry with meaningful density, normals, and velocity attributes. This setup ensures particles distribute consistently over complex surfaces and inherit correct motion. Houdini’s procedural workflow lets you generate and transfer these attributes systematically, avoiding manual cleanup or inconsistent sourcing.

First, standardize and optimize your source mesh. Use a Facet SOP to consolidate points and remove zero-area triangles, then apply a Remesh SOP if the topology is uneven. This creates uniform polygon size, which improves density sampling. Finally, freeze transforms to (0,0,0) and ensure scale is 1–1–1 for predictable VDB and scatter operations.

To build a density field, convert the mesh to a volume: drop down a VDB from Polygons SOP, choosing a voxel size matching your grain radius. Inside a Volume VOP, you can mask or amplify density based on curvature or proximity fields. Back on the SOP level, scatter points with a Density attribute by feeding the VDB into a Scatter SOP’s density input, ensuring grains cluster where density is high.

For surface normals, add a Normal SOP set to “compute point normals.” If you need sharper detail on edges, follow with an Attribute Blur SOP targeting @N to smooth noise. In an Attribute Wrangle you can renormalize: @N = normalize(@N); ensuring every grain emits along a unit-length normal for consistent initial direction.

When sourcing from animated or moving geometry, capture velocity per point. Drop a Trail SOP set to “Compute Velocity” between frames, then use an Attribute Wrangle to clamp or scale: v@v = clamp(v@v,{-10,-10,-10},{10,10,10});. This embeds object-space motion into each grain’s v attribute, preserving momentum when the sim begins.

How to set up a Grain Source network from any shape — step-by-step

Key nodes and parameters to set (Grain Source, Scatter, VDB, Attribute Transfer)

Begin by feeding your input geometry into a VDB From Polygons SOP. Adjust voxel size to control surface detail—smaller voxels capture intricate contours but increase memory. This SDF volume defines the region where grains will form.

Next, drop a Scatter SOP to densely populate points inside the volume. Use the density attribute from the VDB as a weight: set Density Attribute to “density” and tweak Max Points or Density Scale. This ensures uniform point distribution that matches shape thickness.

Bring in an Attribute Transfer SOP to transfer the VDB’s SDF values onto the scattered points. Set Source Group to the VDB primitive, Destination Group to points, and map “surface” or “distance” fields. These values inform grain birth positions relative to the shape’s boundary.

  • Grain Source SOP: Source Type = Points, Activation Attribute = “@density”
  • Birth Separation: defines particle diameter; start around 0.02 units and adjust for packing
  • Velocity Scale: drives initial outward push—0.1–0.5 works for slow pours
  • Rest Position: store initial SDF distance for internal pressure constraints
  • Attribute Transfer settings: Filter Size ~1.5, Blend Width ~0.1 for smooth gradient

Finally, connect the points network into a Grain Source DOP within a DOP Network. Wire your packed points to the Source Points input, then link a Grain Solver. In the DOP, enable animated activation, set Post-Solve Scale for restitution, and tune viscosity for desired clumping behavior.

How can I control particle distribution, clustering, and emission regions for precise results?

Controlling the initial spread of grains begins with shaping a density field or attribute on your geometry. By converting any mesh or volume into a VDB and painting a “density” channel, you can feed that into the Grain Source’s density input. Higher density directly translates into more particles per unit, allowing spatially varying resolution based on shape features.

For surface distributions, the Scatter SOP remains indispensable: enable the density attribute output and link it to the VDB density. Tweak the Force Total Count or Density Scale parameters to hit exact counts. Use Attribute Noise or Attribute VOP to modulate density procedurally, carving swirls or erosion patterns without touching the base mesh.

Clustering adds realism by grouping grains into coherent blobs. Create a @cluster attribute via a Point Wrangle: sample a noise function, threshold it, then assign integer group IDs. Alternatively, the Partition SOP can auto-generate clusters based on proximity or bounding regions. Downstream, assign different collision or constraint behaviors per cluster by referencing these group names in your DOP network.

To isolate emission regions, leverage the Grain Source’s Source Group field or predefine point groups. Define a box or sphere group in SOP context, then reference it directly—only points in that group emit. For animated regions, drive this group with expressions on @P or @Frame in a Wrangle, creating masks that expand or contract over time for timed reveals.

  • Density-based scattering with Volume VDB and Scatter SOP
  • Attribute-driven clusters via Point Wrangle or Partition SOP
  • Region targeting using Grain Source Source Group and SOP groups
  • Dynamic emission control through activation attributes in a SOP Solver

By combining density-driven scattering, cluster attributes, and group-based emission, you gain full mastery over how grains populate and behave. This procedural workflow ensures every clump, void, and timed release maps exactly to your artistic intent, resulting in granular sims that are predictable, optimized, and endlessly adjustable.

How to transfer velocity, rest, and custom attributes to granular particles for accurate behavior?

When you use the Grain Source SOP to emit particles, Houdini automatically copies the v attribute from the emission geometry, but you’ll need to explicitly pass rest and any other custom data to guide shape retention and material behavior. By baking these attributes in the SOP context before sourcing, you ensure each grain particle carries the correct motion and intrinsic properties through the DOP network.

First, use an Attribute Wrangle or Attribute Create node on your emitter geometry to define rest = @P. This captures the untransformed position. Then, scatter the points or convert the geometry to VDB for volumetric emission. In the Grain Source SOP’s Attributes tab, specify:

  • Velocity Attribute: v (ensures birth velocity matches the source motion)
  • Rest Position: rest (guides shape recovery and internal forces)
  • Extra Attributes: list custom names like hardness, mass_scale, Cd

Inside the DOP network, the Grain Solver respects these per-particle attributes automatically—velocity drives advection, rest generates internal constraints, and your custom fields can drive friction, cohesion or color. If you need runtime adjustments, a SOP Solver attached to the DOP Import can modify these attributes each substep, allowing real-time control over granular dynamics.

How do I troubleshoot common artifacts and optimize performance for granular simulations?

When working with granular simulations in Houdini, you may encounter jittery motion, particles tunneling through colliders, or clusters collapsing unnaturally. These issues often stem from insufficient integration precision, collision geometry inaccuracies, or unbalanced solver settings. Addressing them early prevents wasted compute time on flawed caches.

For jitter and tunneling, increase the solver’s substep count or enable subframe collision. Adjust the Collision Margin parameter on your static or packed-proxy geometry to pad surfaces, ensuring particles don’t pass through thin walls. Converting your collider into a VDB volume with a slight inflate can also eliminate gaps without drastically raising mesh resolution.

Leaking at edges or corners often indicates that the source volume or surface sampling isn’t covering boundary regions. Expand your source’s voxel padding or use a “fill” VDB SOP before scattering grains. If clusters collapse or form rigid clumps, check your friction and cohesion multipliers—reduce cohesion or employ per-particle variability via Attribute VOP to simulate naturally dissipating contacts.

Performance bottlenecks usually emerge when high particle counts collide with limited memory and CPU threads. Rather than brute-forcing resolution, balance visual fidelity with solver workload. Use cropping and dynamic regions of interest so the solver focuses on impactful areas, and profile your sim with the Performance Monitor to pinpoint slow nodes.

Performance optimization checklist (substepping, proxy geometry, particle count, memory)

  • Substepping: Set a minimum of 2–4 substeps in your Grain Solver; raise collision substeps for fast-moving emitters. Use per-solver overrides rather than global time settings to target specific sims.
  • Proxy Geometry: Replace high-res meshes with low-poly or VDB proxies for collision. Use SOP Convert to VDB and VDB Resample to control voxel size, trading memory for stability.
  • Particle Count: Limit grains via volume sampling density. Implement LOD by lower density in distant or unseen regions. Use a bounding region emitter or group mask to conserve particles in less critical zones.
  • Memory: Cache sim data to disk with DOP I/O nodes, enabling “Write on the Fly” to free RAM. Monitor Resident Memory in the Console and split large caches into sequence-based files to avoid single-file bloat.

By systematically tuning these parameters and profiling each change, you’ll eliminate visual artifacts while maintaining an efficient simulation pipeline. Keep detailed versioned caches to compare performance gains after each optimization step.