#DOTS Voxel project redux

1 messages · Page 1 of 1 (latest)

timid crescent
#

I'm attempting to create a performant voxel system. To do this I mainly use the job system in tandem with DOTS.

The main system feature is variable size chunks. A chunk has both dimensions and bounds variables. Dimensions is an int3 type determining the amount of voxels contained within the bounds. It can be any size, provided it doesn't exceed 2^18.

Currently, generating a 64x64x64 chunk takes somewhere between 9-10ms. (Creating voxel data 6-7ms, meshing 2-3ms). I would like to bring this at least down to around 4ms total.

The next step is player editing.

granite elm
#

breddddy good

timid crescent
#

"Faking" voxel density/texture by adding noise at regular intervals along the UV-coordinates.

timid crescent
timid crescent
timid crescent
granite elm
#

some type of stencil/depth masking?

timid crescent
#

I'm not quite sure what you mean?

granite elm
timid crescent
#

Yup, rebuilding every frame

timid crescent
timid crescent
#

Using the cutout mask to create LOD levels with a 2-by-2 super-chunk in the central "playable area"

timid crescent
timid crescent
#

First decent result tessellating the ground with LODs.

timid crescent
fierce crescent
#

Very cool, following

late loom
timid crescent
granite elm
#

Pretty good performance. How is everything being culled out of view? Is it by individual super chunks?

timid crescent
#

Each chunk within a super-chunk is subject to frustrum culling.

#

Here I have 16 LOD subdivisions (meaning 16 super-chunks)
Each super-chunk spawning 5x5x5 chunks (125 chunks)
Each chunk containing an upper limit of 64x64x64 voxels (262144 voxels)

If I did everything naively, I would need to generate noise data for 524.288.000 voxels

#

to generate the entire world.

timid crescent
timid crescent
timid crescent
tranquil reef
#

hello
how do you render a quad with a single triangle ? 🤔

timid crescent
#

By stretching the triangle, such that the quad is completely covered. You then discard the excess in the fragment shader.

The isosceles right triangle produces the least possible overdraw.

#

Here's the triangle:

#

Once alpha clipped:

tranquil reef
#

oh, i did'nt even know we can do it like that.
You apply "specials" uv to the triangle to know where to cut ?
It's a really good idea 🙂

timid crescent
#

Yes, quite simply:

late loom
timid crescent
# late loom Noob question, What is chunk and superchunk?

Superchunk is a term specific to my system, it's just a wrapper that manages its own set of chunks. 'Super' – of a higher kind, relating to classificatory divisions.

A chunk is just a collection of data. This data is then what we use to represent our voxels.

timid crescent
novel plinth
#

This is amazing. Nice work!

timid crescent
#

Not much work has been done in the past few weeks. I'm working on improving superchunk generation speeds. Now I do a preliminary test to check whether a chunk sits on the boundary of the noise function. If not, don't update the chunk at all.

While I'm no longer as bogged down by empty chunks sampling the noise function hundreds of thousands of times for naught, this does leave a paper trail of chunks that refuse to update themselves out of existence.

timid crescent
#

Quick post to show that I'm still alive

#

A quick update of the biggest changes:

  • I'm now supporting chunk sizes up to 2^25 (for example - 256x512x256, 512x128x512)
  • Improved chunk generation speeds. (roughly 16x performance increase)
  • Previous - 5000ms | 512x32x512.
  • Current - 300ms | 512x32x512
timid crescent
late loom
#

Masterpiece

timid crescent
#

My laptop is chugging through a massive amount of triangles

jade sonnet
#

to break past the polycount barrier, you could send draw point commands for distant voxels.

#

awesome work. you kept going

willow shuttle
#

Impressive!

fierce crescent
#

amazing

stoic hollow
#

This looks amazing. Wondering if you are still working on it and if there are any new updates?

timid crescent
#

Here is a single chunk with this new approach, rendering 8192x64x8192 voxels (around 4.3 billion) at 80 FPS. Enabling shadows yields 30FPS

#

Of course, this is only the first step. There's a lot of optimization that can be done here.

  • Enabling LOD would boost performance significantly, with the added benefit of probably solving the Moiré patterns in distant voxels.
  • Right now every single voxel is rendered, even voxels completely covered on all faces. Even empty voxels are technically rendered (although discarded in the fragment).
timid crescent
#

It is surprisingly scalable. Here is a chunk of size 16384x64x16384 (17 billion voxels) running at 40-50 FPS on my machine. It did take around 3 minutes to create the chunk (without Burst or multithreading)

Also, a rudimentary LOD system is in place in the shader. Although it doesn't help performance much, as actual geometry is not being removed yet.

timid crescent
#

This system works by rendering from the bits of a structuredBuffer. This is the reason the height limit is 64 - I'm using a ulong to represent voxels in the Y-axis. This saves a lot of time building the chunk and saves on memory cost.

It should be trivial to make a separate shader that instead reads from a 3-dimensional structuredBuffer. Enabling both arbitrary height limits, as well as voxel types.

timid crescent
#

Each individual voxel can now have any kind of data associated with them. Here is a 512x32x512 chunk of voxels, rendered at 300fps, with (and without) LOD, where color data is fetched by a look-up table.

timid crescent
#

I'm now filling chunk data using a compute buffer, making it orders of magnitude faster to create a chunk. This 1200x240x1800 chunk was created in 86 milliseconds

timid crescent
#

Found the cause of the white lines along the edges - mip maps

timid crescent
timid crescent
timid crescent
timid crescent
#

Finally managed to fix the voxels not using both X and Y coordinates to sample the texture

timid crescent
#

DOTS Voxel project redux

stoic hollow
#

This is amazing work! I do have a question. I'm not too versed in compute shaders. But does it essentially draw the voxels straight in gpu without having to create a mesh?

timid crescent