Texturing my terrain

Blitz3D Forums/Blitz3D Programming/Texturing my terrain

The problems with your way of texturing the terrain come from our old friends 'Bilinear Filtering' and 'MipMapping'.

I can understand what you are doing, you want several different tile textures but only want to use a single surface for your terrain.

Clamping the texture won't work as this clamps to 0.0 and 1.0 texture coordinates whereas you aren't using the whole of the 0.0 to 1.0 range.

There are 2 things you can do to reduce this effect.

The first is to bring your texture coordinates inwards, away from the edges of your texture.

AddVertex tt\surf,x+cenx#,y+ceny#,0,0.1,0.1,0                         
AddVertex tt\surf,x+cenx#,(y+1.0)+ceny#,0,0.1,0.4,0 
AddVertex tt\surf,(x+1.0)+cenx#,(y+1.0)+ceny#,0,0.4,0.4,0
AddVertex tt\surf,(x+1.0)+cenx#,y+ceny#,0,0.4,0.1,0


This will reduce the artifacts which come from running out of pixels to filter at the edges of your texture.

This will improve things but you will still get errors the further away from the camera the terrain is.

The only solution to that I believe is to turn off mipmapping but that isn't very desireable imo.

Other than that just use multiple surfaces to get the required result...depends on how many different surfaces you want to have I suppose.