Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to generate the elevation maps for GPU based geometry clipmaps?


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
14 replies to this topic

#1 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 09 June 2012 - 11:59 AM

The lowest (coarsest) elevation map is simply the height map, right? What about the finer levels? How do i create their elevation maps?
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

Sponsor:

#2 smasherprog   Members   -  Reputation: 432

Like
0Likes
Like

Posted 09 June 2012 - 01:46 PM

Use mipmaping. Create your heightmap as a texture on the gpu, and make sure the gpu generates mipmaps for it. Then, when you are sampling the heightmap, you have mipmaps to give you coarse or fine grained results.
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

#3 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 09 June 2012 - 02:16 PM

Use mipmaping. Create your heightmap as a texture on the gpu, and make sure the gpu generates mipmaps for it. Then, when you are sampling the heightmap, you have mipmaps to give you coarse or fine grained results.


But, aren't mipmaps by definition smaller and at a lower resolution than the original texture? How can they represent finer levels?
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

#4 Waterlimon   Crossbones+   -  Reputation: 2456

Like
0Likes
Like

Posted 09 June 2012 - 03:54 PM

Do you even need mipmaps for that? Doesnt it automatically interpolate it when youre checking a point on the texture?

o3o


#5 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 10 June 2012 - 11:24 AM

Also, in the paper they keep saying "toroidal access". What does that mean?
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

#6 Waterlimon   Crossbones+   -  Reputation: 2456

Like
0Likes
Like

Posted 10 June 2012 - 11:26 AM

Not sure, but i think that means that if you go over a border, it ends up at the opposite border.

o3o


#7 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 10 June 2012 - 11:34 AM

Yeah, that makes sense.

Well i still don't know how to obtain the elevation maps for each level. In the paper they talk about synthesis and decompression.. But then how does the mipmapping fit into this... I'm so confused!!!

Someone please explain all of this to me...
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

#8 L. Spiro   Crossbones+   -  Reputation: 13168

Like
2Likes
Like

Posted 11 June 2012 - 08:25 AM

The lowest (coarsest) elevation map is simply the height map, right? What about the finer levels? How do i create their elevation maps?

Your terms are confused. “Coarse” means “rough and without detail” while “fine” means “with detail”. Course is the far set of the terrain and fine is the single mesh that is right beneath you with the highest level of detail.


But, aren't mipmaps by definition smaller and at a lower resolution than the original texture? How can they represent finer levels?

Each mipmap is the next coarser level.


Also, in the paper they keep saying "toroidal access". What does that mean?

It means as the heightmap texture is being modified on the GPU, anything the falls off one edge wraps to the opposite edge, and as such when you are accessing the heightmap texture you need to do the same. Trivial with the repeat wrap mode.


Yeah, that makes sense.

Well i still don't know how to obtain the elevation maps for each level. In the paper they talk about synthesis and decompression.. But then how does the mipmapping fit into this... I'm so confused!!!

Someone please explain all of this to me...

http://research.microsoft.com/en-us/um/people/hoppe/gpugcm.pdf

The 2.4.1 Upsampling section is talking about artificially generating even finer levels of detail and is used by the 2.3.5 The Vertex Shader section for interpolating between levels. For your basic implementation you don’t need to worry about this yet. It is designed to prevent holes between the rings, which is something you should handle after you have a working prototype.

Figure 2-1.
Each level of the pyramid represents a different mipmap level of the heightmap texture. Each ring reads from its own mipmap level. It is possible for you to use only one level (no mipmaps) but using mipmaps allows you better filtering potential (better interpolation between points) and reduces texture reads.

The 2.4.2 Residuals section is just talking about adding extra detail. It is optional and you should ignore it until you have a working prototype.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#9 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 11 June 2012 - 08:57 AM

Thanks for your reply Posted Image

1) What does the original heightmap represent? The finest level?

2) I still don't know how to obtain the elevation maps. Maybe you mentioned it and i'm too dumb to follow :|. Let's say i have a 1024x1024 heightmap. If this is the finest level (question 1), how do i obtain the mipmaps that represent the coarser levels?

3) From my understanding, all rings have equal number of vertices, just at different spacing. But the vertex textures holding the height data are of different resolutions, right? What am i missing here?

I'm sorry but i just don't understand the concept itself, even after reading the paper twice.

Edited by Waaayoff, 11 June 2012 - 08:58 AM.

"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

#10 L. Spiro   Crossbones+   -  Reputation: 13168

Like
1Likes
Like

Posted 11 June 2012 - 12:49 PM

  • Yes.
  • Treat it as a texture and do basic mipmapping. It is a texture with mipmaps. Nothing more. tex2Dlod() allows you read any of the mipmaps you want.
  • If you have an image that is 512×512 and you read pixels from [0, 0] to [10. 10], and if you assume each pixel represents 1 meter, then you just read 10 meters by 10 meters in world space. Assume you wanted to do the same thing but with the same image shrunken in half. The image is the same image as before but now it is scaled down to 256×256 (this is a mipmap). That means every pixel in the image is now 2 meters instead of 1. We are still going to read from [0, 0] to [10, 10], but if the vertex locations are still the same then we just packed 20 meters by 20 meters into the same space. This is wrong, and to fix it we have to double the distance between vertices. This is why the rings double in size each time while the source texture halves each time.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#11 Waaayoff   Members   -  Reputation: 781

Like
1Likes
Like

Posted 11 June 2012 - 01:03 PM

Thanks!

I re-read the article after your answers and now it all makes sense Posted Image

Edit: If anyone's interested, i also found this article to be helpful:

Edited by Waaayoff, 12 June 2012 - 07:55 AM.

"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

#12 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 15 June 2012 - 01:11 PM

Ok i have another question.

To update the clipmap, i need a residual texture containing the heights which i obtain from the original compressed heightmap. Right? So does that mean that i have to update a dozen textures (one for each level) by decompressing the heightmap and its mipmaps, and then send the textures to the gpu to be sampled by the clipmap?

If so, how big should those textures be? Same size as clipmap?
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

#13 L. Spiro   Crossbones+   -  Reputation: 13168

Like
0Likes
Like

Posted 16 June 2012 - 09:10 PM

That may be one way to go about it. You may want to test if it is faster to update each level independently or to generate mipmaps after updating only the highest level (I suspect it may be faster to just update everything manually).

They should be the same size as their respective source textures.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#14 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 18 June 2012 - 03:56 AM

About the residuals, what is the point of using a filter to predict the finer levels and then using a residual texture to correct the prediction? Why not just read the true data? You're already sampling a texture, might just as well be the heightmap itself.
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

#15 L. Spiro   Crossbones+   -  Reputation: 13168

Like
1Likes
Like

Posted 18 June 2012 - 07:29 AM

They were trying to avoid extra texture reads in vertex shaders which were expensive at the time of that document’s writing (2004). These days that is no longer the case and you may decide to just add more fetches.


L. Spiro

Edited by L. Spiro, 18 June 2012 - 07:30 AM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums




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