Hi, have issue setting texture repeat values to have my box looking good. Not sure what I’m missing.
final Box floor = new Box(15, 1, 1);
final Texture floorTexture = this.assetManager.loadTexture("Textures/grass/grass-color-1_512x512.jpg");
floor.scaleTextureCoordinates(new Vector2f(10, 1));
final Material floorMat = new Material(this.assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
final Geometry floorGeom = new Geometry("Floor", floor);
floorGeom.move(new Vector3f(posX, posY, 0));
As you can see on the image, front and back are ok but anything else is repeating the texture.
What would be the right way to set texture wrap mode and texture coords values.
Or should I create individual boxes one next to each other?
For every texture coordinate, multiply u by 10 and v by 1. So for every different side, the horizontal part will be repeated 10 times and the vertical part will be repeated 1 time. Which is what you want only on one face.
Either look into the box class and figure out how reset the texture coordinates for each side to what you want… or create 6 different quads in the arrangement of a box and set each of those… or create a custom mesh where each side is exactly the way you want it.
…or make the box in blender.
Those are your options. We don’t know what you are actually trying to do so that’s the best advice I can give. The answer for “I’m trying to make a block world game” will be substantially different than the one for “I just need a floating island for my characters to run on”
I see. Thanks a lot for the details and diff alternatives. Was curious on how to get proper textured rectangular prism (I think it is also called cuboid in english) using the Box class.
No block world game . Just playing a bit with random things.