🔒 Locked
GPU-based terrain rendering
Advertisement
Original Post
Hi! I just studied the Article of Hoppe where he creates terrain mainly in the GPU. I think I understood pretty much of what he says, but now im stuck.. I got the all the blocks and i placed them, but then he says, that he uses one vertex texture for each level. I dont really know why, and whats the difference between the textures.. Thx for answers
They use textures to store the heights in order to minimize the storage requirements for the terrain and reduce bandwidth between the CPU and GPU. The geometry is assembled on the GPU in a vertex program, vertex (x,z) is input and the vertex program then fetches y (the height) from the textures.
The heightmap is stored as a Mipmap - a set of n images. The set of images contains several representation of the texture, in different resolution. The most detailed image (highest resolution) is referred to as level 0, the least detailed (lowest resolution) as level n-1. The difference between mipmap with level (i) and level (i+1), is that level (i+1) is a pre-filtered ("down-sized") version of level (i). For more on information, look up Mipmaps on Wikipedia or in Lance Williams' classical paper "Pyramidal parametrics".
When reading this article, please note that Asirvatham/Hoppe refers to these levels in the opposite order (least detailed, is level 0). This may avoid some confussion.
For this question on Geometry Clipmap, and your other question on how to texture a very large heightmap, I suggest you look at the original Clipmap Texture by Tanner (as Asirvatham/Hoppe also refers to). It explains some things that your paper doesn't talk about (take for granted). The Clipmap Texture can solve both your problems. For help on implementing a Clipmap Texture you can read my paper mentioned in "http://www.gamedev.net/community/forums/topic.asp?topic_id=504549" (you can find several papers on the Clipmap in the references in Chapter 4).
If you want an easier solution, I suggest you look into Chunked LOD and apply several texture layers procedurally (e.g. from elevation/slope) in a shader program.
If you can give more details to exactly what you want to achieve and what tradeoffs you're willing to make, it is easier to recommened an approach :)
[Edited by - ndhb on August 29, 2008 7:38:20 AM]
The heightmap is stored as a Mipmap - a set of n images. The set of images contains several representation of the texture, in different resolution. The most detailed image (highest resolution) is referred to as level 0, the least detailed (lowest resolution) as level n-1. The difference between mipmap with level (i) and level (i+1), is that level (i+1) is a pre-filtered ("down-sized") version of level (i). For more on information, look up Mipmaps on Wikipedia or in Lance Williams' classical paper "Pyramidal parametrics".
When reading this article, please note that Asirvatham/Hoppe refers to these levels in the opposite order (least detailed, is level 0). This may avoid some confussion.
For this question on Geometry Clipmap, and your other question on how to texture a very large heightmap, I suggest you look at the original Clipmap Texture by Tanner (as Asirvatham/Hoppe also refers to). It explains some things that your paper doesn't talk about (take for granted). The Clipmap Texture can solve both your problems. For help on implementing a Clipmap Texture you can read my paper mentioned in "http://www.gamedev.net/community/forums/topic.asp?topic_id=504549" (you can find several papers on the Clipmap in the references in Chapter 4).
If you want an easier solution, I suggest you look into Chunked LOD and apply several texture layers procedurally (e.g. from elevation/slope) in a shader program.
If you can give more details to exactly what you want to achieve and what tradeoffs you're willing to make, it is easier to recommened an approach :)
[Edited by - ndhb on August 29, 2008 7:38:20 AM]
I read Hoppe's articles, his method looks good for what i need. Im not that far along yet that im actually implementing it, but im intrested anyway.
hmm.. i tried to use mipmaps (setting the MipLevels while loading to numlevels and setting the current level in the shader) but i dont think that was it..
I dont really know how i should implement those mipmaps..
I got one heightmap of the size 1024x1024 px
Its no problem to set the heights at the shader, but as moving the heights change and i got a strange flickering as the resolution at the corse levels dont fit (i think thats why we use mipmaps :P)
but how can i make these "corser" textures?
I dont really know how i should implement those mipmaps..
I got one heightmap of the size 1024x1024 px
Its no problem to set the heights at the shader, but as moving the heights change and i got a strange flickering as the resolution at the corse levels dont fit (i think thats why we use mipmaps :P)
but how can i make these "corser" textures?
Hey. You need to make a better effort understanding the fundamental concepts before implementing this, relatively, complex approach to terrain rendering (Geometry Clipmaps). As you read through the paper, you realize it talks about "clipmaps" which again depends on you understanding "mipmaps, mipmap chains, texture filtering, aliasing" and so on. Once you understand all the concepts mentioned in the paper, you can move on to learning how to actually implement them, or learn how to realize them in your graphics API (OpenGL/D3D).
The coarser textures are the higher levels in your mipmap chain. In OpenGL you can either supply your mipmap chain (using whatever filter you prefer on the base level) or have the API create the chain with a box-filter. There are several ways to create a mipmap chain in OpenGL. The easiest is probably to use the parameter GL_GENERATE_MIPMAP with the function glTexParameter (see http://www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml).
The coarser textures are the higher levels in your mipmap chain. In OpenGL you can either supply your mipmap chain (using whatever filter you prefer on the base level) or have the API create the chain with a box-filter. There are several ways to create a mipmap chain in OpenGL. The easiest is probably to use the parameter GL_GENERATE_MIPMAP with the function glTexParameter (see http://www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml).
ok, i think i now do know what mipmaps are and i think i know why i need them even for my elevation data.
I was searching for ways creating mipmaps in dx.
I often read of automatically generated mipmaps, but i never found example code..
I'm using this function for loading the texture:
D3DXCreateTextureFromFileEx(
renderer->Device,
Dateiname,
D3DX_DEFAULT,
D3DX_DEFAULT,
levels,
0,
D3DFMT_UNKNOWN,
Pool,
D3DX_FILTER_POINT,
D3DX_FILTER_POINT,
0,
NULL,
NULL,
&t);
and at the vertex-shader i set the mipmap level to the current level, but there is still something missing..
I was searching for ways creating mipmaps in dx.
I often read of automatically generated mipmaps, but i never found example code..
I'm using this function for loading the texture:
D3DXCreateTextureFromFileEx(
renderer->Device,
Dateiname,
D3DX_DEFAULT,
D3DX_DEFAULT,
levels,
0,
D3DFMT_UNKNOWN,
Pool,
D3DX_FILTER_POINT,
D3DX_FILTER_POINT,
0,
NULL,
NULL,
&t);
and at the vertex-shader i set the mipmap level to the current level, but there is still something missing..
I don't know D3D at all but looking at "http://msdn.microsoft.com/en-us/library/bb172802(VS.85).aspx" seems to suggest that a mipmap chain is created for you when you set the mipLevels argument to D3DX_DEFAULT. Maybe you want to look at a tutorial on texturing in 3D3 or ask people in "DirectX and XNA" forum :)
The geoclipmaps on GPU dont have anything to do with graphical mip-maps. You can use one texture for each clipmap level or merge all textures in one in sense of tiling. I tried implementing it too, but I got stuck on my graphic card's un-suport of vertex texture fetch even if it says it supports Shaders 3.0 (crappy mobility ATI X1400). You sound like someone who doesnt realy understand how graphics or geoclipmaps really work. Try studying it little more before you try somethig complicated like this.
i really try to study it but everytime i search for explanations i end at Lsassos and Hoppes paper.. but i don't really like it as i cant follow it from the beginning :(
is there any more noob-friendly paper, or something i can start reading with so i understand geometry clipmapping?
is there any more noob-friendly paper, or something i can start reading with so i understand geometry clipmapping?
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement