Tuesday, 3 November 2009

Shaders and kuju materials - WaterCubemap.fx

In Railworks there are a number of ways of creating water assets in your route.

(1) Rivers - Here a river loft is recommended. This asset would use the WaterCubeMap.fx

(2) Lakes and Seas - The in-game (editor mode) water decal is recommended as it is the most efficient way to create a large expanse of water.

(3) Scenery - Sometimes a very small localised water effect is required on a scenery asset that is irregular in shape. In this case, the WaterScenery.fx shader can be used.

Using the WaterScenery.fx shader, the author can create a scenery asset and assign the WaterScenery.fx to any polygon. Therefore the shape of the water surface is under the control of the author. This asset can be exported as usual via a the IGS format and be referenced in a 'Scenery Blueprint'.

Example Use
Water troughs, swimming pools, circular ponds, open water towers etc.
Points of Interest
This is a vertex shader (meaning the positions of the vertices of the surface are physically moved) is therefore expensive to render. It is therefore recommended to keep its use down to a minimum.

Notice that the surface of the water shown below is no longer flat as seen in the other water shaders.

As can be seen below, the shader is a triple pass shader with 3 texture slots. All texture slots MUST contain a reference to a texture. In slot 1, we specify the normal map texture, along with the five UV arguments and specular value. In both slots 2 and 3 we specify the texture for the water surface.

The following UV arguments should be setup for slot 1 of the shader.

UV argument 1 : Specular component (values between 0 and 64)
UV argument 2 : 'Wobble' factor (values between 0 and 1)
UV argument 3 : Movement speed (0.02 is a good value)
UV argument 4 : Oscillation height (0.02 is a good value)
UV argument 5 : Oscillation scale (6 is a good value)

Below are example textures showing the alpha channels where applicable.

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.

Saturday, 24 October 2009

Shaders and kuju materials - Part 2 - Texdiff

Good old tex diff, the default shader you should use the first time you try to display anything in game.
Why? Because it needs no extra work in setting up, it's the quickest shader to use to find out if something is wrong with your model or texture.

This shader is lit by diffuse lighting.
Example use:
Small clutter objects.
Point of Interest:
This is a 2 sided material. however the polygons only get lit correctly from one side in game.
Also, be careful when putting 2 surfaces close together when using this material, as the material is 2 sided and even though poly normals are facing away from each other you will get z fighting which will cause the surfaces to flicker as they fight to be displayed.

There are many legacy buttons and values in all of the Kuju shaders many of them do not function in RWs, even the team have not explored all of the options!

1 - Mip LOD Bias.
This is used to push the mipping further out or bring it in.
Normally we leave this at 0.
However if you want to push the mipping out on textures (For dials in cabs,logos/text on the side of trains etc) a minus value needs to be used. Thi means the texture stays sharper for longer the further you pull away. -2 is what the team use for mnost dials in cabs.

2 - Transparency.
NONE or TRANS, speaks for itself. If your texture is 24 bit then leave this on NONE as default.
Below is an example texture and it's alpha channel.

Texture - Diffuse texture

Texture - Alpha channel

Texdiff - without transparency

Texdiff - with transparency

If you have an alpha channel in your texture and it is saved as 32 bit and you want the alpha to be used then Change this to TRANS.
(Black is transparent and white is solid in the alpha channel)

3 - Lighting Material
These settings don't get used much by the team but you can change the Diffuse Colour, Ambient Colour and Emissive Colour.

This is useful if you make a greyscale texture and colourise it by one of these methods.
For Example, create 1 car texture and create many coloured versions by this method. A great way to keep texture count down.

Specular and Specular power are not used in this material.

Tuesday, 20 October 2009

Shaders and kuju materials - Part 1

To get assets into RailWorks they must have a kuju material assigned, without them you will never get anything to appear in RailWorks.
To get the materials to show up in 3DS max you need the kuju plugins, these are available from the RailSimulator website:
(I don't use Canvas, but anyone willing to do a canvas version of posts please contact me)
Follow the read me inside the downloadable zip to install the plugins for 3dsMax and Photoshop.
Once the plugins are installed start Max.
Enter the material editor and click on the Standard button (1)

In the list click on the Kuju Material (2) This then put the kuju list of materials in place of the standard materials.

Click on the arrow next to the default RWs material TexDiff (3)
The full list of kuju materials show.
RailWorks/Simulator only uses a few of these materials.

End of Part 1

Sunday, 20 September 2009

Get organised

Before we talk about art and creating we need to talk about structure.
Being creative is great, but being organised is key to managing your work.

Folder structure

For Provider and product information please see the RWs wiki;
Setup a folder structure in source that makes sense to you and others who may need to activate it in the set object filter.
My provider name is always RSderek, within the RSderek folder I have different folders, these are my products.
One of my products is; WearValleyRailway, I have others called Giveaway, Class02 and SW1500.
There are others but they are top secret!


Use sensible names.
I have come across many downloads from UKTS and TS.com that use the word Addon as the product.
How is anyone supposed to know what that is when they are ticking it?
Also, keep projects seperate, no need to bloat yours or users routes with unwanted addons/assets.

Lastly, keep all files in each folder separate, don’t share any files between products.

These are the basics, but I still see users not setting them up correctly.
Get organised!


Wednesday, 16 September 2009

Where art thou?

In this blog I'll be talking about how RS.com go about creating art assets for RailWorks.

There will be a Q and A, tutorials, hints and tips along with posts from guest creators.

If you are a budding content creator for RailWorks then this is the place for you.

Before we get going there is already a wealth of information on the RWs Wiki;