Sign in to follow this  
ThunderMusic_80

Units in OpenGL and/or Direct3D

Recommended Posts

Hi, I was just wondering if there are any representation or meaning to the units used in OpenGL and Direct3D. I mean, if I give a length of 1.0f to one of my vectors, is it 1 foot, 1 meter, 1 undefined unit? Does it work the same in OpenGL and in Direct3D? thanks

Share this post


Link to post
Share on other sites
Generally when rendering a 2D game one unit corresponds to one pixel. However, in 3D it makes little difference as the size a thing appears on screen depends on how close the thing is to the camera.
The size of one unit is up to you. It could represent a centimetre, and inch, a metre or 1000 kilometres (galaxy simulators etc). Chose a measurement and then try to build your models to the correct proportion.

Hope this helps,
Jackson Allan

Share this post


Link to post
Share on other sites
Of cource you can choose what you want to mean the value 1.0f:

a meter, a cm, a km, etc.

but keep in mind than in my experience in Direct 3D
if you use very small values (I mean for example 1.0f = 1 meter and have a model of a coin) that some rendering errors may be noticed. (if your 3D engine let's say render the coin from a "near" clipping plane).

Just consider that near-clipping-plane in Direct3D is the item [4, 4] of the VIEW_MATRIX, if you have a small value to this some rendering errors occurs in distant scenery (looks like
z-Buffering does not work well). But if you want to "view" with
your 3d engine from a close distance small objects like
a coin etc you sould give to the item [4,4] a small
value.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this