Tutorial 21: Lighting Entites



You have all models lit with level directional lighting, which is the default. You change this lighting (for all models) at any time with SETAMBIENTCOLOR & SETAMBIENTCOLOR. This is a Primary light source. (In Film lighting it is called the KEY light)

You can add lighting to a specific model using the LIGHTING cmd. This is a Base Light source or a secondary Light source. (in Film this would probably be called the FILL light). A model gets its Base light value from the Shadow(or Light Map) under it’s origin point.

Models are lit by these 2 light sources.The overall ambient(PRIMARY/KEY light) and the value underneath its origin point (Base/FILL Light). 2 Lights require more CPU than 1 light, so a lot of secondary Models, like cups & things didn’t have the Primary light on it. The entity.dat has a flag for models that get affected by LIGHTING/both. Look in entity.dat for reference.

You can change the AMBIENT/KEY light (for 1 model) to a moving light source using the LIGHTSRC command.

OR

You can change the AMBIENT/KEY light (for 1 model) to a still light source using the DIFFUSE command.

Make a fresh new script with boots on a node
Newent=character_boots:floor=1
Make sure he is nicely centered and fills the screen.
Now most Anox maps have a light value associated with them AND a direction. This is set in the APE file associated with the map. PLANET & APE use the same command:
SETAMBIENTCOLOR=[r,g,b]
SETAMBIENTDIR=[x,y,z]
These values are affecting boots right now. You can change these values yourself in a PLANET script (on the MASTER command path). They are permanent, so I would rarely use them. This would affect EVERY MODEL IN THE LEVEL!!!! But you should definitely PLAY with them to see how they work.

Change their values and see how it affects the lighting on boots.
Make another node next to boots and give it this cmd:
Newent=mys_whitesphere;floor=0
This is a whiteglobe. See how the light affects both.

Now for some individual lighting. change
Newent=mys_whitesphere;floor=0;lighting=0=.01=.01=.01
Play script. This gives value of r=.01 g=.01 b=.01
Which is Black!
try
Newent=mys_whitesphere;floor=0;lighting=0=1=.01=.01
It should look red.
Try other colors.

Newent=mys_whitesphere;floor=0;lighting=0=1=1=1
This is fullbright!

Newent=mys_whitesphere;floor=0;lighting=0=0=0=0
Sets it back to the default.

Remember when you flew the automap around, did you notice how it changed its light values?
That is because it was picking up lightmap values in 3D space, NOT on the ground. Just lock down the lighting with the LIGHTING=0=R=G=B command.

LIGHT SOURCE
Instead of the ambient light you can give an entity a LIGHT SOURCE. You put that light Source on a path. Goto boots cmd line. Add an extra node. Move it to 0.1 secs. THIS MUST BE PLACED AFTER THE FIRST NODE! Click on node & type:
Lightsrc=10
This will mean boots will take light from whatever is on track 10.

So lets something on track 10.
Place a node on track 10. on it’s cmd line put
Newent=ob_squib;floor=0;lighting=0=1=1=1

A squib is a super awesome MULTI purpose entity. It is invisible, but it exists with 6 surfaces that effect can be placed on. More on that later.

Play the script, is boots being lit by the squib?

If you can’t tell, move the squib closer to boots OR increase the SCALE of the squib, which is preferred! If he still doesn’t look lit, he may need some NEGATIVE lighting (or Contrast, by adding BLACK/shadow). So change his cmd to read
Newent=character_boots:floor=1;lighting=0=.1=.1=.1
This will darken his overall lighting so that you can see the light source better!

Change the lighting on the squib and it will change the color affecting boots. By lighting=0=1=0=0, etc.

NOW add some nodes to the squib path and move it around boots. Play the script. Neato!

Put a node on the whitesphere cmd line at .1 and give it the: Lightsrc=10

Both models should be affected by that squib light. Remember… Only 1 light can effect the model.

DIFFUSE LIGHTING
DIFFUSE=[hexvalue(color),X,Y,Zdirection]

A neat lighting tool that can be changes many times on a models cmd path.

Place a white sphere on a path. Keep it motionless. Add lighting=0=.1=.1=.1
This will make it easier to see what we are about to do.

Make a second cmd node. Click on the node button. See that diffuxe box at the bottom with color sliders? Pick a color using the sliders. Now LOOK AT THE ORIGIN POINT AND PRETEND THAT YOU ARE THE LIGHT. Hit the diffuse button. You just saved that light ANGLE relative to the origin point. Play the script.

NOTE: if you have lighting=0=1=1=1 there is to much FILL light to even see the KEY light. They work in conjunction. Bring down the lighting to =0=.1=.1=.1

NOTE: You can only have ONE of these lights.

NOTE: if the model moves it will always keep that light direction. NOT like LIGHTSRC which is a fixed point on a path. (Unless you a removing that path of course)

Set all the diffuse parameters to 0 (zero) to restore it to the defaults.