Shadows

Rigs of Rods is using the PSSM (Parallel-split Shadow Maps) shadows technique. Shadows textures are splited into 3 different texture with different resolutions and size. The closest one to the camera is the smallest and has the biggest resolution. the second and the thirds are sometimes equal in resolution but not in size. Shadows details progressively degrade as soon as you get into the 2nd and 3rd split.

How to make your models receive shadows

I have been working hard on making material management easier for modders so it will be the last thing they’ll take care of. Note that using these, your vehicles won’t work in any version lower than 0.4.5 anymore!

Vehicles

For vehicles, you can simply use the managedmaterials section of the truck file, which will give you shadows instantly without any problems.

If you want to use your own material file, you will have to proceed in this way:

On the 1st line of the material file, put this line of code:

import * from "managed_mats.material"

If you want to go simple, you can do it this way:

material material_name_here: RoR/Managed_Mats/Base
{
	set_texture_alias diffuse_tex texture_name_here.dds
}

Do not forget to add the : RoR/Managed_Mats/Base after the material’s name.

Or for more control over the material file, you can do it this way:

material material_name_here: RoR/Managed_Mats/Base
{
	technique BaseTechnique
	{
		pass BaseRender
		{
			//Ambient, diffuse, emissive stuff here

			texture_unit Diffuse_Map
			{
				texture texture_name_here.dds
			}
		}
	}
}

Notice here that in addition to the : RoR/Managed_Mats/Base, the technique has a defined name BaseTechnique, the pass has a defined name BaseRender, and the texture has a defined name Diffuse_Map.

As soon as you put all these three, you will get working shadows with a detailed material file. You can still add as many techniques/passes as you want but do not use the same names again, you can simply not name them.

Objects

Use the same technique as explained above.

Misc

Other than the “ RoR/Managed_Mats/Base” inheritance, you can use all these for each type of texture/model used.

RoR/Managed_Mats/Base
RoR/Managed_Mats/BaseNoShadows
RoR/Managed_Mats/BaseSpecular
RoR/Managed_Mats/Vegetation
RoR/Managed_Mats/Transparent

You can take a look at Rigs of Rods/resources/managed_materials/managed_mats.material for more understanding of how it all works.

Edit page on GitHub