Hi Wuddy,
The 3 camera setup is there to solve 2 separate problems.
The screen image is displayed firstly from Camera 0.
That image is overlaid with the the view of Camera 1.
Finally the image is overlaid with the view of Camera 2.
Camera 0 and 1 are the 2 cameras that are moved around in the 3D world, and view from the same view point.
Camera 2 is located at world coordinates close to 0,0,0 and only looks at a cockpit model of the aircraft. This was done to eliminate rounding errors and cockpit shake if the cockpit was moved a significant distance from the world 0,0,0 position. (floating point numbers only have 7 significant digit accuracy)
Here you can see the setup function for the cameras and their frustum settings.
Code: Select all
void SetupCamera( void )
{
// Camera variables
float fHorizontalPixels = 1024.0;
float fVerticalPixels = 768.0;
float fAspect = fHorizontalPixels / fVerticalPixels;
float fFov = 1;// in radians *******
float fNear = 0.3f;
float fMiddle = 300.0f; // change over point between the 2 cameras
float fFar = 300000.0f;
float fAircraftRadius = 20.0f; // default radius aircraft cockpit view fits into.
dbMakeCamera(2);// create the cockpit camera (closest camera).
dbMakeCamera(1);// create the second camera.
dbSetCameraRange ( 2, fAircraftRadius / 1000, fAircraftRadius );
dbSetCameraRange ( 1, fNear, fMiddle );
dbSetCameraRange ( 0, fMiddle, fFar );
dbSetCameraAspect ( 2, fAspect );
dbSetCameraAspect ( 1, fAspect );
dbSetCameraAspect ( 0, fAspect );
dbSetCameraFOV ( 2, 180/3.14 );
dbSetCameraFOV ( 1, 180/3.14 );
dbSetCameraFOV ( 0, 180/3.14 );
/**********************************************************************************************************************
* Disable the backdrop of the closest cameras so we can see the content of the furthest camera behind it.
* REMEMBER.. cameras create their picture starting from lowest number camera sequentially upto highest numbered camera.
***********************************************************************************************************************/
dbBackdropOff(2);
dbBackdropOff(1);
}
Here is a snapshot being built up one camera at a time.
This is what the default camera 0 can see. (from 300meters up to 300000meters, with a blue sky backdrop)
All the close aircraft are missing.
Now we overlay the image of camera 1 to the image of camera 0 . (camera 1 from 0.3meters to 300meters)
All the closer aircraft have now been filled in.
Lastly we are filling in the visible part of the cockpit (at the moment we can only see the wingtip of the cockpit visible ... will still have to do some positioning fine tuning)
This cockpit view camera can only see up to the size of an aircraft in radius.
You are correct, that I will be introducing a LOD system similar to what EAW uses.
I will however go one step further to minimize wasted calculations.
I will be calculating ONLY ONCE in every frame the distance from the camera to every object (aircraft and bullet) and use this calculation to at the same time determine engine volume, engine doppler, aircraft LOD, bullet visible/not-visible, ....etc
Also, since my lower detail aircraft will by much higher in detail to what EAW uses, there should be no obvious difference when using Zoom.
The 70 clock cycles is just a unit of time measurement that EAW uses to do its calculations on. Dropping it to 50, or upping it to 100 should make little precision difference in the calculations (as far as games go). It is like having a game use standard time units of 0.1 seconds or 0.12 seconds or 0.08 seconds for its time calculations. It will have no effect on the actual FPS that the game runs at.
I remember once flying over the lip of a mountain range cliff in a small Cessna. We got caught in a down draught and lost 1000ft in a few seconds. There was a pen sitting on my friends lap and it went straight to the roof of the aircraft. At that time I had the same perspiration beads forming on my forehead as I sometimes get when flying against Knegel.
That cliff face went wizzing past us as we shot downwards. I can assure you that things in real life can happen just as fast as they do in EAW.