Sign in to follow this  
Funkymunky

Calculate normal from heightmap, at edge of heightmap

Recommended Posts

I have a streaming architecture that I use to page in textures for my terrain. For each clipmap LOD level, I have a 3x3 grid of 256x256 textures from which I sample. These get shuffled around as the player's position shifts. I render from these source textures to the clipmap levels, and I calculate the normals directly from the height data. I do this with a sobel type filter, which uses 9 taps from the source texture. The problem comes when I'm sampling the height data across the source texture edges. I get really dark/light lines in the texture which are clearly from where the source textures were sampled along the edge.

Does anyone have any tips for dealing with this? Is there a way to ignore the pixels that are sampled "over the edge" and still get good results?

Share this post


Link to post
Share on other sites
[quote name='Funkymunky' timestamp='1305862377' post='4813309']
I have a streaming architecture that I use to page in textures for my terrain. For each clipmap LOD level, I have a 3x3 grid of 256x256 textures from which I sample. These get shuffled around as the player's position shifts. I render from these source textures to the clipmap levels, and I calculate the normals directly from the height data. I do this with a sobel type filter, which uses 9 taps from the source texture. The problem comes when I'm sampling the height data across the source texture edges. I get really dark/light lines in the texture which are clearly from where the source textures were sampled along the edge.

Does anyone have any tips for dealing with this? Is there a way to ignore the pixels that are sampled "over the edge" and still get good results?
[/quote]
Try to overlap your textures: your source texture has a 4 texel border(4 texels to avoid dxt compression artifacts) which contains the texels from the according neighbour textures. This will reduce your effective texture size to 248x248.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this