Rigs-of-rods: Let's "optimize" the "tracks/trans" material.

Created on 23 Jun 2017  路  5Comments  路  Source: RigsOfRods/rigs-of-rods

When spawning a vehicle, RoR automatically generates graphical elements which are not always desired by the modders:

  • flares -> Generate billboard flares. Some modders only want materialflarebindings without the billboard flares (i.e. https://github.com/RigsOfRods/rigs-of-rods/issues/1341).
  • submesh -> Always needed for collision, but also generates cab mesh (flexable). Most vehicles want to use meshes for chassis. EDIT: Not true actually, the optional sub-section texcoords generates the submesh, as clarified by Michael10055
  • [mesh]wheels[2] -> generate either tire or entire wheel as flexable mesh. Mostly undesirable, modders want to fit their own mesh into the wheel.
  • wings - generate flex airfoil. Again, most vehicles want to use meshes for wings.

The usual trick is to use a completely transparent material for these objects; either the builtin "tracks/trans" or a custom one like "gavrilinvis" managedmaterial found in Gavril vehicles.

However, this approach has a catch: the objects are still created and updated on runtime -> outrageous waste of performance. Notably the flex-meshes waste both CPU power to compute and precious RAM->videocard bandwidth to update.

My suggestion: Let's constitute the "tracks/trans" material name as special-case value which will actually disable generating the graphical objects. The actual material should then be removed -> if some object disrecpects the "tracks/trans" flag, it's a bug and should be treated as such.

enhancement

Most helpful comment

Tech proposal (WIP)

The idea is to enable modder to completely disable automated mesh generation or mandatory mesh loading. Until now, modders archieved this by using builtin transparent material "tracks/trans" or custom transparent mat.

This will be archieved by 2 changes:

  • Introducing a special reserved string ^omit_mesh which, when used as a mesh/material name, will disable generating/loading the respective mesh instead.
  • Constituting tracks/trans as an alias of ^omit_mesh for backwards coverage of existing content using the 'tracks/trans' trick.

(WIP) List of all truckfile sections to be modified, with comments:

  • globals - param 'material'
    Defines the default material for 'cab mesh' - mesh generated by section submesh, subsection texcoords. Note: simply omitting the subsection texcoords should prevent the cab mesh from being made - however, many modders seem to put tracks/trans to globals anyway. Further research needed.
  • wheels[2] - params 'face mat' and 'band mat'
    RoR automatically generates mesh for these wheels. If any of the above params is ^omit_mesh, though, the mesh won't be generated.
  • meshwheels[2] - params 'rim mesh' and 'tyre material'
    Param 'rim mesh' can disable loading and displaying the mesh.
    Param 'tyre material' can disable generating the flexable mesh, allowing modder to fit custom flexbody to the wheel.
  • flares[2] - param 'material'
    The param can disable generating the billboard flare, allowing modder to use only materialflare for it.
  • wings - affected by 'globals'
    Wings get auto-generated mesh with material specified in globals - put^omit_mesh there to disable.

All 5 comments

a true invisible non-rendered non-texture sounds good, would help with shadows the most as the transparent textures have to be further processed

For submesh, the texcoords section generates the "cab mesh" and is not required. Only the cab section is needed for collision.

In addition, transparent objects get visible right now depending on view angle and background, this might be a shader issue.
So i would support making material tracks/trans just not be rendered.

Attched:
Pic: Mean Machine Baja rear guidance wing visible with water in background.
screenshot_2017-07-31_08-36-14_1

Pic: Mean Machine Baja rear guidance wing visible node/beam view (just to show where it is)
screenshot_2017-07-31_08-39-05_1

Tech proposal (WIP)

The idea is to enable modder to completely disable automated mesh generation or mandatory mesh loading. Until now, modders archieved this by using builtin transparent material "tracks/trans" or custom transparent mat.

This will be archieved by 2 changes:

  • Introducing a special reserved string ^omit_mesh which, when used as a mesh/material name, will disable generating/loading the respective mesh instead.
  • Constituting tracks/trans as an alias of ^omit_mesh for backwards coverage of existing content using the 'tracks/trans' trick.

(WIP) List of all truckfile sections to be modified, with comments:

  • globals - param 'material'
    Defines the default material for 'cab mesh' - mesh generated by section submesh, subsection texcoords. Note: simply omitting the subsection texcoords should prevent the cab mesh from being made - however, many modders seem to put tracks/trans to globals anyway. Further research needed.
  • wheels[2] - params 'face mat' and 'band mat'
    RoR automatically generates mesh for these wheels. If any of the above params is ^omit_mesh, though, the mesh won't be generated.
  • meshwheels[2] - params 'rim mesh' and 'tyre material'
    Param 'rim mesh' can disable loading and displaying the mesh.
    Param 'tyre material' can disable generating the flexable mesh, allowing modder to fit custom flexbody to the wheel.
  • flares[2] - param 'material'
    The param can disable generating the billboard flare, allowing modder to use only materialflare for it.
  • wings - affected by 'globals'
    Wings get auto-generated mesh with material specified in globals - put^omit_mesh there to disable.

I'm removing this from v0.4.8 milestone because we're getting late with the release and this is just a performance enhancement (nothing critical).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Speciesx picture Speciesx  路  9Comments

CuriousMike56 picture CuriousMike56  路  12Comments

Speciesx picture Speciesx  路  8Comments

only-a-ptr picture only-a-ptr  路  11Comments

DirtGamer301 picture DirtGamer301  路  11Comments