For licensing the physics technology contact licensing@rigsofrods.com

Adding Glow

From Rigs of Rods Wiki

Jump to:navigation, search

What is glow

Glow is an effect that 'overdraws' a certain texture so it looks like it glows by lighting.

Credits

The scripts and ideas were from nikki from this thread: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=52316&start=0

Examples


Requirements

latest RoR version, which includes the glow feature.


How to add glow to truck flares

if you know how to add materialflarebindings its relatively easy:

  • ensure the materialflarebinding is working
  • for example we take this material as example:
material AC3D/Box5W900/Mat004_NoTex
{
	technique
	{
		pass
		{
			emissive 1 1 1 0.3
			texture_unit
			{
				anim_texture W900_headlight_material.png 2 0
			}
		}
	}
}
  • add the default glow scheme technique (you don't need to change any values except the texture)
material AC3D/Box5W900/Mat004_NoTex
{
	technique
	{
		pass
		{
			emissive 1 1 1 0.3
			texture_unit
			{
				anim_texture W900_headlight_material.png 2 0
			}
		}
	}
	technique
	{
		scheme glow
		pass
		{
			texture_unit
			{
				texture W900_headlight_material_1.png
			}
			ambient 0 0 0
			diffuse 0 0 0
			specular 0 0 0 1
			emissive 0 0 0
		}
	}
}
  • change the texture of the glowing technique to reflect the image you used for your headlights. (you should use the 'on' state)
  • start the game with "Glow=Yes" in your RoR.cfg. and test if the material glows.


How to add glow to any other objects

  • you can add glow to any object you want, just use the technique from above. The Ambient and diffuse colour value will define the glow-amount.

Example

  • exchange the master material in resources/materials.zip / tracks.material:
  • original:
material tracks/master
{
	technique
	{
		pass
		{
			texture_unit
			{
				texture master.dds
			}
		}
	}
}
  • new with glow:
material tracks/master
{
	technique
	{
		pass
		{
			texture_unit
			{
				texture master.dds
			}
		}
	}
	technique
	{
		scheme glow
		pass
		{
			texture_unit
			{
				texture Random_glow.png
			}
			ambient 0.5 0.5 0.5
			diffuse 1 1 1
			specular 0 0 0 1
			emissive 0 0 0
		}
	}
}
  • add this image to your materials.zip: Random_glow.png
  • you should get something like this:

Glow added to objects

Advanced things

Debug glow

You can test if things are glowing directly by changing the .cg script that combines the glow with the scene:

  • Find the glow.cg script (in materials.zip in resources) and change "#define RENDER_SCENE 1" to "#define RENDER_SCENE 0"
  • this will only render glowing parts in game. Everything non-glowing will be black. You should see something like this:
glow debugging: only render glowing objects