3D Cockpits
What's the difference between a 2D and 3D
cockpit?
X-Plane has two completely different ways (called 2D and
3D) of displaying the cockpit views. You toggle between them with the
control-O key or by enabling buttons or axes to control the 3D view.
In the 2D view, X-Plane first renders the external scenery view in your
display. Then it overlays that with the panel image, starting by
painting the panel background image directly on the display and then
painting in all the instruments and their readings. The side and rear
views are handled similarly, using the separate side and rear view
bitmaps, only no instruments get painted.
In the 3D view, X-Plane uses a separate cockpit interior object that
surrounds your viewpoint. This object has its associated texture bitmap
that paints most of the interior view. In addition, X-Plane renders the
panel view as above, but into a scratch buffer. The rendered panel
image is then used as the texture for selected surfaces of the cockpit
object. The aircraft designer can assign subsets of the complete panel
image to different parts of the cockpit object, so that you can have
controls and instruments anywhere in the cockpit view. The only
limitation is that the total set of instruments has to fit in the
1024x1024 base panel image.
The result is a 3D view of an aircraft interior with the view of the
scenery out the windows that's as realistic as the aircraft designer
can manage to make it. You can pan your view in any direction, with
working instruments rendered in perspective. The main downside is that
you need more controls. You can pan the view with the mouse, but then
you can't use the mouse to operate on-screen controls. Or you get a
second joystick to pan the view. Some folks have reported success with
a gamepad as the view controller. Another downside is that the view of
the instruments in the 3D view is often less clear because of the
scaled, 3D perspective view.
You can also use the 3D view in an aircraft that doesn't have a cockpit
object, but it's a little unsatisfying. You get the 3D panning view,
but you'll find yourself sitting in the open with the panel suspended
in space in front of you.
How do I create a
custom 3D cockpit??
Here's what Ben Supnik has to say
about
using the cockpit object. (Note this discussion applies to the OBJ7
format. The OBJ8 format has more flexibility, such as creating non-quad
areas, and is supported by design tools such as Blender and AC3D.)
This is how OBJ7 is supposed to work in X-Plane 8:
All polygon types (quad, quad_hard, tri, tristrip, tri fan, quadstrip)
use the texture as specified in the fourth line of the file, except for
quad_movie and quad_cockpit, which use X-Plane's one-and-only movie
texture and the aircraft's panel, respectively. Therefore the only
thing
necessary to make a quad show the panel rather than the object's own
texture is to add _cockpit to the command name.
The panel will appear at whatever size you want... it's a question of
- the geometry of the object,
- the S&T coordinates of the panel quads (you don't have to use
the whole panel, you can use parts of it for different quads),
- the viewpoint for the plane, and
- the field of view in the rendering settings.
The S&T coordinates for the
quad_cockpit command indicate the part of the panel to use. For
example,
this will use the left half of your panel as its texture:
quad_cockpit
//
-1 0 1 0 0
-1 1 1 0 1
1 1 1 0.5 1
1 0 1 0.5 0
Note that this is a quad that is 2
meters wide and 1 meter tall, but it is using the left half of your
texture, so the texture will not have the right aspect ratio and will
look distorted. The panel texture is square, so since we use the full
vertical texture and only half the horizontal text
quad_cockpit
//
-1 0 1 0 0
-1 2 1 0 1
0 2 1 0.5 1
0 0 1 0.5 0
That's a panel quad where the aspect ratio of the texture and object
match.
More explanation from Bob Feaver in the Tech List:
The numbers come in 4 groups of 5. The first 3 numbers in each group
mark the x, y and z corner coordinates of a rectangle. The last
pair, s and t, are used for mapping the 2D panel picture plus
instruments (aircraftname > cockpit > Panel.png) to the quad
cockpit rectangle.
quad_cockpit // quad. xyz st. cockpit side
bottom left -1.0 0.0 1.0 0.0 0.0
top left -1.0 2.0 1.0 0.0 1.0
top right 1.0 2.0 1.0 1.0 1.0
bottom right 1.0 0.0 1.0 1.0 0.0
The measurements are in feet from the aircrafts reference point as
follows:
X Y Z
left or right above or below fore or aft
bottom left -1.0 0.0 1.0
Representing the matrix with letters as below,
a
b c
d e f
g h i
j k l
changing pairs of numbers will move the cockpit panel as follows:
- increasing b and k will move the cockpit panel up, decreasing
down.
- increasing c and l will move the bottom corners forward,
decreasing back.
- increasing f and i will move the top corners forward, decreasing
back.
- increasing e and h will make the panel taller.
- if e and h are negative the panel faces the other way
- increasing a and j will make the panel wider.
How do I get pieces of the panel image correctly assigned
to areas in the cockpit object?
Jim McNeill offers the following procedure:
- Start your model in X-Plane.
- Take a screenshot of the 2D panel.
- Save it as a .bmp. You can label it anything you want but I use
<airplane name>_cockpit_ref.bmp 'cuz I use it later on in our
advertising.
- Start AC3D and load your cockpit object.
- Create and position cockpit snippets as desired/needed.
- Select each "snippet" as an object and then from the menu
select Object->Texture and browse to find and select <airplane
name>_cockpit_ref.bmp. Don't panic! AC3D will accept the name as
long as you don't try to export the cockpit using this texture.
- With that "snippet" still selected, start the texture editor
(F10)and position the bounds markers around the instrument, switch,
gauge, or whatever you're trying to texture to the snippet.
- Once you have everything positioned properly....the snippet in
the position you want & the texture properly placed on the snippet,
select Object->Texture from the menu and change the texture to
panel.png.
- Repeat for each snippet.
- Congratulations, you've successfully positioned all of the
desired switches, gauges, etc, from your 2D cockpit in their proper
positions in the 3D cockpit and they will be clickable in XP.
Back to the PlaneMaker
page
Back to the main page