I don't want my texture cut!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
RodrigoAmazonas
Posts: 24
Joined: Mon May 25, 2009 2:18 pm
Location: Brazil
Contact:

I don't want my texture cut!

Post 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?
I feel, therefore I am.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post 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.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
Post Reply