Page 1 of 1

Blender to Ogre Scale

Posted: Fri May 20, 2005 3:22 pm
by Chris Jones
ogre has a different scale compared with modellers doesnt it?
if i wanted a model that was 1 meter tall in ogre, how big would i have to make it in blender?

Re: Blender to Ogre Scale

Posted: Fri May 20, 2005 3:46 pm
by reimpell
Chris Jones wrote:if i wanted a model that was 1 meter tall in ogre, how big would i have to make it in blender?
This depends on your camera settings. But you can turn it the other way round: just use 1 blender unit and export your model unscaled. Assuming that people usually use 1024x768 pixels for games and it is common to have a monitor with 96 dpi at that resolution, you have that 768 vertical pixels correspond to (768 dots)/(96 dots/inch) = 8 inch = 8*2.54 cm. Hence, if your model should be 1 m tall, just make sure your camera and viewport settings display 1 vertical Ogre unit as 100/(8*2.54)*768 pixels.

Posted: Fri May 20, 2005 4:07 pm
by Chris Jones
so, i have to program my camera and viewport to have different values related to what resolution they have? what if they have a different dpi for the monitor?

Posted: Fri May 20, 2005 4:24 pm
by reimpell
Chris Jones wrote:so, i have to program my camera and viewport to have different values related to what resolution they have? what if they have a different dpi for the monitor?
The above calculation wasn't too serious. Its intend was to demonstrate that there is no intrinsic unit for distance measures within a rendering engine. This is even more true as Ogre does not come with an included physics engine. What you are probably interested in is a relative size to existing content. As we don't know what content you are referring to, we can't answer your question. BTW you can query your mointor's display size using dcc. This way you can display your meshes with a given ratio to real meters.

Posted: Fri May 20, 2005 4:30 pm
by Phantom
In short: Use whatever scale you like

Posted: Fri May 20, 2005 4:30 pm
by DWORD
Don't bother with units in the modeller (IMHO), just decide e.g. that 1 unit equals 1 metre, and then use the same scale for all of your models. Then they'll appear correctly in Ogre too, because it doesn't really know about units anyway.

Posted: Fri May 20, 2005 4:39 pm
by Chris Jones
surly when moving objects around, i will need to know exactly how much to move it by, and depending on the size of the model, will depend on how far to move it?

Posted: Fri May 20, 2005 4:40 pm
by Phantom
Well if you decide one meter is one unit then if you want to move it by 7 meters you move it by 7 units? :)

Posted: Fri May 20, 2005 5:14 pm
by Chris Jones
ohh, im stupidly confused now :?

if i make a model in blender, it will be a different size in ogre, so i keep the same sizes, which means 1 unit isnt 1 meter, relative to a model, which means if an object is moving 1meter per second, i cant move it 1 unit, cos relative to its size, 1 meter might b bigger or smaller

can some1 please clarify how im going to do this, also, dont physics engines rely on units etc?

Posted: Fri May 20, 2005 6:30 pm
by DWORD
Chris Jones wrote:if i make a model in blender, it will be a different size in ogre(...)
Err... what do you mean by this? :?

If for instance you choose that 1 unit in the engine equals 1 metre in the real world, then to create a 1 metre tall crate, you just create a crate in blender that is 1 unit tall.

Then if you want to move that crate by 1 m/s (in real world units), you just move the box 1 unit/s in the engine. It's that simple.

BTW, physics engines don't know about units either, they just operate on the relations between different physical sizes. E.g. you don't have to use metres for distance, kilograms for mass, or even seconds for time; all that matters are the actual values.

Posted: Fri May 20, 2005 6:33 pm
by DarkSeraph
sidenote, but almost on topic

Is it smarter to use a larger scale, so you can have more detail easily placed in an object/model?

Posted: Fri May 20, 2005 6:34 pm
by Phantom
There is no "smart scale", as long as everything can be represented within the floats or doubles precision.

Posted: Fri May 20, 2005 6:59 pm
by reimpell
DarkSeraph wrote:Is it smarter to use a larger scale, so you can have more detail easily placed in an object/model?
Try to avoid error amplification, e.g. avoid multiplying very small numbers with very large numbers. Also, simplify your math expressions before you implement them and use stable algorithms. Otherwise you get problems like sqrt(2.0)*sqrt(2.0). Python example:

Code: Select all

$ python
Python 2.3.3 (#1, May  7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.sqrt(2.0)*math.sqrt(2.0)
2.0000000000000004
>>>      

Posted: Fri May 20, 2005 10:47 pm
by Jerky
So can I scale models differently in a project I am working on using Ogre? Or do I have to do it in the modeler and then export them as 2 seperate models, even though they are the same thing? That would be a huge hassle.

What I mean is, can't I just have one model and tell Ogre to scale it differently in different instances?

Posted: Sat May 21, 2005 2:25 am
by Drew_Benton
Jerky wrote:So can I scale models differently in a project I am working What I mean is, can't I just have one model and tell Ogre to scale it differently in different instances?
Yes. When you attach the model to a node, you can scale that node how you choose. If you look at the models included with Ogre, they are quite huge when scaled <1,1,1>, so what I do is just scale using <.05,.05,.05> and viola, perfetly sized characters for me. You can do the same for how you need it to be :D

Posted: Sat May 21, 2005 7:08 am
by neocryptek
Drew_Benton wrote:
Jerky wrote:So can I scale models differently in a project I am working What I mean is, can't I just have one model and tell Ogre to scale it differently in different instances?
Yes. When you attach the model to a node, you can scale that node how you choose. If you look at the models included with Ogre, they are quite huge when scaled <1,1,1>, so what I do is just scale using <.05,.05,.05> and viola, perfetly sized characters for me. You can do the same for how you need it to be :D
Though note that this screws over the normals, so lighting will look funky. Unless of course you tell Ogre to recalculate them, but that useless work that could have been done in the preprocess stage. (Entity::setNormaliseNormals(true) or something IIRC)

Though id definitly use that for getting the scales to all look right first, then re-export scaled versions to match with your modeler.