PDA

View Full Version : Size/Scale of my world



benwestgarth
04-21-2005, 05:19 PM
Hey there,
I have been writing a fps game engine in order to learn opengl. It's going pretty well, but the other day I started importing studio max designed scenes into the engine. I noticed that the objects I create in 3dsmax are *huge* when I import them. So, my question is: what kind of scale do people use when creating worlds? Eg. My camera's bounding sphere is 5.0 in diameter. Is that really small? What are the benefits/drawbacks of doing things on a larger/smaller scale (if any)?

uruk
04-21-2005, 08:35 PM
When doing things on a very large or a very small scale computations will be less precise or even not correct.(i.e. with very small numbers you can get an underflow error and with very large ones overflow).
And for the other question maybe you should check the "Customize --> Units Setup" menu and also scale down the models in MAX if they are too large.

Obli
04-22-2005, 02:58 AM
Well, it's actually pretty difficult to overflow or underflow float32 range with denorms (standard for CPU) howeve, this is basically correct.
Another thing you shall consider is that there's a fixed amount of mantissa for each value. Then, there's the exponent.
Integer numbers are evenly spaced in their range. For example, uint16 values are 0, 1, 2, ..., 65535.
Floats are different. Think the mantissa as a "fixed amount of divisions". Since the exponent can widely range, the divisions (ie. the delta between a float and the immediate one) will be, in fact, bigger.
This means that each exponent have different "steps" for floats.
The bigger the exponent, the bigger the step. All floats with the same exponent have same "stepping" between consecutive values.
So, there is underflow, overflow and precision.

Anyway, I don't think you may have visible problems with most values. I think you could have decent precision up to the range of +-1M, but I've never checked that out.

UrbanLegend
04-23-2005, 07:22 AM
HI

Opengl is Unitless

With the scale and units it is really what you want it them to be.

Alot will depend on how you model your 3d Objects and features. Many Modelling packages default to Meters, some Centimeters and some Millimeters etc.

Then there's your end application and end user expectations.

Opengl is Unit less so really you Need to pick a nominal meaning of units e.g 1.0 = 1 meter, then ensure that any models you load are scaled to fit that unit choice etc.

The other consideration and big complication that creeps in here is where you Model you world, at the nominal origin of 0,0,0 or of in some world coordinate such as UTM WSG84 etc.

____________________

Gordon.

www.3dscenegraph.com (http://www.3dscenegraph.com)
Vega FAQ/Samples (http://www.3dscenegraph.com/vega)
SceneGraph Forums (http://www.3dscenegraph.com/3dsceneBB/)

plasmonster
04-23-2005, 01:35 PM
For what it's worth, I think Quake/Unreal has average character heights of around 40-50 units, wall heights that are typically 128-256 units, and world dimensions that are limited to around +/- 32K (though, I think world size has increased over the years).

These sizes are roughly based on a meter = 32 units, or so.

I've found this sort of scaling is just the thing for a game world. In a world editor, for example, it's sometimes convenient to have grid sizes that are powers of two (or at least integer); when BSP preprocessors are going to chew on your geometry, it's nice to be able to snap planes/vertices to an integer grid. This can help keep the polygon splitting code from having to deal with awkward plane orientations (though this is not completely avoidable). Careful snapping can also help to mitigate t-junction problems. It's perhaps easier for the artist as well, to simply deal with integer coordinates.

benwestgarth
04-23-2005, 06:17 PM
Thanks for your responses guys. Good advice as always from this message board.
Ben