I wanna know how you render terrains in directx.
I have heard people saying that they are using RAW files and some said that they are using .x files. What is our wa开发者_如何学JAVAy and why is it good?Many 3D engines use height maps to render terrain, due to their space efficiency (only one raster image is required).
Well MY way of doing it is to compress a HUGE texture (128Kx128K) with my wavelet compression system to get ~150:1 compression. I then chunk load the texture from disk. ie the world is split up into multiple 256x256 chunks (Actually its kind of mipmapped with distance from the camera). I use the camera position to forward load a number of chunks around the camera position.
I then calculate the chunks that are visible and draw them. For this purpose I use the height data directly as a stream fed into my vertex shader. I then have a mesh where vertex positions correspond to the height positions in the height stream. I can then simply pull the y out of the heightmap stream and place it in the y position in my shader.
Its a pretty complex way of rendering terrain but you did ask how "you" do it ;)
PS the bonus of 128,000x128,000 is that I get 128km of terrain at meter accuracy :D
精彩评论