# Questions about sdf-objects in InstanceNoodles and collision detection (3d) in general

hello to all. I am very fascinated from the raymarching technique. I’ve watched the vvvv weekend seminar. this is unfortunately too much coding for me. although I have rudimentary knowledge in C ++ …but I have learned as a self-taught. among other things to write complex fractal programs. that is a long time ago and at the patching I love that it very much suits my pictorial thinking. mr. vux has written a raycast node and there are two help files that I understand in principle. but I do not know if that works even if, for example, a sphere moves within a complex geometric object (currently objects of the SurfaceBufferd node). since these exist only as enumerations I can not convert them with the MeshToSDF node. only the object that I bring in (sphere, cylinder …). would a SphereSDF detect the collision with the wireframe of a SurfaceBufferd geometry object? thank you

think my question nobody understood. ok, does a signed ditance field work even if only one object has this?

This really hard to understand what you talking about. I’m suspecting you are trying to raycast to some sdf?

I guess if you upload patch with what you are trying to do will be more helpfull.

What exactly you want to get from that raycast?

now in raymarching you have a (mostly compound) distance function which will make a “field” while you’re marching through your rays using the calculated distances at the points on the rays (d = df(pointonray)), etc etc you’ve seen the video. You can use such distance functions in many ways. The simplest is to store a volume of distance values where each voxel tells you how far away the closest surface is from that point. In that case you do voxelval = d = df(voxelpos). Fun fact: you can use that volume to be read in another distance function somewhere else. You can then use such functions for particles (for collision or attraction but also for more special cases as well). For those you need the gradient of the distance field from which you can assume a surface aligned space (or on the surface itself just the tangential space), or in plain english: you can calculate the normal. Now if you have the normal you can do particle collision.

Understand though, the Raycast node has nothing to do with this. Wireframes or whatever “SurfaceBufferd geometry objects” are have even less to do with this. If you want to work with triangle geometry this way, and you are satisfied with simple naive ways, you have to bake them into distance volumes and use that. however you will lose the exact properties of the triangles in the process. Also note that this baking is a slow process so it will work only with static geometry, if you want to collide with triangular animation you have to estimate that with another distance function. (games use capsules around skinned/animated character bones for example to make them react with clothing, hair and other GPU particle/physics things)

@anthokhio: ok. in detail. I am currently fascinated by the interior of the 53 complex “SufaceBufferd” objects. made them audio-reactive. I would like to add other audiovisual objects. so that they stay inside and do not go through walls, I need the coordinates of the impact. to respond and change direction. otherwise these remain two completely independent objects.

@microdee: thanks! compact information. try to implement that.

@antokhio: summarized: renderd becomes the inner one of the complex geometric objects of the SurfaceBufferd node. the interior moves (audio-reactive). another object (simpler) should move within this dynamic space. and register where it can not go on. outside wall or inside (torus center / pillar). is this possible at all with vvvv

If you do small patch with all the objects will help a lot

thank you. please wait. at the moment I do not have a simple patch of it. but there is a “pre-study” from me. inside these strange objects. if I drag in a sphere that moves freely you know what I mean. lasts one to two days ;-)

this is a simplified patch but I hope it shows my question (will not use the “wanderer” for moving a sphere/cylinder and the movement of the inner walls is more violent because of audio-modulation). can I get the coordinates of the collision-points sphere/inside-walls of the SurfaceBufferd object with vvvv-means? and if not: how? (coding)

ok, admit i wanted to push myself before learning the raymarching method. had calculate with vectors in school. long, long ago. I thought maybe there would be a simple way to get the coordinates of the first collision and then change the direction by patch. I have probably misunderstood something about sdf. start with raymarch. I also need for mandelbulbs and the like. Thank you.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.