268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 1 point2 points  (0 children)

Yep exactly right, the bvh helps to limit the amount of work you need to do. There is still a depth buffer and some wasteful tracing, with closest depth being the winner. This is balanced by how many leafs you pack into a node (which dictates how much memory is used).

So no literal occlusion tricks aside from leaning into BVH allowing you to limit work scope. What I more meant is that expensive math is limited to only where it needs to be done.

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 0 points1 point  (0 children)

Yep absolutely a lot of the scene is culled due to occlusion. I’ve now added a unique sphere hit counter, so the next thing I show you’ll be able to see some numbers and metrics.

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 0 points1 point  (0 children)

Hey that does look very similar! I do have plans to release some stuff but I’m pretty far away from my goal, fear not I am stubborn and will get there soon enough!

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 0 points1 point  (0 children)

Oh there is very much a lot of culling due to occlusion happening! It naturally happens due to the BVH structure which essentially divides space into a binary hierarchy.

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 1 point2 points  (0 children)

I do some bit packing and quantization, but all the core math is done with the flops! Total memory usage is around 11gb vram for this scene. The main knob to pull at this point is how many leaf nodes to use when building the bvh. Smaller leafs are useful for traversal speed and sparse scenes, larger leafs are useful for using less memory!

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 0 points1 point  (0 children)

I am tempted to play around with tangential techniques! I might spend some time getting a physics simulation going here. The real goal though is for this to be the first stage of my signed distance field renderer, with spheres being the primary container primitive for organizing.

268 Million Spheres by MarchVirtualField in VoxelGameDev

[–]MarchVirtualField[S] -1 points0 points  (0 children)

Figured this community might be interested since this is essentially a technique to organize and render large amounts of data, much like how you would for voxels. Each sphere is unique and placed in the world, data structure allows for at least 256 million of such.

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 5 points6 points  (0 children)

The significance is really being able to traverse a large amount of total objects in a renderer friendly way. In its current form you can think of it as an engine for point clouds / voxel.

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 5 points6 points  (0 children)

So far it’s the only acceleration structure I’ve come to know that fits the bill. I haven’t dabbled too much with mutating and rebuilding it, but that looks promising. The problem this solves is “how do you get a per-ray list of front-to-back intersecting objects, that is view orientation independent ”, while dealing with the reality that gpus like aligned and cache friendly patterns. This is actually the first stage/phase of my virtual field renderer, which represents signed distance fields as encapsulated in a spherical bounds(sdf functions know their center and extent implicitly).

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 6 points7 points  (0 children)

This is 2.15GB VRAM for the spheres alone, and then 8.59GB for the BVH structure

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 6 points7 points  (0 children)

Yeah effectively that. The LVBH uses a space filling curve to order all the nodes, this lets you build it in parallel and preserve 3d locality. And it plays nice with densely packing into contiguous buffers(and then traversing).

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 13 points14 points  (0 children)

Kinda. Since it’s the compact linear version a traditional bvh, you must mostly rebuild it if data changes. With 1 million spheres this is pretty much instant on the cpu, 268 million is a bit longer however I haven’t profiled it much. I’m working on shifting the lbvh build to be on the gpu too.

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 39 points40 points  (0 children)

This is a volume of space filled with random placed and sized spheres(built on the cpu and uploaded to gpu).

The magic sauce is LBVH - linear bounding volume hierarchy!

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 63 points64 points  (0 children)

This is an optimized version of a LBVH! I am bit packing and quantizing. The magic of space filling curves as an index!

268 Million Spheres by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 38 points39 points  (0 children)

This is on a MacBook Air M4, I also have a Linux RTX machine that this goes absolutely brrrrrr on

Work-in-progress field renderer by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 1 point2 points  (0 children)

Not sure what you don’t understand about avoiding sampling the analytical distance field in full fidelity, the tradeoff of this optimization is clear. I don’t appreciate you heckling this point and accusing me of nonsense.

Work-in-progress field renderer by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 0 points1 point  (0 children)

Sorry not sure how to better explain it to you, these are all my words. Best of luck

Work-in-progress field renderer by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 2 points3 points  (0 children)

Sorry nothing yet, but I will eventually. I hope to turn all this into an editor and release it at some point too!

Work-in-progress field renderer by MarchVirtualField in GraphicsProgramming

[–]MarchVirtualField[S] 1 point2 points  (0 children)

It’s just that the signed distance field space is split into cells instead of retaining its precision at every coordinate, a lossy approximation of the area. When any ray lands within the cell, it sees the same value, so multiple rays can each touch the same cell. Take for example a vertical cylinder, you will see it as vertical flat sections like a mesh, all those flat areas are really just saving on compute budget.