[Solved] Correct term for: "repeating a texture across a surface"

Hi,

My other trouble regarding graphics, so far.



Please check this screenshot:





The walls and ground slabs in my “game” are made of these textured Box instances.

Cube-shaped walls look fine - However when the length-height-width are not the same, the texture is stretched and the proportions are distorted. No problem up to here, it seems ok even for my neophyte level.



Now.

What’s the keyword I should search to “repeat” the wall texture instead of distorting it?

Thanks!

You'll want to

  1. set yourTexture.repeatType(Texture.WRAP), and
  2. generate texture coordinates based on the world scale (and maybe location, even rotation) of your object.

    I'm not entirely sure if there is some kind of tool or maybe another approach for 2., but I don't think so.



    HTH

Texture matrix might work, divide your surface size by the texture size in world space to get a scaling value…

Owww not feeling easy with your explanations :frowning:



Ok with .setScale, that makes a difference, but, I've not found something easy (like: "textureInstance.getSize()" or something) to get its size?



thanks.

texture size in world space would be the size you want the texture to appear in the world, while surface size would be the size of the model in the world, if you're using a bounding box as the bounding volume for your objects, then twice the xExtent or zExtent would give you the surface size for each coordinate.

A texture always goes between 0 and 1 in the hardware. If you want to make a specific size ("1 pixel is 0.1 inches") then you have to define that in your art. And, in that case, you have to know how big the texture is, as a 1024 texture has twice as many pixels between 0 and 1 as a 512 texture.

Texture detail does not really matter here, but I guess if you want to get more detail out of a low-resolution texture then you would want to define a smaller size in the world.

hey thanks. Will now try that!

you might want to crate your abstract and weird space level using a tool like milkshape instead of hardcoding everything. this will fix the problem as well.

Milkshape you say? Cousin of Blender, or nothing to do?

Milkshape has nothing to do with blender.

Correct me if i'm wrong: Blender makes items in game while milkshape builds terrains?

Not really.



Blender is an open source 3D modeling program. It can make items, and levels, by generating triangular geometry. It may also at this point be able to make skinned characters – I haven't kept up for many years. Main thing about Blender is that it's free.



Milkshape3D is not free; it is a shareware program. It also can make items, and levels, by generating triangular geometry. However, its main strength is a large amount of importers/exporters, and a fairly easy to use GUI for generating skinned, animated characters. I think it's $35 shareware fee.

ok, thanks :slight_smile: