I’m currently thinking about how I can make raymarching much more efficient and that’s when I came up with the idea of spheremarching with signed distance fields. To do this, I would have to voxel my environment, store these voxels in a 3D texture, and store the shortest distance to the nearest triangle in each voxel.
Well, that’s not a problem, it’s all possible. The problem is that a 3D texture quickly becomes enormously large, and if I want to rasterize the environment with 0.25m voxels, a 512³ 3D texture only covers 128m. And if I move, I’d have to update the 3D texture accordingly. That’s 134.217.728 voxels. Even if I don’t need the height in 512, but only 256, that’s still a decent number.
By moving, I will only have to check the first level of voxels for new triangles, while for most other voxels I can simply shift through. Does anyone here have any experience with SDF grids in conjunction with open world?
That inspired me. Thanks, manthrax.
I’m now going to develop an octtree that subdivides itself according to the size of the bounding boxes of the objects in the world. Every empty octtree cell is skipped entirely and not voxeled at all, which saves a huge amount of memory and processing power. I can then voxel the octtree cells that contain geometry, and these voxels then contain SDF data for spheremarching. The octtree then becomes something like a cross between spatially-based BVH and object-based SDF. Since the bounding boxes are AABB, I think this works quite well with an octtree. I still need to think this through a little more, but I see a way forward now.
A BVH is object-specific. But that’s what gave me the idea of the octtree. I need something that captures the environment, not just an object. Testing the octtree for bounding boxes isn’t very complicated. The octtree can be used as a rough BVH for any object by further subdividing the octtree cells that contain geometry before voxelizing. Maybe all three make sense, octtree + BVH + SDF. I’ll have to see about that. I never thought raymarching could be so extensive, but I like it.
I wasn’t familiar with the game Teardown. Until now, I’ve only handled Raymarch in a very primitive way, as it was sufficient. Equipping the environment with advanced mechanisms like OctTree, BVH, and SDF is something new for me.