Page 1 of 1

I don't want my texture cut!

Posted: Fri Jun 05, 2009 6:16 pm
by RodrigoAmazonas
Hi,

I want to load the texture completely in the terrain, without cutting or repeating it. Since each texture is a country, what I do is:

1) cut a world altitude map for the country region (this creates a small bmp, which is loaded with smgr->addTerrainSceneNode);

1.1) this map has to be scaled to meet the aspect ratio of the country. The scale parameter of addTerrainSceneNode then is:
core::vector3df(ScaleH*dimPais.Width/dimPais.Height, ScaleV, ScaleH),
where dimPais contains the width and height of the altitude map for that country.

2) load the vegetation map for the country (an existing png file for each country);

Some examples:

Honduras (altitude map: 93x51 pixels; vegetation map: 696x386)
Germany (altitude map: 137x116 pixels; vegetation map 1027x872)

I had to use

terr->scaleTexture(1.15f,1.f); // for Honduras
and
terr->scaleTexture(1.062f,1.f); // for Germany

for the textures display correctly (without cutting).

Irrlicht 1.5 still has the 2^n+1 necessary size of the texture (or heightmap)?

Can anyone tell me what is going on, please?

Posted: Fri Jun 05, 2009 6:19 pm
by Lonesome Ducky
I'm guessing it probably is the power of 2, try scaling them up or down to the nearest. Although the textures should still work even if they are non-power of two. The heightmap should definitely be 2^n+1, though.

Posted: Fri Jun 05, 2009 10:03 pm
by hybrid
I guess that you don't necessarily need the DLOD feature of the terrain scene node, so you could switch to the terrain mesh which does not require the 2^n+1 dims (it's only necessary for this feature, though also the textures can break when using different dims). Due to the upscaling when using NPOT textures it should be much easier to align POT textures.