How to scale a texture down

I have a question: how do you scale a texture down? I have a flat object, that I have made a texture for, and would like the texture to be small and have it repeat. I have made the code that tells the texture to repeat, but the texture takes up the entire object. How do you scale the texture down so it doesn’t take up the entire object? I have run into a similar problem with terrain, and was wondering how to scale a texture down on terrain, because even with a texture scale of one, the texture is way to big, as pixels take up entire fields.

you propably tried use wrap yes?

for mesh you use:


on box you can use it on start:




prototype for a whole node/spatial


public void setTextureScale(Spatial spatial, Vector2f vector) {

if (spatial instanceof Node) {

Node findingnode = (Node) spatial;

for (int i = 0; i < findingnode.getQuantity(); i++) {

Spatial child = findingnode.getChild(i);

setTextureScale(child, vector);


} else if (spatial instanceof Geometry) {

((Geometry) spatial).getMesh().scaleTextureCoordinates(vector);




terrain textures you scale on initializing step like DiffuseMap_0_scale here:


mat_terrain.setTexture(“DiffuseMap”, tex1);

mat_terrain.setFloat(“DiffuseMap_0_scale”, 64f);

mat_terrain.setTexture(“DiffuseMap_1”, tex2);

mat_terrain.setFloat(“DiffuseMap_1_scale”, 32f);

mat_terrain.setTexture(“DiffuseMap_2”, tex3);

mat_terrain.setFloat(“DiffuseMap_2_scale”, 16f);



if you want to scale texture by “pixels” then you propably should just scale image before use it as texture

and i don’t know any solution for scaling like you said.

You can try calculate model bounding and calculate image pixels and then calcutate value for scaletexturecoordinates…

but then you should prepare your own pixel mapping in the 3d world