Fill Any Mesh With "Collision Aware" Spheres - The "Gambion" GeoNodes Setup

codesignprojects in Geometry Node Groups


The Gambion — Procedural Collision-Aware Spheres in Geometry Nodes.

This Geometry Nodes setup procedurally fills any given mesh with "collision-aware" spheres. It uses raycasting to determine which scattered points lie inside the mesh volume, instances spheres on those points, and then dynamically transforms their vertices so the spheres press against the container walls and each other without overlapping.

UV spheres are distributed inside a mesh. The interior is limited and calculated by a Raycast node mainly, using a dot-product math trick. The spheres are transformed in respect to each other by a Set Position node and vector math aided by Geometry Proximity.

▶ Video demos: Demo 1 | Demo 2 (YouTube)

How it works: The advantage of this setup is that it calculates collisions on a per-vertex basis purely through vector math, avoiding simulation bake times entirely. The spheres aren't actually colliding; their vertices are just dynamically shrinking away from the container bounds and neighboring instance centers.

---------------------------------------------------------------------------------------------

Developer's Note:

-(Since it is a concept demonstration, it is kept as simple as possible.) The GeoNodes trees are kept clean, the nodes are not contracted into node groups for easier readability and have detailed explanations. You can embellish, refine as you wish.

The Raycast Trick Explained: Since many asked, here is a short clarification of the method used to determine which vertices are inside the mesh. If you have vertices inside any mesh, you can "fire" rays from them with the Raycast node in a random direction. Sooner or later they will hit the mesh surface, registering this hitpoint and its normal. Now we take the dot product of the ray vector and the normal. If it is negative, then the vertex was inside the mesh!

✦ Compatibility: The file is working seamlessly in Blender 3.6 up to 5.2!

---------------------------------------------------------------------------------------------

Support & Contact:


$2.90

Have questions about this product?
Login to message

Details
Sales 100+
Rating
1 ratings
Published over 4 years ago
Blender Version 3.6 - 5.2
Render Engine Used Cycles, Eevee
License Creative Commons