Using geometrynodes how can I store impact points of particles when they hit a mesh?

I am experimenting with doing different simulations in geometry-nodes. What i am trying to do now is store the impact points of the particles as they hit a mesh.

Is there a way to store those impact points in a vertex or weight-map on the mesh they hit? For example if a particle hits a mesh and bounces along it i would like to see the impact points in the vertex or weight-map.

• Could you share a demo Blender file including a piece of mesh and some particles using blend-exchange.com ? Do you want the impact points stored in the mesh or particle wise ? Commented Dec 23, 2023 at 7:53
• Vertex or Weight maps store information for each vertex of the mesh. What if the particles hit the surface of the mesh instead. Or if multiple particles hit the same face. And example of what you are trying to achieve or a blend file with your progress may help getting a better answer. Commented Dec 23, 2023 at 8:07

Here's a simple setup:

The same split into parts for easier reading:

Start a simulation on the original geometry, which becomes the shooting Target. Also mantain a separate Geometry with points called Bullets. On each frame there's 50% chance to spawn a new ("bullet") point and join it with existing points. Spawn it randomly $$2$$ units away from the origin (Suzanne's ears are big; also consider improving the spherical distribution) and for convenience save the negated (opposite) and scaled down position as velocity, so all points fall towards the origin.

Raycast from the points, using the velocity, to find out if they're about to hit the original geometry (Target could be used instead of Group Input). Separate the points that are going to hit - they won't be rejoined, they are scheduled to be removed, but will be useful in a moment. Keep in mind the Ray Length is a result of scaling the normalized random position by 2, then by -0.01 plus 5% margin. Move the dying points to a $$$$ position, where $$i$$ is the index of the nearest vertex of the target - this way a vertex will be easily able to find if a bullet has hit it on current frame.

Starting from the right: a switch looks at the dying bullets. If there are none, the number 0 converts to boolean FALSE and Target geometry is not changed; otherwise update the energy attribute by first multiplying it by $$0.9$$ (dissipate 10% energy), and then adding $$1$$ energy if a point is found on the position $$$$. Consider how one of the flaws of this algorithm is that multiple points hitting in a single frame still count as one.

Update the target in the simulation, and update the remaining bullets by moving them towards the origin. Instance icospheres on bullets to display them, set the material on the Target (a simulation removes the material):

Obviously the effect is better for a higher density mesh:

Though you might want to e.g. blur it to make the dots bigger: