Calculate normal from heightmap, at edge of heightmap

Started by
1 comment, last by Funkymunky 12 years, 11 months ago
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?
Advertisement

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?

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.
oh. nice! why didn't i think of that! here i was mucking with some special case nonsense instead of reworking the problem from the source.

thanks!

This topic is closed to new replies.

Advertisement