I have a const vec2 pool2 = vec2( 6, 6);const vec3 pool3 = vec3( floor( 512.0 / pool2), pool2.x * pool2.y); The box defines the coordinate point range limited to inside this box. How do I obtain the distance values stored in the pre-generated sdf texture using random coordinate points within the box’s range? …
Do I need to set the resolution equal to the size of the pool3 box in order to correctly retrieve the distance value? I tried changing the resolution to 512, and the browser crashed.
What are you using to generate SDF?
mesh-bvh already has a nearest point to point method yea?
a volumetric texture takes a lot of memory. a 512512512 sdf is probably around 270 MB of vram.(assuming 16bit float)
I’d stick with 256.
You shouldn’t have to set its size to match anything.. but I haven’t used it before.
I don’t know if its a box volume or a rectangular prism.
I’d imagine its roughly N on the largest axis (256) and then the Y/Z dimensions are the corresponding ratio of the root node bounding box.
Okay, I haven’t solved it yet
Due to the three-mesh-bvh plugin, the online demo production failed, I can’t provide the online demo, if anyone can help, I provide the archive
I want to get the distance value in the precomputed sdfTex to implement boundary obstacle collision detection, and I can see in Figure 1 that the distance should be correct? Figure 2 I took the distance value from sdfTex, but it didn’t work, I don’t understand what went wrong. Figure 3 is a manually created SDF BOX which calculates the correct distance value for the obstacle collision
test_sdf.zip (8.5 MB)