Texture scale

i’ve been playing with the textures a bit and have run into a problem. i can’t seem to figure out how to scale the textures. is this possible? here’s my problem:

i am generating some terrain and using the procedural texture generator. when i build the terrain in my program it streches the image over the entire area. i would like to be able to make it tile or something so that when you are close to it it does’t look all pixelated. it would be fine in a flying game, but if you have a character wandering around on the ground. the terrain isn’t nearly clean looking.

Did you try using a detail texture? That will tile a single texture over your terrain.

well i have the texture detail set.

tb.setDetailTexture(1, 4);

but it doesn't seem to make any changes when i change the numbers (except crashing when i change the first one)

what am i missing?

4 is the number of times to repeat the texture across the entire terrain. So if the terrain is large you want that number to be large. Try something like 16 or 32 and you should see the difference it makes.

Also I think 1 is the texture unit. Also I think it may have to be a power of two, Im not certain though (ie 2 4 16 32 64 etc.)

texture unit should not be power of 2. Different graphics cards support different number of texture units. So, you can use multiple detail textures if you want.

0 - main texture unit (this is reserved for the main terrain texture).

1 - start of the extra texture units.

n - the maximum texture unit of the graphics card.

Typically, you’d only use one detail texture, but there may be cases when you want multiple detail textures at once.

the repeat value, should be in powers of two to tile properly.

BTW, I get best results when I generate a procedural texture that is SMALLER than the terrain with a decent number of detail texture repeats.

For instance, if I had a terrain of 512x512 I would make the texture 256x256 and set a detail texture with a repeat of at least 16.

You results may vary though, depending on what look you are going for.

well i tried a few things and couldn’t get it to work :frowning:

i decided to forget terrian for now and am just working with simple faces and trimeshes. still i can’t figure out how to get the texture to repeat

ie, i have a box where each face is size 128

the texture i am using is 64x64.

basically i want the texture to be repeated so on each face you should see the texture repeat 4 times.