Jump to content

  • Log In with Google      Sign In   
  • Create Account

Heightmap Tiling - Aligning with multiple geometry fragments.

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

#1 PhillipHamlyn   Members   -  Reputation: 454


Posted 03 July 2014 - 06:43 AM



I've got a successul implementation of a terrain (using something similar to Geo Clip Mapping) but am slightly stuck when it comes to assigning the heightmap textures to a particular tile or clipmap region.


The GPU Gems papers on this aren't specific about how you render a "chopped up" heightmap onto the geometry - I have broken down my heightmap texture into lots of smaller tiles (256x256) with teach tile contributing to a coarser level tile, something like how a mip map works. When I come to render my geometry I can calculate how many tiles, and of what scale, I need to pass to the shader (along with the appropriate matrix to provide the UV coordinate mapping from the geometry to the heightmap).


My problem comes with the count of heightmap textures I would need to pass in - I'm using XNA4 so have a limited number of texture slots, and besides, using a lot of textures just for my heights seems a waste. I've tried making my geometry chunk boundaries (which dont have any T-junctions) align with the texture sizes (i.e. one texture of one specific size per geometry chunk) but I get sampling discontinuities along the borders between the geometry chunks - but this isnt my main area of ignorance ( I am thinking that to get accurate heightmap tesselation the heigthmap for any geometry chunk must cover more than that geometries footprint (i.e. the texture is slightly bigger than the surface area in world terms) to prevent edge-sampling artefacts )


I am missing something here - given that my geometry is static with respect to the camera, and just has its position translated to be camera centric, aligning my heighmap texture chunks with a  nominal geometry grid still will require me to pass in multiple heightmap texture chunks to a single geometry pass - this isn't what the examples indicate I should be doing. If this were the case I'd be seeing examples with dynamic texture creation to create geometry aligned heightmap textures, or some examples passing multiple heightmap textures to the shader (a maximum of four would be required to cover a single geometry pass - assuming the geometry aligns with none of the heightmap world locations exactly).


Can anyone give me a clue as to how to properly align my heightmap texture chunks with the geometry pass - do I need to dynamically create a single texture out of those which overlap my geometry (every pass :-( ) or is there some better way of doing this.