Is there any existing data structure I could pass to a compute shader that would allow me to check if a 3D point is inside the bounds of a given mesh?
I could always pass an array of triangles for the given mesh, then use those triangles to determine if the point is inside them, but I’m hoping there might be an existing structure to help me out.
For more context:
I’m currently looking at sebastian lague’s terraforming project that can be found here: Coding Adventure: Terraforming - YouTube
On a basic level, there is a shader that is being used to calculate the densities at various points using a 3D RenderTexture, storing the density at each point to later be used for the marching cubes algorithm.
Sebastian’s implementation uses noise to generate the densities at each point.
Instead of noise, my goal is to use meshes of various objects I’ve placed in the scene as references for determining which points should have what densities. For example, maybe I have two spheres and a cube within the relative bounds mapped by the 3D RenderTexture and I might want to set the density of all points inside the spheres to 1 and all points inside the cube to 0.4, and all others to 0.