
This article is a follow-up to part 1. RoadDesign is the tool to cretae virtual worlds that comes with the Carnetsoft research car driving simulator toolset.
Egg and ref files are stored when a database is saved and the Create 3D DB checkbox is ticked. The egg files must be converted into bam files by running the egg2bam utility from the command line (via a DOS window), for example:
egg2bam -ps rel Highway.egg Highway.bam
To see all the options of the egg2bam utility, type egg2bam –h
Egg files
Sometimes you may want to modify things in the egg file before you convert it into a bam file. In that case its good if you know the structure of the egg file
- A list of all textures used. Textures for road signs, roadmarkings, TreePoly’s and Facepoly’s, are *.png (semi transparent). Textures for LandPoly’s are *.jpg. For example,
<Texture> 42 {
“textures/trees/S_Deciduous07.png”
<Scalar> wrap { repeat }
<Scalar> wrapu { clamp }
<Scalar> wrapv { clamp }
<Scalar> minfilter { linear_mipmap_linear }
<Scalar> magfilter { linear }
<Scalar> envtype { modulate }
}
This refers to a texture on a TreePoly (a rotating billboard, for trees and bushes). The folders referred to are in the \models folder where the *.bam file is located. So, the actual folder where S_Deciduous07.png is located is: c:\DriveSim3\Carnetsoft\models\textures\trees\
2. This is followed by a long list of vertices (vertex pool).
Vertices are 3D points (x, y, z). Each vertex has a unique id, referred to in polygons.
3. This is followed by a list of segments. These are the roadsegments with id’s as defined in the *.net file. So, suppose the egg file is Highway.egg, then there’s also a file named Highway.net, with segments that have id’s that refer to the segment id’s in the egg file. Segments consist of subsegments, and may have road signs of roadmarkings connected to them.
4. This is followed by a list of intersections. These have the same id’s as the intersections in the *.net file.
5. After the intersections, there’s a list of LandPoly’s. A LandPoly is a ground texture, for example a grass field. A landpoly can have any number of vertices and must consist of a closed set of vertices (first and last point connect). If always MUST have a texture connected to it . If a texture has not been defined in RoadDesign, then <TRef> { -1 } will give an error when the egg file is converted into a bam file.
6. After the LandPoly’s there’s a list of TreePoly’s. A Treepoly is either a rotating billboard, that rotates in a way that is always is turned at the the viewer, giving it a 3D impression, or a simple 3D object with a set of transparant texture. TreePoly’s are trees, bushes and other vegetation, with a transparent texture on it. They are computationally cheap.
7. This is followed by a list of FacePoly’s. A FacePoly is a vertical transparent series of polygons where a façade is displayed. This can be a wall, a forest of a hill, in fact anything that’s further away and is aimed to block the horizon
8. The FacePolys are followed by a list of 3D objects. They are referred to as externobject.
All 3D objects that are listed in the egg file must have the .egg extension, as in PowerPylon1.egg. However, it is advisable to put the larger (in the sense of containing more polygons) 3D models in the *.ref file. So, a number of 3D models will be referred to in the egg file, while the larger 3D models will be referred to in the ref file.
Ref files
A ref file contains the references to the larger 3D models. The first line of the ref file contains data referring to the switch distances of database tiles and flags, for example:
1 600 350 0 0 1 1
- The first number is the file version number
- followed by (600 in this case) the switch distance of all tiles with objects that are higher and must be visible from a larger distance
- followed by (350 in this case) the switch distance of all tiles with objects that are lower and don’t have to be visible from a larger distance
- followed by a flag that indicates whether this file is used in night driving
- followed by a flag that indicates if a background haze effects may be used in this file (can be overridden in script)
- followed by a flag that indicates if a shadows may be used in this file (can be overridden in script)
- followed by a flag that indicates if sunscattering effects may be used in this file (can be overridden in script)
After that all 3D objects (*.bam files) that are positioned in this datsbase are listed:
0 models/objects/Shed0/Shed0.bam 100 500 45.00 0 0 1 -88.00 -179.03 0.00
0 models/objects/Shed1/Shed1.bam 100 500 0.00 0 0 1 -76.00 -54.23 0.00
0 models/objects/Shed2/Shed2.bam 100 500 45.00 0 0 1 -84.00 172.55 0.00
This has the following structure:
- 0 or value > 0: if >1 then its the id of an object that can be manipulated from script (for example change the texture during an experiment).
- name of the model (must have the *.bam extention)
- switch distance1 (obsolete)
- switch distance2 (obsolete)
- heading, pitch, roll of the object in degrees
- unused (always 1)
- x, y, z coordinate where center of object is located
The *.ref files can be manually editted if you want to change the position or orientation of the object.
Like this:
Like Loading...