• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Gumgo

Voxel "chunk" storage

5 posts in this topic

I'm attempting to write a density voxel system using marching cubes for terrain. For large scenes, each N by N by N (N = 64 for example) of the scene should correspond to a "chunk" of voxels, and there should be a way to query each "chunk" individually (e.g. each chunk has a file on disk, or you generate a single chunk at a time).

My issue is the following: in games like MineCraft where the voxels are cubes, N by N by N voxels actually contains (and completely defines) exactly N by N by N units of space. However, in systems where a mesh is extracted, it actually takes 8 voxels (centered on corners of a cube) to define a "patch" of the mesh. This means that to completely generate the region of N by N by N voxels, (N+1) by (N+1) by (N+1) voxels are actually required. This means that if each chunk is stored/generated in isolation, there is a duplicated row (or rather, "slice") of voxels stored. Furthermore, it is nice to use a power of 2 for N since it works well with LOD data structures (e.g. chunked-LOD) or octrees. However, this means that the actual stored voxel volume won't be a power of 2, and won't have nice cache alignment properties. It also means that updating voxels isn't as simple - you might need to update the data in multiple places - potentially in up to 8 chunks if it's a corner!

Actually though, the problem doesn't stop there - to generate smooth normals for lighting, you need to examine the surrounding voxel density values, so you actually need an extra row of voxels on each edge - this means you actually need (N + 3)^3 voxels!

A few possible approaches I've thought about:
1) Just deal with the extra storage. I really don't like this solution though, it seems messy and probably slow.
2) Require that 3x3x3 chunks be present in memory before generating the center chunk. I don't really like this though because it seems very wasteful and adds weird dependencies between chunks that shouldn't be there.
3) When generating the mesh for a chunk, leave off a row - that is, only generate a mesh filling (N-1)^3 units of space. When there are two adjacent chunks present, generate the strip connecting them separately.

I think solution 3 is the best, and it also allows for LOD stitching between chunks to be handled very nicely, since if one of the chunk's LOD level changes, only the strips connecting chunks need to be regenerated, and algorithms like [url="http://www.terathon.com/voxels/"]http://www.terathon.com/voxels/[/url] could be easily implemented. However, [b]it still does not solve the problem of needing an extra row of voxels for normal generation![/b] I can think of 2 possible solutions for this: either regenerate the normals on the edges of meshes when the adjacent chunk is loaded, or make the connecting "strips" 3 units wide instead of 1 unit wide, and just leave off an extra strip from the "main" chunk meshes. Neither of these seem that good though: the first solution would require re-uploading the entire mesh, or portions of the mesh, to the GPU, and would require keeping track of which vertices need to have their normals recomputed; in the second solution, an "isolated" chunk would be smaller in size, and the size of the strips connecting chunks would be larger and take longer to generate, but this seems like the better of the two.

So, how is this usually handled? Is solution 3 the way to go? And how are normals dealt with?
2

Share this post


Link to post
Share on other sites
I use solution 2 with fixed-size chunks of 16x16x16 voxels. Each chunk is independently stored in a compressed form, and 3x3x3 chunks are decompressed whenever the center chunk needs to be polygonalized. I don't really think there's anything weird about it. Sure, it's not an absolutely optimal use of memory, but we're only talking about 108 kB here for 27 chunks with one byte per voxel, and it gets the job done in a very practical way without having to worry about data availability at the center chunk's boundaries.
1

Share this post


Link to post
Share on other sites
Thanks for the replies. PolyVox, that is a good idea. I am thinking about doing something similar, where I have an underlying voxel manager that works at the "chunk" level, and on top of that a voxel renderer which makes requests to load regions of voxels and allows the voxel manager to decide which chunks those are.

Eric Lengyel - you're right, 16x16x16 doesn't sound too bad; I was thinking about chunks as being larger, but perhaps that isn't optimal (though obviously that's up to profiling to decide). My idea was actually to have a mipmap/chunked-LOD system, where a single mipmap pyramid would correspond to a single chunk (my reasoning for larger chunks). But maybe smaller chunks would work with this as well (the lower detail levels would just span multiple chunks). Are you using a LOD system?
0

Share this post


Link to post
Share on other sites
[quote name='Gumgo' timestamp='1336503383' post='4938457']Are you using a LOD system?[/quote]

You already mentioned my web page on the topic:

[url="http://www.terathon.com/voxels/"]http://www.terathon.com/voxels/[/url]
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0