3-D coordinates - units of measure
Blitz3D Forums/Blitz3D Beginners Area/3-D coordinates - units of measure
| ||
So, I'm trying to get into this 3D thang, and I'm understanding the high-level concepts (x-,y-, and z-axes, turning vs rotating, moving vs translating etc), but, at a fundamental level, I'm failing to grok the coordinate system units of measure. If I create a light and set its range to 8, what does that "8" mean exactly? 8 units? If I move an entity 0.5 in the x-direction, how far is does it go? In 2D programming this is easy: each "unit" corresponds to an actual pixel on the display (bitmap, or whatever I'm drawing to). But, in 3-D this isn't so apparent. Perhaps this has been asked before... apologies if so. |
| ||
There are no units of measure, just dimensionless numbers. Alternatively, you may imagine units to be anything you like. They could meters, feet, parsecs... Displayed size depends on distance from the camera and the CameraZoom factor. Experiment until things appear the size you like. The easiest way to start experimenting is with CreateSphere(). The default sphere has a radius of 1. |
| ||
If I create a light and set its range to 8, what does that "8" mean exactly? 8 units? Exactly as you said, it means 8 units. What the actual units are is entirely up to you. If the game is based on space, perhaps a unit could be a light year. If your game is based on insects then perhaps a unit could be 1 centimeter or for that matter a unit could be 39,563 decameters if you want it to. It really doesn't matter as long as everything else is in proportion. |
| ||
I'd suggest that you think/decide that 1 blitz unit = 1 meter, because of the z-buffer etc issues when using very small scale, like 1 unit = 1 mm. Small scale will get you loads of problems later and it is difficult to re-scale everything then, including models and such. |
| ||
1 unit = 1 mm. Small scale will get you loads of problems later ... There is nothing wrong with this. You can use whatever scale you want. The problems arise (if I'm not mistaken) when working with very large numbers because you started with too small of a scale to begin with. But if your program is based on small objects in a small environment then there is no problem with using a scale such as 1 unit = 1 mm. |
| ||
JeffS, to get a handle on what that means screenwise, I find it useful to know that (with a camera at 0,0,0 pointing up the Z-axis with a zoom of 1) the camera will show 2x2 units at a distance of 1 unit along the Z-axis, and 20x20 units at a distance of 10 units along the Z-axis. However, if your camera viewport is not square (which it usually isn't...it's usually the proportion of your full screen) the view will be cropped on the shorter dimension. For example, at a typical 640x480 or 800x600 or 1024x768 resolution, which is a 2/1.5 ratio, you'll get 20x15 units showing in your viewport at a distance of 10 units along the Z-axis. |
| ||
Thanks y'all for the responses. My high-school chemistry teacher used to incessantly nag us about "naked numbers". If, on a test, you were to put "3" as your answer, you got it wrong; if you put "3 grams" then you got credit. (Assuming "3 grams" *is* the correct answer!) So, I have an aversion to these "naked numbers" for the 3D coordinates. 9572AD: Thank you! This is exactly the kind of answer I was hoping for. I suppose one gets a sort of intuition about these dimensions after programming for a while...? |
| ||
Jeffs, I always just treat the 1 unit as a general meter. Typically i use that as a 'meterstick' (excuse the pun) to determine how i want to scale my entities, or build them. A good way to gauge this is to check the general size of 3d meshes exported from your favorite 3d app (milkshape, 3ds etc) . I have settled on a process which lets me end up with meshes that are approx 2 units/meters tall. Which is approx 6 feet. All of my entity types that i use have a 'scale' factor which on load, adjusts the mesh accordingly if it is not sized correctly in the first place. I think the general trick is to pick a unit of measure (1 unit = meter/foot/yard..etc.) and stick with it. |
| ||
The arbitrary value of the nit scale is really dependant on the meshes and objects you are using. Stick a mesh, camera, light and then a primitive in and adjust your scale 'to taste' :) |
| ||
Thanks again, y'all, I'm very pleased with the abundance of comments! Blitz3D rocks, and so does the Blitz community. |