New answers tagged

1

I later looked up an implementation of this algorithm so I could do it on another thread, I didn't even know it existed and it is actually fairly simple! My implementation still uses a Unity function Plane.GetSide(point) but it's thread safe. It just tells you if a point is on the positive side of a plane. foreach (plane in frustumPlanes) { ...


0

I haven't built a voxel game before, so this is theoretical, but I think this is a good starting direction: Unity has a function GeometryUtility.TestPlanesAABB() that can be used to check if a bounding box is inside or overlapping a plane array. One of the main uses for this is in determining what is within the camera's view frustum and thus potentially ...


1

To find the surface normal for any given marched cube, just average the face normals for all of the 1-5 triangles that are generated. A face normal is calculated here: for (vector<triangle>::const_iterator i = triangles.begin(); i != triangles.end(); i++) { // Get face normal. vertex_3 v0 = i->vertex[1] - i->vertex[0]; vertex_3 v1 = i-...


0

I ended up taking the volume outside point normal and inside point normal and doing a lerp between them, where the lerp value is density float. This is how I get normals from SDF while creating volume gird: float H = 0.001; float dx = sdfFunc(Vector3(xPos + H, yPos, zPos)) - sdfFunc(Vector3(xPos - H, yPos, zPos)); float dy = sdfFunc(Vector3(xPos, yPos + H, ...


Top 50 recent answers are included