   Directx9 terrain vertex counts
  HiI'm using a height-map to generate a terrain mesh, but there are way too many vertices. Lets say the height-map is 512x512 pixels then the total number of vertex is = 512*512*2 = 524288 assuming each pixel counts for 1 square and 1 square is made out of 2 triangles.This many triangles really slows things down!!!!Is there any way to reduce the number of triangles without loosing too much detail, or even better is there a way to dynamically reduce the amount of triangles for terrain that is far way. Thus keeping a high triangle count for near terrain and a lower count for far terrain. Sorta like making the terrain's triangle count or detail a function of the distance away from the viewer's point of view / camera??? Any help will be greatly appreciated.Thanks   
  I never used it but you can create a lower quality versions of the terrain. Split the terrain into 16x16 parts, depending on the distance between camera and the terrain part, use the lower res models for the farther parts of the terrain.http://en.wikipedia.org/wiki/Level_of_detail   ;  Thx this is what i was looking for. I'll read more about this. If i don't get it working, I'll be back then to post more MUhahahaha. lol anyway thx for the advice   ;  also google CLOD, ROAM, geomipmapping. there are many level of detail methods.EDIT: Also, each pixel in a heightmap should be a vertex, not a quad. otherwise your terrain would end up being a bunch of quads of different heights, all parallel with the ZX plane. for a 512x 512 grid sized terrain you would need 513x513 sized heightmap.   ;  Burnt_Fyr what your are saying about not using quads makes a lot of sense. Thanks for the advice.   ;  Adding to what the others said :...and if you use Triangle strips would be a better idea as you would need N+2 vertices aka (512*512*1)+2 that is quite better.   ;Quote:Original post by feal87Adding to what the others said :...and if you use Triangle strips would be a better idea as you would need N+2 vertices aka (512*512*1)+2 that is quite better.If you render the whole terrain in one go, yes. However, GPUs these days are best optimised for rendering indexed triangle lists, so you'd probably be better overall to use an indexed triangle list for rendering - and making LOD'd data into triangle strips can be a pain in the ass.   ;Quote:Lets say the height-map is 512x512 pixels then the total number of  height values is 262144 Quote:assuming each pixel counts for 1 height value.To create a terrain mesh with 1:1 mapping of the height map, it results in 511*511*2 = 522242 triangles. If correctly implemented it shouldn't be any problem for any modern graphics processor. You should use indexed triangles lists (or strips) for drawing. This way, you'll need only 262144 vertices for drawing the 511x511 squares mesh. You may also want to check 'Geometry clipmaps' for efficient terrain rendering.Cheers![Edited by - kauna on May 9, 2010 12:58:18 PM];  Thanks to all of you who replied =)The reason why i'm saying 522242 is a lot, is because my frame rate has dropped 4 times. I used to get 400~500 FPS but with the terrain in i get +- 100 FPS. I am using a triangle list as well as an vertexIndexBuffer/verticeIndexBuffer. The main reason I made this thread is I wanna know how to load a large terrain in (much larger than 512x512 height-map) without overloading the GPU.The idea is I want a large map where the user can roam/explore/walk (or whatever) without having to render each and very detail in the map. I realized that if the map is flat and infinity large then at a certain distance the vertexes will be smaller than the size of one pixel thus these do not have to be rendered. And then on top of that the further the vertexes are the less will be needed to render a relatively good looking terrain.The type of answer i was looking for is the LoD techniques that shultays pointed out for me. And what Burnt_Fyr pointed out (CLOD, ROAM, geomipmapping). I would like to ask one last thing here: Is there any hardware implementations for the above mentioned techniques?Thanks again good people   ;Quote:Original post by KapoefThe reason why i'm saying 522242 is a lot, is because my frame rate has dropped 4 times. I used to get 400~500 FPS but with the terrain in i get +- 100 FPS. I am using a triangle list as well as an vertexIndexBuffer/verticeIndexBuffer. 400 FPS is 2.5ms per frame, 300 FPS is 3.3ms per frame - you're talking about a 0.8ms difference, which isn't really relevant. If you dropped from 110 FPS to 10 FPS, it'd be a bigger deal.How are you rendering your terrain? For best performance for a terrain that size, you'd probably be best using a static vertex and index buffer and drawing the entire terrain in a single DrawIndexedPrimitive() call.For larger terrains, you'll get better performance from using a LOD system, as others have said.   