RoRBook/Meshes
From Rigs of Rods Wiki
- Introduction
- Working Environment
- Land-based Vehicles and Basics
- Objects and Texturing
- Aircraft and Winged Vehicles
- Nautical Vehicles and Boats
- Packaging
Contents |
Meshes
Foreword
So, you want to make static objects for Rigs of Rods? Well, there are certain idiosyncrasies about meshes in Rigs of Rods which need to be accounted for. This article will go over the basics of meshes and how they work.
What is a mesh?
A mesh is a collection of triangle shaped faces with textures on them, essentially. Anything can be simulated with a mesh, though some things are better simulated with other methods. Meshes are used by Rigs of Rods to simulate static objects (roads, buildings, etc.), props (objects attached to vehicles which are too complex to simulate via nodes-and-beams, such as fueltanks and the like), and, new in 0.36, flexbody vehicles (meshes which deform according to the vehicle's deformations). You can create a mesh with any 3D program with an OGRE exporter (Blender, 3DS, AC3D, Google SketchUp, etc.)
Meshes in Rigs of Rods
Rigs of Rods meshes use the .mesh format used by OGRE, its graphics engine. We will not teach how to 3D model here, because that would fill another three or four wikibooks, but we will give you some basic guidelines.
Modeling
Keep your models low-poly, as Rigs of Rods does not yet support LODs.
Collision Mesh Modeling
Keep everything as one continuous surface rather than a collection of boxes so as to not confuse the collision engine. Animated collision meshes are not supported. For more info on collision mesh troubleshooting, see Collision Mesh Troubleshooting.
LODs
What's a LOD?
LOD is short for "Level of Detail" and it refers to meshes which reduce in detail according to the distance from the observer. For example, the object may have 2,000 polys if one is right next to it, but only 200 if one is 200 meters away.
Creating LODs
LODs are now explicitly supported by Rigs of Rods. To create a LOD mesh, make a lower-detailed version of your mesh, and export it with a different name, i.e. "mesh_lod1.mesh" or something of that ilk. Then, define the LODs in the .odef file (described below).
The .Odef file
An odef file is formatted like this:
mymesh.mesh 1,1,1 beginmesh mesh mycollisionmesh.mesh endmesh beginlodmesh 100, mymesh_lod1.mesh 300, mymesh_lod2.mesh 1000, mymesh_lod end
First is the name of the mesh. Then the scale (Usually just leave this as it is.) Then we define collision meshes. This starts with "beginmesh", then the collision mesh prefixed be "mesh", then "endmesh". Then we define LOD meshes. The number is the distance in meters from the camera when the mesh switches to the LOD specified. The file MUST terminate with "end" or it'll crash the program.
That's it for this article, head on over to Tools for info on how to export from your favorite modeling program.


Gold
Silver
Bronze