Terrain Size - bug?

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
Donner
Posts: 87
Joined: Fri May 18, 2007 11:27 am

Terrain Size - bug?

Post by Donner »

Hey,

when creating a terrain scene node the terrain is always 16 units smaller than it is supposed to be. Is that an Irrlicht bug?

For example, if you resize the heightmap in the media directory of Irrlicht to a size of 32x32 and you run the terrain rendering example in the bin directory, after turning on the wireframe mode you can count that the terrain has only a size of 16x16 units. If you have a heightmap with the size 64x64, the terrain has the size 48x48. The last 16x16 vertices are just being cut off...

Am I doing something wrong or is this a bug in irrlicht?

Thanks,
D.
nespa
Posts: 167
Joined: Wed Feb 24, 2010 12:02 pm

Post by nespa »

Convert your heightmap from power_of_two multiply, to power_of_two multiply+1

example: 126x126 to 127x127;

I had the same problem and i resolved this way;
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Post by hendu »

Sounds like an off-by-one test somewhere.
Donner
Posts: 87
Joined: Fri May 18, 2007 11:27 am

Post by Donner »

Hm, I don't want to be annoying - but is there a chance of that bug getting fixed?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The problem is in *your code*. You have to use heightmaps which are (2^n)+1 in order to get exact boundaries.
Donner
Posts: 87
Joined: Fri May 18, 2007 11:27 am

Post by Donner »

Hm, okay... but why is that? What are the technical reasons?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, you create a power-of-two number of terrain patches. This requires one additional row and column of vertices. And without that the LOD algorithm is not properly working, as it tries to reduce the number of patches by a factor of 2 in each step.
Donner
Posts: 87
Joined: Fri May 18, 2007 11:27 am

Post by Donner »

Hm okay, thanks for the explanation!
I guess I just have to use a workaround then...

One more question regarding the terrains:
Why does the TerrainSceneNode ignore the transformation variables of ISceneNode and uses TerrainData.Position etc.?

Terrain->getAbsoluteTransformation thus just returns an identity matrix, no matter what i do with the terrain...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yeah, these are the problem with externally provided scene nodes and add-ons. Unfortunately, the code is pretty dense and does not fully support the Irrlicht interface. I hope this will be fixed in the future.
Randajad
Posts: 59
Joined: Thu May 03, 2012 10:08 am

Re: Terrain Size - bug?

Post by Randajad »

Oh, can u say, when future will be? Maybe for workaround u make picture autoresizing to (width + 1)x(height + 1)?
Sorry for my English, i'm from Russia.
If i makes mistakes in phrases you can correct me btw. ^_^
Post Reply