Blender to Ogre Scale

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
Chris Jones
Lich
Posts: 1742
Joined: Tue Apr 05, 2005 1:11 pm
Location: Gosport, South England
x 1

Blender to Ogre Scale

Post 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?
reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Re: Blender to Ogre Scale

Post 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.
Last edited by reimpell on Fri May 20, 2005 4:10 pm, edited 1 time in total.
User avatar
Chris Jones
Lich
Posts: 1742
Joined: Tue Apr 05, 2005 1:11 pm
Location: Gosport, South England
x 1

Post 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?
reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Post 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.
User avatar
Phantom
Greenskin
Posts: 106
Joined: Mon Aug 02, 2004 10:28 pm
Location: Helsinki, Finland

Post by Phantom »

In short: Use whatever scale you like
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post 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.
User avatar
Chris Jones
Lich
Posts: 1742
Joined: Tue Apr 05, 2005 1:11 pm
Location: Gosport, South England
x 1

Post 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?
User avatar
Phantom
Greenskin
Posts: 106
Joined: Mon Aug 02, 2004 10:28 pm
Location: Helsinki, Finland

Post 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? :)
User avatar
Chris Jones
Lich
Posts: 1742
Joined: Tue Apr 05, 2005 1:11 pm
Location: Gosport, South England
x 1

Post 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?
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post 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.
Last edited by DWORD on Fri May 20, 2005 6:33 pm, edited 1 time in total.
User avatar
DarkSeraph
Halfling
Posts: 85
Joined: Thu Apr 28, 2005 5:42 pm

Post 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?
User avatar
Phantom
Greenskin
Posts: 106
Joined: Mon Aug 02, 2004 10:28 pm
Location: Helsinki, Finland

Post by Phantom »

There is no "smart scale", as long as everything can be represented within the floats or doubles precision.
reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Post 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
>>>      
User avatar
Jerky
Orc Shaman
Posts: 791
Joined: Wed Mar 02, 2005 4:13 am
Location: Springville, Utah
Contact:

Post 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?
Erik Briggs (Jerky)
My Blog
Project Wish
Image
Drew_Benton
Halfling
Posts: 95
Joined: Sun Apr 03, 2005 6:58 pm

Post 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
User avatar
neocryptek
Gnome
Posts: 335
Joined: Sat Mar 01, 2003 11:21 pm
Location: Idaho, USA
Contact:

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