Tuesday, 3 November 2009

Shaders and kuju materials - TrainGlass.fx

The TrainGlass.fx shader in RailWorks should be used whenever a translucent glass material is required. e.g. Windows on rolling stock.

Using the glass shader the author can control the following properties:
(a)Texture - Whats on the glass, colour, scratches etc
(b)Translucency - How see-through the glass is
(c)Specular - The size of the 'shiny' highlight phong
(d)Environment Map - The intensity of the environment map (the faked reflection) in both day and night lighting conditions.

Example Use:
Windows on Rolling Stock
Point of Interest:
Only a single texture needs to be created by the author, even though there are two texture slots in this material. Both texture slots MUST contain a texture reference. The same texture can be referenced (or pointed to) in both texture slots. This second texture slot simply exists to allow the game code to carry out a second environment pass (fake reflection map) in the game.

Here we have the TrainGlass.fx shader applied to 3 assets (A,B and C), all using different parameters.

TrainGlass.fx shader viewed in the daytime.

TrainGlass.fx shader viewed in the nighttime.

Here we have the 3 materials used for the assets A, B and C. All use the same shader (TrainGlass.fx) but use different parameters. The parameters are highlighted below.

The important parameters are the UV arguments (for Slot 1 only), and the Specular Power.

UV argument 1 : This specifies the 'tightness' of the phong highlight. Keep this value somewhere between 0-64 with 64 being the 'tightest'.

UV argument 2 : This specifies the intensity of the reflection (day-time)

UV argument 3 : This specifies the intensity of the reflection (night-time).

Specular Power : This specifies how brightness (or intensity) of the phong highlight. Keep this between 0-8 with 8 being brightest.

Example texture (used for the examples above) showing RGB and intensity of alpha channel.

1 comment: