Tiling textures congruently across geometries of different sizes

Hi, I’m creating my world procedurally using geometries, and I want to avoid this:

I want the walls/floors to span across the room without being cut and stretched.
The picture is using WrapMode.Repeat and scaled 2 times.

I guess a possible way to do it is to calculate the proportion and set scaleTextureCoordinates() for each Quad independently, although I’m not sure about the necessary offset.
Also this isn’t going to be a blocky game, so the sizes are not a integer multiplication of a fixed unit.

Is there an out of the box solution or standard technique for this?

Thanks.

You will have to set the texture coordinates yourself. There is no other built in way (and indeed to cover all cases there would have to be a few thousand built in ways… so…)

Ok, Thanks! I’ll do it that way.

What I don’t understand yet is how do I set an offset to the texture, so the Quad in the right can continue where the Quad in left is cut.

You can set whatever texture coordinates you want. Easiest would be to use some form of the world coordinates… x, y for one direction and z, y for the other. Scale as needed.

I found this article explaining all this, https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes

Thanks for the quick answers!

Another way is, to have like buildig blocks that are used procedually,

and make sure that you use a tiling texture, and the borders/edges texture coordinates are always on a even number.