Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


DX11 Hardware Voxel Terrain (your opinion)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 05 April 2014 - 07:35 AM

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.......



Sponsor:

#2 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 14 April 2014 - 10:05 AM

I would like some comments on this, so I'm bumping it to keep it alive......



#3 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 23 April 2014 - 02:08 PM

Still? No one? No comments what so ever?



#4 KuroSei   Members   -  Reputation: 324

Like
2Likes
Like

Posted 23 April 2014 - 02:52 PM

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



#5 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 24 April 2014 - 03:02 PM

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.



#6 Hawkblood   Members   -  Reputation: 723

Like
-1Likes
Like

Posted 24 April 2014 - 03:41 PM

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, 25 April 2014 - 10:13 PM.


#7 KuroSei   Members   -  Reputation: 324

Like
0Likes
Like

Posted 25 April 2014 - 01:51 PM

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, 25 April 2014 - 01:52 PM.


#8 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 25 April 2014 - 01:54 PM

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.



#9 KuroSei   Members   -  Reputation: 324

Like
1Likes
Like

Posted 25 April 2014 - 05:59 PM

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 :)



#10 Bacterius   Crossbones+   -  Reputation: 9066

Like
0Likes
Like

Posted 25 April 2014 - 09:04 PM

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.


The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#11 Eric Lengyel   Crossbones+   -  Reputation: 2392

Like
0Likes
Like

Posted 25 April 2014 - 09:40 PM

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.



#12 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 26 April 2014 - 05:26 PM


[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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS