|
BUILD SCENERY ELEMENTS
-         Object Basics
-         Predefined Objects (stay tuned)
-         New Format (stay tuned)
OBJECT BASICS
This section covers the original BVE object file format: B3D. The procedures at the end of this section assume you have prepared a test base, TestBase.RW (or whatever you chose to call it), as described in the test base procedure.
REFERENCE.
- Mackoy's developer files: http://mackoy.cool.ne.jp/make/index.html
- Alta Vista translators: http://world.altavista.com/tr
- Ernie Alston's post on the - BVE forum http://www.crotrainz.com/cgi-bin/forum/board.pl?az=show_ thread&om=23&forum=DCForumID4&archive=yes
- Robert Marrero's Making BVE Routes (*.b3d file) web page: http://rmmarrero.topcities.com/bve/make/b3d.html
- RGB color chart: http://www.hypersolutions.org/pages/rgbdec.html
Reference #1 is in Japanese. Use the Alta Vista translators (reference #2) to see it in English. If you go to Mackoy's home page first, click the wrench icon to access the developer files. There are quite a few, and all appropriately named. If you have difficulty printing a frame, select the contents of a frame and copy/paste it into a Word document. Then print from the Word.
Reference #3 may require membership to gain access. Go ahead and join. This is a super site for exchanging information about BVE and other train sims.
SUMMARY. B3D objects are text files normally created in Notepad or WordPad and saved with the B3D extension. BVE models 3D objects by applying surface color or texture to a plane or planes defined by points in space. Points are located by coordinates on traditional x, y, and z axes. Zero for all axes is the point where all axes cross. Positive values increase right (x), up (y), and forward (z); negative values are the reverse. Linear measurements are in meters.
When placing an object in a route, you have the ability to set object distances right or left of, and above or below any specified track. You can also set the angle at which the object is placed in relation to that track. These settings locate the zero point and orientation of the object's own coordinates.
A free object is placed in a route by using the @FreeObject (Index, Type, X, Y, RotY) statement, where:
- Index = -1 for Ground or 0-7 to identify the track
- Type = the type number you assign to the object in the Object section of the route file
- X = the distance in meters to the right of the track center (negative numbers extend to the left)
- Y = the distance in meters above the top of the rail (negative numbers extend downward)
- RotY = the angle in degrees about the track's Y-axis that the object is rotated (positive is clockwise and negative is counter-clockwise)
Structure.
Each B3D object file has the following basic structure:
- [MESHBUILDER]
-
- Vertex statements
-
- Face statement(s)
-
- Color statement(s) ; use if you do not use the [TEXTURE] statement
-
-  
-
- [TEXTURE] ; use if you do not use the Color statement
-
- Load statement
-
- Coordinates statements
-
- Transparent statement
-
Detail.
The following descriptions add detail to the basic B3D object file structure:
[MESHBUILDER] statement. This statement precedes the following statements. There must be no spaces or blank lines between this statement and the succeeding statements.
Vertex statements. These statements identify a plane's defining points (vertices) by their x, y, and z coordinates. Vertices assume an identifying number by the order in which they are declared. Zero is the first, 1 is the second, and so forth. In the following example, a 5 x 5 meter square is located 2 meters horizontally and 3 meters vertically from zero.
| Format:
Vertex Vx, Vy, Vz ; Vertex 0
Vertex Vx, Vy, Vz ; Vertex 1
Vertex Vx, Vy, Vz ; Vertex 2
Vertex Vx, Vy, Vz ; Vertex n
Example:
Vertex 2, 3, 0 ; Vertex 0 ; lower left
Vertex 2, 8, 0 ; Vertex 0 ; upper left
Vertex 7, 8, 0 ; Vertex 0 ; upper right
Vertex 7, 3, 0 ; Vertex 0 ; lower right |
|
Face statement(s). This statement combines with the Vertex statements to determine the order in which the vertices are drawn and thus the side to which the color or texture is to be applied. Multiple Face statements let you apply color/texture to both sides of a plane or to separate planes defined by the configuration of vertices. For example, you could define all 8 vertices of a cube. Each face to which you want to apply a color/texture would then have a unique Face statement.
- Format:
-
- Face Vn, Vn, Vn, Vn ; n = Vertex number
-
- Example:
-
- Face 0, 1, 2, 3 ; draws the vertices of the example figure clockwise from the lower left
-
The vertex/face relationship sets the stage for the surface application of color or texture, which in turn make the plane visible. The full relationship is a tricky thing to grasp. Ernie Alston provides a good explanation in reference #3. I plan to cover this extensively in the Investigations portion of this section. For the moment, it can be said that in the examples given so far the plane that is drawn with a Face statement that begins with a vertex on the left will face you and therefore be visible. The plane that is drawn with a Face statement that begins with a vertex on the right will face away from you and therefore not be invisible. Bear in mind that once you begin rotating the plane with the @FreeObject statement in the route file, you can turn the plane so that its invisible side becomes visible and vice-versa.
A point of interest: in our examples we create a plane in the form of a rectangle and think of it interchangeably as a surface. This is not quite accurate. A plane is defined by three points. BVE lets you define the vertices of a rectangle, for example, in which one or more vertices is out-of-plane with the others. The face then follows the distortion, breaking into two or more planes with invisible crease(s) at the appropriate line(s) where the planar surfaces join. I have done this with a simple rectangle in the x-y plane and one or two opposite corners given out-of-plane z-coordinate values. An applied texture containing lines of text visually confirmed the distortions as planar.
Color statement(s). This statement applies color and opacity to a face. The statement is not used when a texture is applied to the face. Color is defined in 256 increments for each of the red, green, and blue video components. Colors are defined in increasing amounts from 0 to 255. Setting all three colors to 0 produces black; setting all colors to 255 produces white.
You can find a good color reference chart at reference #5 that will let you select a specific color without a lot of experimentation.
The Color statement also contains a fourth parameter, alpha, which is optional. Alpha defines the opacity of the surface from 0 (transparent) to 255 (opaque). Omitting the alpha parameter is equivalent to alpha=255.
- Format:
-
- Color nR, nG, nB, nA ; R=red; G=green; B=blue; A=opacity; n=(0-255)
-
- Example:
-
- Color 255, 0, 0, 255; pure red at full opacity
-
[TEXTURE] statement. This statement precedes the following statements. There must be no spaces or blank lines between the [TEXTURE] statement and the succeeding statements. This statement and its succeeding statements are not used when a color is applied to the face.
You must have one [TEXTURE] statement and its successors for each Face statement not having a corresponding Color statement.
Load statement. This statement loads a bitmap file for application of a texture to a face.
- Format:
-
- Load filename.bmp
-
- Example:
-
- Load building1.bmp ; loads a file named building1.bmp
-
Coordinates statements. These statements determine the placement of a surface texture. They take the parameters V, W, H; where V = vertex, W = number of times the image is applied horizontally, and H = the number of times the image is applied vertically.
Two edges of the face must be defined to apply texture. For a rectangular plane facing the cab, the upper right and lower right vertices (as drawn by the Face statement) define the edge from which to apply the width of the bitmap. The lower right and lower left vertices (as drawn by the Face statement) define the edge from which to apply the height of the bitmap. If a single application is specified for a given direction (width or height), the bitmap stretches or contracts as required to fit the face. If multiple applications are specified, the bitmap contracts (if necessary) and repeats itself in the specified direction as many times as indicated. You do not have to use whole numbers. You may never want to, but you can apply a bitmap half a time or two and half times or any other amount as long as it is in decimal format.
One word of caution about bitmaps: BVE requires that a bitmap's outside dimensions (length and width) be a power of 2. That is, 2-squared, 2-cubed, etc., or 2, 4, 8, 16, 32, 64, 128, 256, etc. Also, bitmap files must be created with a depth of at least 256 colors. This is normally done when you save the bitmap by selecting the bitmap type as 256-color (or higher).
By designating other edges of the bitmap as right and bottom edges, you can rotate and/or reverse the image as it is applied. This will be demonstrated ad nauseum in Investigations.
- Format:
-
- Coordinates 0, nW, nH
-
- Coordinates 1, nW, nH
-
- Coordinates 2, nW, nH
-
- Coordinates N, nW, nH
-
- Example:
-
- Coordinates 0, 0, 1 ; contributes to H
-
- Coordinates 1, 0, 0 ; no contribution
-
- Coordinates 2, 1, 0 ; contributes to W
-
- Coordinates 3, 1, 1 ; contr. to H ; W
-
|
|
Transparent statement. This statement defines a background color in the bitmap that BVE will treat as transparent. This feature enables irregular shapes, such as trees and shrubs, and complex open structures, such as fences and semaphores, to be displayed without complicated object files.
A note of caution when creating transparent images: graphic cards that are not powerful enough to handle routes when your display is set to 24-bit color or higher, need to be set to 16-bit color. If your bitmaps are saved as 24-bit color images, the transparency definition will not be recognized by monitors set to 16-bit color. The safest approach is to save your bitmaps, especially those with Transparent statements, as 256-color images.
- Format:
-
- Transparent nR, nG, nB ; 0-255 for red green and blue
-
- Example:
-
- Transparent 0, 0, 0 ; sets black as transparent
-
INVESTIGATIONS. Stay tuned. This part will be along shortly.
Top        
|