How to make a Platform light with emissive glow

 

In the route of your ‘Provider’ make a new folder called Lights. This is where you will keep the max, igs and xml files.

In the Lights folder make a Texture folder. This is where you will keep your textures

 

Step 1: Gizmo creation

We need to make a Point light gizmo.

This is what we will use to determine where the light effect gets generated from. This gizmo you will be able to move around in the Asset editor.

 

I have made a 30cm Diameter sphere with a Tex material, the texture is a bright pale yellow, 64/64 pixels, planar mapped from the top.

This I centred at 0/0/0 in max.

 

 

 

Export this into a igs file.

point_light.IGS

 

Step 2 Make the point light xml.

 

Right click the point_light.IGS in the asset editor and click new shape blueprint and select point light blueprint.

 

Treat this just like any other scenery object, name it in the relevant fields, and give it a provider product in Primary named texture set.

 

In the light component section give the light a radius, I have given mine 10 (M)

 

Give your light a colour, I picked a warm yellow/orange.

Click Save.

 

Preview your shape and you will have your object in front of you. Click the Day/Night cycle button in the top left flyout menu. Your object should glow (because of the tex material)

Select your object and lift it up in the scene. You will see that it now emanates light. Experiment with the light and radius values to get the desired effect you want.

 

 


 

Step 3: Light Asset Creation.

There will be at least 3 objects in your scene but 5 materials:

 

Objects in scene:

 

1_0500_LampPost

1_0500_bulb_day

1_0500_bulb_night (with Forward facing glow element)

 

I have a 4th object which is the glass.

1_0050_glass

 

 

 

 

Materials used:

 

Material 1 used on  1_0500_LampPost. It can have any material you want, I have a TrainBasicObjectDiffuse. It uses 1 256/256 texture which I boxed mapped.

 

Material 2 used on 1_0500_bulb_day. It can have a tex or a TrainBasicObjectDiffuse. It uses 1 32/128 texture which I planar mapped.

 

Material 3 used on 1_0050_glass. It has the Trainglass.fx shader explained in a previous blog post.

 

Material 4 used on 1_0500_bulb_night This uses the TrainEmissiveGlow.fx shader

 

In the sub material slot 1 I have a diffuse texture very much like bulb day texture. However I colour the bulb section yellow (this is used for the colour of the glow) Name this texture Bulb.ace

 

 

 

In the sub material slot 2 (making sure the same UV channel is used (1)) I have a texture that is the same size as my bulb texture but it is black and white. The white area defines the glow area, the black is the non glow area. name this texture with Bulb_EM.ace

 

 

 

There is a second element (but part of the same object) to 1_0500_bulb_night which is a simple plane centered through the bulb.

This plane uses material slot 5 which is AddATex. The texture is all black except for a faint glow in the centre. make sure you name this with _nm so that it does not get compressed.

 

 

 

This material has the View facing flag ticked under the Viewer Facing options.

Save the max file and export as an IGS, I called mine Platform_light.IGS

NB The bulbs are named so that the day bulb will show during the day and the night bulb will show at night.


 

Step 4: Bringing it all together.

 

In the asset Editor right click the platform_light.igs and select New shape blueprint, then select scenery blueprint.

 

Preview shape, you lamp should be as you expect it. Click on the day/night button and see your bulb glow.

 

 

 

Name the relevant fields, and give it a provider product in Primary named texture set. Expand Children and click insert first.

Give the Child name/provider product and select your previously made point light and click preview.

 

Your point light orb will be at 0/0/0 select it and move to the correct place. 

 

 

 

Click Save and Export.

 

Your light should now be viewable in game.

 

 

Shader "TrainBumpSpec.fx"

 
TrainBumpSpec.fx is the material we use when we want something to have a brushed metal appearance. A good example would be the material used on the areas of a wheel that is in contact with the rails.

Consider this simple wheel.

We use two different materials for the wheel. One material will be dull (something like a basic TexDiff material) and used over most of the wheel. The second material is our "TrainBumpSpec.fx" and will be used on the contact areas. This will be the shiny metal material.

See the two selections below.

TrainBumpSpec.fx is a two-slot shader. Slot 1 references the main RGB texture "wheel1", and slot 2 references the normal map "generic_nm". The important thing to remember is to set the 'phong' size (size of the specular highlight) and the specular power. The 'phong' size is set by specifying "32" in the first UV argument in slot 1

Slot 1:


Slot 2:


The specular power is set at 4.0. See below.


Using these values, the wheel should look something like this.


Example wheel texture
 

Shader "TrainLightBumpSpecMask.fx"

 
I have seen a few people confused on new shaders, also seen one person post up how it does not work when it is clear he has his material set up wrong.
So, here I am to teach those who want to get their learn on.
 
TrainLightBumpSpecMask
 
Use this shader on scenery objects that require normal maps, specular maps and ambient occlusion maps.
 
 
Ambient occlusion
In basic terms, when creating these assets, think of an ambient occlusion map as a shadow-map. Light areas of the map are unaffected and dark areas of the map represent the shadowy areas (under gutters or in crevices).
The Shader
Use this shader on foreground buildings. Group assets that are built specifically for use as a background object should not use this material.
 
Slot 1 is the diffuse texture. (1st mapping channel)
 
 
Slot 2 is the normal map (24bit) with specular map (8bit) in the alpha channel. (1st mapping channel)
Slot 3 is the Ambient Occlusion map. (second map channel (shadow/lightbake))
 
Generally, make slot 1 and slot 2 share the same UV channel 1, and the Ambient Occlusion map have a second UV mapping channel 2. This allows for the same flexibility as when using the old shadow-map technique on the old legacy assets.
 
Example
Trackside Buildings
 
 
 
One thing to understand about this material and Trainlightmap with Diffuse, surfaces that point upwards the shadow bake gets washed out by the sun because it is a light.
 
If the same shadow/light map was applied to a vertical surface in stead of a horizontal one the shadow is more pronounced. (see image 3)
 
Shining a torch in a shadowed baked area now gets lit up, you would not expect to see a soft shadow that was generated from a global light would you?
 
 
Example of the occlusion map.
 
Once you have your materials set up correctly you can see how it looks.
 



This is a great shader to use on stations or any other track side buildings. Buildings away from the track really do not need this material.
 

Shader "AddATex"

 
AddATex is the material we use for additive glows. Example uses include glows around bulbs, glows around headlights and glows on surfaces (from streetlights).

As this effect is additive, these effects are visible both day or night, but are more effective and more visible at night. For our example, we'll consider a streetlight.


Here you can see the streetlight asset with a night time node. This node will simply switch on (become visible) at night time.

If you examine the 3DSMax wireframe view, you can see that there are two glows contained in this asset, one upper glow centred around the bulb and one lower glow on the floor itself. Both of these glows use the AddATex material but with slightly differing properties.

The bulb glow needs to always face the camera, so that it gives the effect of a simple lens flare. This will need to have the 'VIEW FACING' flag ticked in the material.

The floor glow needs to be static and remain in position, and therefore should use the default 'NOT VIEWER FACING' flag.

Our two AddATex materials are detailed below. The material on the left is for the bulb glow and the material on the right is for the floor glow. Notice the viewer facing flags in the materials.

Also note that as these materials use alpha, the Z-Buffer mode is set to 'TEST ONLY' in both. This ensures the materials render correctly.



Example textures :