• 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
Hawkblood

DX11 Hardware Voxel Terrain (your opinion)

11 posts in this topic

Now that I'm learning DX11, there are a few new options open to me using hardware (video card). I've been eyeing http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html and was wondering what experienced programmers think and know. My concerns are as follows:

-- how much control would I have during generation? What kinds of controls are there?

-- when the terrain is generated, how would I get info about the "height" of a specific location on the terrain?

-- could I implement LOD to this terrain? How?

 

Remember, I'm asking about DX11, not DX9.......

0

Share this post


Link to post
Share on other sites

Now that I'm learning DX11, there are a few new options open to me using hardware (video card). I've been eyeing http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html and was wondering what experienced programmers think and know. My concerns are as follows:

-- how much control would I have during generation? What kinds of controls are there?

-- when the terrain is generated, how would I get info about the "height" of a specific location on the terrain?

-- could I implement LOD to this terrain? How?

 

Remember, I'm asking about DX11, not DX9.......

 

 

How much control? Depends on your noise of course. You can do pretty amazing things with multiple noise steps and some pseudo randomly distributed precalculated models like e.g. trees. Youtube has some nice vids to that.

If you go for only perlin noise for example you have persistence, frequency, etc. as parameters to play with and your seed as a starting point.

 

When it is generated you dont need to know the info, do you? Otherwise: Voxelspace -> Worldspace calculations. 
 

LOD... Thats tricky. Its of course possible e.g. by means of the Trans Voxel Algorithm as proposed by Eric Langyel.

http://www.terathon.com/voxels/

But the topic is not as trivial as it should be. I am fiddling around with it, myself. :P

2

Share this post


Link to post
Share on other sites

Thanks for the reply. I'm looking at the link now. When I originally posted, I hadn't dealt with DX11 very long, so shaders in DX11 seemed too much like magic to me. I have a bit more understanding now, so I think the questions about control and getting the height are something I can get hold of..... For now, I'm going to soak up the knowledge in the link.

0

Share this post


Link to post
Share on other sites

Wow. What a mess of a file. When I clicked the link for the "lookup tables" it came out as a hot mess. Here is a more coherent format:TransVoxel.txt

 

EDIT: I originally placed it in a code fragment, but the page takes forever to load that way. So I uploaded it as a .txt file.

 

[Mod edit] The copyright holder of that file just asked for us to remove it, saying you don't have permission to be redistrubuting it

Edited by Hodgman
-1

Share this post


Link to post
Share on other sites

Well its a set of lookup tables. I guess its not that important that it is super-readable and it serves its purpose well as is. tongue.png

Edited by KuroSei
0

Share this post


Link to post
Share on other sites

After studying the file, I think it's mainly for voxel generation on the CPU. I'm wanting to know how to do it on the GPU (video card)..... I don't even know where to start with this. How do I *use* the GPU to generate and display the terrain?

 

I *think* I would have a shader (.vs and .ps) written up appropriately for this and what I would send as data is maybe texture(s), camera location, view matrix, projection matrix, and initially a "seed" value for the noise generator and then the GPU does the work of rendering what I "see"...... I don't know what I would need.

0

Share this post


Link to post
Share on other sites

It is indeed for generation on the CPU but i guess it still applies for the GPU.

Problematic with this approach is btw that you would need to implement a volumebased physicsengine or a physicapproach on the GPU that works with your extracted meshes etc.

Its hard to do, i think, if you need physics, that is.

 

But i didnt implement any of those algorithms on the GPU and i dont plan to, so i cant help that much with that. I just wanted to point you to some maybe helpful things :)

1

Share this post


Link to post
Share on other sites

Well, my implementation I did 2 years ago or so used only the basic marching cubes algorithm, and is by no means a reference on how to write good shaders (hehe) but what I did was to store the tables on the GPU, and then, for each terrain chunk to render, send a single integer to the vertex shader, which is interpreted as a bitfield that encodes one triangle of one cube in the chunk (so each integer corresponds to a unique triangle in the chunk). Then I ran the marching cubes algorithm in the vertex shader, which produced the set of triangles for this cube according to the density field (the seed and all that were uploaded in constant buffers) and selected the correct triangle based on the triangle index, and so it generated the terrain on the fly. So a lot of work was duplicated, but it ran on the GPU.

 

In later versions I made it so the terrain was generated only once in the geometry shader, without any wasted work, and also streamed back out to the CPU, so that I could manipulate it CPU-side as well (e.g. generate it as the player moves around and then potentially post-process) but then maybe a compute shader would be better-suited at that point. And I'm not sure it was faster. But it looked pretty decent with triplanar texturing (as in the GPU Gems article).

 

Anyway the basic idea is to set things up so that you can pass a set of cubes to the GPU (either implicitly or explicitly) and tell it to "sculpt" the terrain mesh for these cubes by running MC (or whatever variation you use) on it. From there, you can do plenty of optimizations, but that's beyond me as I didn't really study it in depth.

0

Share this post


Link to post
Share on other sites

Wow. What a mess of a file. When I clicked the link for the "lookup tables" it came out as a hot mess. Here is a more coherent format:attachicon.gifTransVoxel.txt

 

EDIT: I originally placed it in a code fragment, but the page takes forever to load that way. So I uploaded it as a .txt file.

 

The lookup tables are nicely formatted. If you're seeing a file that you wouldn't consider nicely formatted, then there's something on your end screwing it up. I suggest saving the file Transvoxel.cpp and opening it in Visual Studio.

0

Share this post


Link to post
Share on other sites


[Mod edit] The copyright holder of that file just asked for us to remove it, saying you don't have permission to be redistrubuting it

I didn't know it would be a problem as I posted ALL the code including the credits....

 


The lookup tables are nicely formatted. If you're seeing a file that you wouldn't consider nicely formatted, then there's something on your end screwing it up. I suggest saving the file Transvoxel.cpp and opening it in Visual Studio.

Sorry, didn't mean to step on your toes. I downloaded Transvoxel.cpp and opened it in VS2012. As I said it was a mess (in VS2012). Perhaps I have different settings, but for me to read it, I had to format it line by line because the file translated into a single line.

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