WiseTrainLight: Burning light onto Entities

From Valve Developer Community
Jump to: navigation, search

This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

(Porter's note: I have to say, there's a lot of other methods to get these effects that usually look nicer, are easier to tune, and don't drive up compile times. Try using an info_lighting, or $selfillum, VertexLitGeneric, or UnlitGeneric in your vmt, maybe encase your object in toolsblocklight and tinker around with Minimum Light Level and render modes, and that whole group of similarly-named keyvalues.)

When using func_tracktrain and any other entities that move or rotate in your maps there are methods you can use to actually burn light onto them. As you will see in some of the images below entities can even appear to be self-illuminating.

Note.pngNote:The sample project below is based on WiseTrains4. These trains are the same as the ones in that tutorial except they are being spawned in another location that is well lit.
In that same lighting room I’m also spawning a rotating object, prop_physics bucket and func_physbox wooden cube.

Entities like func_tracktrain can be spawned far away from your map. The room you spawn them in can contain its own lighting.

When your func_tracktrain starts out on its first path_track, as specified in its properties, the lighting it spawned with will be burned onto the entity. The set of rotating brushes I created illustrate how important it can be to spawn object like this with the proper lighting. One of these rotating brushes has an odd looking shadow that rotates with it. The other was spawned in the lighting room. As you can see this can be controlled as well, by controlling the lighting and shadows around rotating brushwork. Notice that the prop bucket and the wooden cube were spawned in the same light room with the func_tracktrain.

As you can see the prop is still dark but the brush based func_physbox wooden cube appears to be self-illuminating. (Porter's note: The solution to making the prop be brighter would be to put lights nearby it, just like you would do with a normal object in real life.)

See also