Voxel disk operations?

Started by
8 comments, last by CC Ricers 9 years, 2 months ago

For a 2d voxel game, is it viable to store the procedurally generated mesh to file?

I know disk operations can be a bottleneck, but so can generated meshes on the fly. I'm wondering which generally has the least performance impact.

Minecraft saves a lot of data with its chunks but there is no mention of the actual meshes being saved afaik.

Advertisement


For a 2d voxel game

Can you enlighten as to the difference between 2D voxels and pixels?

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Minecraft doesn't save the meshes that the graphics client generates using the map-chunk data. Why should it, when it can re-generate it on demand, and in fact needs to every time the map-chunk is changed?

Generating a mesh from nice, clean data is trivial compared to serializing a mesh to and from disk.

RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.


For a 2d voxel game

Can you enlighten as to the difference between 2D voxels and pixels?

My interpretation would be a voxel has volume and a pixel is more of a point. A 2D voxel is one that exists in 2D space, so a 2D volume.


Generating a mesh from nice, clean data is trivial compared to serializing a mesh to and from disk.

Thank you for your answer.


For a 2d voxel game

Can you enlighten as to the difference between 2D voxels and pixels?

My interpretation would be a voxel has volume and a pixel is more of a point. A 2D voxel is one that exists in 2D space, so a 2D volume.

Two dimensional space does not have concept for volume. Do you mean area?


For a 2d voxel game

Can you enlighten as to the difference between 2D voxels and pixels?

My interpretation would be a voxel has volume and a pixel is more of a point. A 2D voxel is one that exists in 2D space, so a 2D volume.

Two dimensional space does not have concept for volume. Do you mean area?

Yes, area would be more accurate.

I do have one argument FOR storing mesh data on disk. I assume your mesh data is designed to be compact (perhaps using single bytes for coords, expanded in shaders, and so on).

Levels of detail. If you were to save meshes to disk, including levels of detail, you could quickly load the low LoDs for distant chunks, without having to load the expensive chunk data!

With the normal approach, you have two options for LoDs:

A) Load the full chunk, generate low detail mesh (theres TONS of distant chunks and chunks are not cheap to load and process so this is really slow)

B) Load low LoD of the actual chunk data and use that to generate the low detail mesh. The problem with this is that the mesh will probably not be as pretty as it could.

If you actually save the mesh and the LoDs to disk, you can generate the low detail meshes from the full chunk data to get the best quality, and then later you only need to load the low detail mesh to quickly render distant chunks.

It might make sense to store the low detail meshes separately from their chunks somehow, so you dont end up loading data you dont need if its all in a big blob (dont know how this stuff works)

SSDs getting more popular increase the advantages of this approach.

The high detail meshes should still probably be generated on the fly because you already have the chunk data loaded with high probability. But again, if you dont need to load the chunk data itself, loading just the mesh could be better (since the mesh only contains the visible surface, it could be more compact. Not necessarily though.)

o3o

I think you don't need the mesh for LOD either - just store the LOD'd voxels (kind of like mipmaps, I guess).

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

How large are these "collection of 2d voxels" (images)? Depending on your platform, memory might be super massive compared to your data structures. You may very well be trying to solve a non-problem.

Loading just the meshes would be ideal as it keeps the minimum surface data, and especially if you can store it in a small vertex structure. The meshes in my voxel game use 8 bytes per vertex but that is partly because they are texture-less. One 4-byte integer stores X,Y, and Z coordinates in local space plus some shading metadata, and another integer stores RGB color components plus more data such as surface normals.

If you can pre-load the meshes from disk, you would only need to re-generate the most necessary raw voxel data and forego the extra steps of creating the meshes from the voxels.

New game in progress: Project SeedWorld

My development blog: Electronic Meteor

This topic is closed to new replies.

Advertisement