[Solved] Problem scaling trees


11-01-2008 18:50:06


Although I supply a scale value when I add trees to the TreeLoader3D object, the trees dont's seem to be scaled at all. The only noticeable effect I could achieve so far was that the trees disapeared if the scale value was set to about 300 or higher.

Since I couldn't find any topics about scaling issues in the forum I think I'm doing something wrong and it's not a bug, but since I'm mainly using the example code and the tree2.mesh I can't think where the error lies.

The only difference between the examples and my code is the world scale.
I use 100 units for 1 meter and therefore have a batched ranged of 30000, a impositor range of 60000 units and the the treeLoader3D object is created with TBounds(-204800, -204800, 204800, 204800).
By the way I used the cvs code from october 07 and updated yesterday and it changed nothing.

Perhapse someone can give me a hint where to start searching.


11-01-2008 19:47:40

By default TreeLoader2D and TreeLoader3D only accept scale values between 0 and 2 (although you won't get an error in release mode if you exceed the boundaries). For numerically huge worlds like yours, you'll have to call treeLoader->setMinimumScale() and treeLoader->setMaximumScale(). Don't set these too far apart though, because there's only a certain amount of resolution available due to the way tree positions/rotations/scales are compressed when stored, and it may result in scales not exactly as you want them.


12-01-2008 01:30:36

Thank you for the quick answer.
I've read a post in the Ogre main forum and know that scale values schould be between 0 and 2; I think there was something like 255 * (scale / 2) in the code to save scaling values in a 8 bit value. But even with scale values of 2, which should work like an setScale(255, 255, 255) on an normal ogre entity, the size of the meshes does not change.

Here is a sample pic showing a normal mesh with an applyed scale value of 50 on each axis on the left and a tree added by pagedGeometry using
this->m_TreeLoader->addTree(entity, position, yaw, 2.0f);
on the right:

The applyed scale for the pagedGeometry tree should be 255* (2.0f/2); so it should be much bigger than the the tree on the left...


12-01-2008 20:02:57

Shame on me.
Now I think I have understood the way scaling works. I was misled by the fact that there was no support for large scale scaling in the past and thought you would map bigger scale values to the range from 0.0f to 2.0f :roll: