PDA

View Full Version : How many ogl units are 1 metre?



Jan
02-11-2002, 07:01 AM
Hi,

I am building my own editor, but I don´t know how many OpenGL units come close to one metre in reality. If I look at a single Quad which has the width and height of 1 it seems to be huge when I am close to it, but if I create a poly with width and height of 40 it seems small when I zoom a bit away.
So, how many GL units would you use for a poly with the width of 1 metre?

Thanks,
Jan.

Andrea Rossini
02-11-2002, 07:21 AM
The answer is:
Application Defined
If you have a 100 units long rectangle and the eye is
2 units over the rectangle it's like a 2 meter person who looks forward in a 100 meter long road.
An example:
64 units in Quake2 are a bit taller than the player.
a 64 units tall wallway in HalfLife must be walked crouching.

Sebb
02-11-2002, 07:31 AM
Everything is relative !! Take an example: for you, a mushroom is quite small but for an ant, it is a mountain ! Why, because distance between our 2 eyes is not the same ! But a camera has only one eye ! So, it depends on the FOV (Field Of View) If the FOV is big (ie 90 °) all seems to be be smaller than if you put a FOV to 30 ° ! But be carefull, because a bad FOV value brings some visual distortion. A FOV between 30 and 45 is great.
The second point is from where you watch your quad. If it is a wall of 2 meters height and you look at it from a height of 1m80 at 2 m of distance, it will look "human size" but if you put your camera at 5 cm of the floor at look up to see the wall, it will seem to be giant.
So... All is relative but 1 OGl unit is an arbitrary value.
Hope my explanation helps you and hope you understand "meter" ... but I am french ( http://www.opengl.org/discussion_boards/ubb/biggrin.gif) But if you replace 2 meters by 6 feets and 5 cm by a few inches, it is the same ! ( http://www.opengl.org/discussion_boards/ubb/biggrin.gif)

Sebb

Andrea Rossini
02-11-2002, 07:38 AM
Good, you just said the same thing I was meaning with better words.
http://www.opengl.org/discussion_boards/ubb/smile.gif

Sebb
02-11-2002, 07:53 AM
Yes I saw... but it is just because I was making my answer at the same time as you !
"Great spirits meets..." : it is the approximative translation of a french expression http://www.opengl.org/discussion_boards/ubb/smile.gif

Sebb

j
02-11-2002, 08:55 AM
I believe in english it would be "great minds think alike."

j

nexusone
02-11-2002, 09:22 AM
OpenGL unit is not a metered unit but a relative one.

So a 1 x 1 unit cube could be 1 mm x 1 mm or 1 M x 1M or 1 inch x 1 inch. All depends on how you define what one GL unit is equal to.

A good example of example would be AUTOCAD, in which you enter dimensions in inches or meters. The dimension data is keep in exact form, 1 meter = 1 Meter. But the drawing on the screen is based on the pan and zoom settings of the current view. So a full screen view of an object you would scale the object to fit the openGL viewing area.

Another reason to keep your drawing side relative, is during zooming in and out.
Let’s say when you are zoomed in, a 10-pixel line on the screen equals 10mm. But at a zoom of 10X that same 10-pixel line would now be equal to 100mm.

When creating object’s I found being able to input the objects dimensions help me over come my lack of drawing skills. Example is Spatch a nice spine based object editor, that use ether English or metric system units.

If you are doing a CAD program, having exact dimensions is important.
But for making models that will be later scaled to size, then a non-meter unit will work.
A house and a monster model could be the same size when modeled but when the model is pulled into a scene ether can be made larger or smaller as needed.


Originally posted by Jan2000:
Hi,

I am building my own editor, but I don´t know how many OpenGL units come close to one metre in reality. If I look at a single Quad which has the width and height of 1 it seems to be huge when I am close to it, but if I create a poly with width and height of 40 it seems small when I zoom a bit away.
So, how many GL units would you use for a poly with the width of 1 metre?

Thanks,
Jan.

[This message has been edited by nexusone (edited 02-11-2002).]

[This message has been edited by nexusone (edited 02-11-2002).]

wedge
02-11-2002, 11:13 PM
A other problem is, what you want show.
If you want show Higtowers 1 unit = 1 meter coult be to ok, but if you want construct chips you should use a other scale.

lobstah
02-12-2002, 04:38 AM
Just an additional tip:

A unit in OpenGL does not equate to a pixel; as mentioned numerous times, a unit is relative.

marcus256
02-12-2002, 06:16 AM
...to sum it all up (?):

1) Use a unit that you like and fits your model (as mentioned earlier: e.g. houses, furniture etc go well with 1 meter, planets are better in 1 km or perhaps 1 AU - astronomical unit, etc).

2) When you display your model, use "sane" (realistic) coordinates and FOV etc for the camera, and your model will look realistic. For instance, if you unit is 1 meter, placing the camera 1.7 units above an object with 90 degrees FOV, looking straight down on the object, it would look pretty much as if you're standing above it in person.

As I understand it, you are doing a generic modeller (?). In that case, you should really not mandate a unit, that should be up to the designer of the model (and then he/she has to face the same questions that you are now asking, hehe). The only situation where you would need units in a modeller is if you need to do physics (e.g. gravitation is ~9.8 m^2/s etc).

robert_s
02-12-2002, 06:58 AM
I agree with marcus256!! http://www.opengl.org/discussion_boards/ubb/smile.gif
90 degrees fov is best to match the reality!

dorbie
02-12-2002, 07:04 AM
You're all wrong, this is a well documented feature. It's right there on page one of the spec, there are twelve bananas per furlong in OpenGL. If you need more or less then you must use the glScale* call to modify the modelview matrix.

Jan
02-12-2002, 12:38 PM
Thanks to you all.

My editor is not for a CAD application, it´s only for me to be able to create levels. Maybe it will become a game in future. I was just wondering, if there is a fixed number of gl units that come close to one meter, because then it would be easier to modell rooms etc.

I use a FOV of 45° and I experienced today, that one should use about 20, maybe even more gl units for one meter. I am not absolutely sure with this value, but it is a start.

Thank you for the examples.
Jan.

nickels
02-12-2002, 01:48 PM
You need to create a program that displays exactly one pixel on your screen.
Next, get a measuring stick and calculate the dimensions. Average the x and y dimensions and this will give you the lenght of 1 opengl unit.

Andrea Rossini
02-13-2002, 12:05 AM
If you use a VB PictureBox as a rendering context for your 2D window you can pass scaletop,scaleleft,scaleheight,scalewidth as parameters for glOrtho...
I use VB for my editor since I'm not good with MFC or pure "C" to make interfaces.

Jambolo
02-13-2002, 08:35 PM
Originally posted by Jan2000:

...I was just wondering, if there is a fixed number of gl units that come close to one meter, because then it would be easier to modell rooms etc.

I use a FOV of 45° and I experienced today, that one should use about 20, maybe even more gl units for one meter. I am not absolutely sure with this value, but it is a start...


Jan,
You are doing it backwards. First, decide how big a gl unit is (I suggest 1 meter), then make sure the camera location is reasonable (like 1.7 m above the floor), and then adjust the field-of-view until things look right (generally 60-90 degrees).

marcus256
02-13-2002, 11:44 PM
Jambolo is right. It is like in the real world:

There are several units (meters, feet, yards, miles, AU, Ångstöm etc). Depending on which unit you chose, a certain object (say, a table) will have different "sizes". For instance, if you chose the unit meter, your table might be 2.5 units wide, but if you chose the unit feet, it will be 8.3 units wide.

What it all comes down to is that it does not matter what unit you chose. To make things look realistic you only have to be consistent and make sure that the proportions between different objects, lights and cameras are realistic.

I usually use the following "standard": one OpenGL unit is one meter, and the camera FOV is in the range 60-90 degrees.

A few comments... Don't bother about pixels! They don't mean anything! With an OpenGL "unit", we refer to the 3D coordinates before they are transformed.

Another thing is the FOV - the human eye has a FOV of over 180 degrees. However, if we wanted to use that on a monitor, the monitor would physically have to "surround" us so that it covers our FOV. Depending on how large your monitor is, and how close you sit to it, it covers a certain amount of your FOV (normally 30-40 degrees). If we used that for the rendering FOV, we would get very narrow/telescopic views (it's roughly equivalent to looking through a 6 cm long pipe that is 4 cm in diameter - try it with a cut-off, used up toilet roll http://www.opengl.org/discussion_boards/ubb/wink.gif ).

So normally we use a compromize: a little bit more than the actually seen FOV (the FOV covered by the monitor), and alot less than the entire human FOV (>180 degrees). This gives an impression of "being there", while not distorting the image too much.

nexusone
02-14-2002, 07:30 AM
I guess you did not understand our examples, there is no fixed gl number equal to a meter.
The gl unit can be what ever fixed number you want to make it.

If you like 1 gl unit can equal 1 meter.



Originally posted by Jan2000:
Thanks to you all.

My editor is not for a CAD application, it´s only for me to be able to create levels. Maybe it will become a game in future. I was just wondering, if there is a fixed number of gl units that come close to one meter, because then it would be easier to modell rooms etc.

I use a FOV of 45° and I experienced today, that one should use about 20, maybe even more gl units for one meter. I am not absolutely sure with this value, but it is a start.

Thank you for the examples.
Jan.

nexusone
02-14-2002, 07:38 AM
I was thinking they need to take a measuring stick, place it at the base of a very tall building. Take a good look at the size of it, then walk up the stairs to the roof of the building and look down on the stick.
And see if the stick look's any diffrent in size.


Originally posted by nickels:

You need to create a program that displays exactly one pixel on your screen.
Next, get a measuring stick and calculate the dimensions. Average the x and y dimensions and this will give you the lenght of 1 opengl unit.



[This message has been edited by nexusone (edited 02-14-2002).]

yakuza
02-14-2002, 07:49 AM
I solved this problem by rendering a texture of a meter-stick onto a 1 unit long polygon. Thus, 1 unit = 1 meter. http://www.opengl.org/discussion_boards/ubb/smile.gif