anachronox-sdk/docs/planet/21.html
2002-01-21 00:00:00 +00:00

109 lines
5.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>Anachronox Editing Documentation</TITLE>
</HEAD>
<BODY BGCOLOR="#000000" TEXT="#EFEFEF" LINK="#00FFFF" ALINK="#FFFFFF" VLINK="#05F3D0">
<CENTER>
<P>
<FONT FACE="Helvetica">
<FONT COLOR="#0055DD"><B>Tutorial 21: Lighting Entites</B>
</FONT>
</CENTER>
<P>
<HR>
<BR>
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)
<P>
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 its origin point.
<P>
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 didnt 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.
<P>
You can change the AMBIENT/KEY light (for 1 model) to a moving light source using the LIGHTSRC command.
<P>
OR
<P>
You can change the AMBIENT/KEY light (for 1 model) to a still light source using the DIFFUSE command.
<P>
Make a fresh new script with boots on a node<BR>
Newent=character_boots:floor=1<BR>
Make sure he is nicely centered and fills the screen.<BR>
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:<BR>
SETAMBIENTCOLOR=[r,g,b]<BR>
SETAMBIENTDIR=[x,y,z]<BR>
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.
<P>
Change their values and see how it affects the lighting on boots.<BR>
Make another node next to boots and give it this cmd:<BR>
Newent=mys_whitesphere;floor=0<BR>
This is a whiteglobe. See how the light affects both.<BR>
<P>
Now for some individual lighting. change<BR>
Newent=mys_whitesphere;floor=0;lighting=0=.01=.01=.01<BR>
Play script. This gives value of r=.01 g=.01 b=.01<BR>
Which is Black!<BR>
try<BR>
Newent=mys_whitesphere;floor=0;lighting=0=1=.01=.01<BR>
It should look red.<BR>
Try other colors.<BR>
<P>
Newent=mys_whitesphere;floor=0;lighting=0=1=1=1<BR>
This is fullbright!
<P>
Newent=mys_whitesphere;floor=0;lighting=0=0=0=0<BR>
Sets it back to the default.<BR>
<P>
Remember when you flew the automap around, did you notice how it changed its light values?<BR>
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.
<P>
<B>LIGHT SOURCE</B><BR>
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:<BR>
Lightsrc=10<BR>
This will mean boots will take light from whatever is on track 10.
<P>
So lets something on track 10.<BR>
Place a node on track 10. on its cmd line put<BR>
Newent=ob_squib;floor=0;lighting=0=1=1=1<BR>
<P>
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.
<P>
Play the script, is boots being lit by the squib?
<P>
If you cant tell, move the squib closer to boots OR increase the SCALE of the squib, which is preferred! If he still doesnt look lit, he may need some NEGATIVE lighting (or Contrast, by adding BLACK/shadow). So change his cmd to read<BR>
Newent=character_boots:floor=1;lighting=0=.1=.1=.1<BR>
This will darken his overall lighting so that you can see the light source better!<BR>
<P>
Change the lighting on the squib and it will change the color affecting boots. By lighting=0=1=0=0, etc.
<P>
NOW add some nodes to the squib path and move it around boots. Play the script. Neato!
<P>
Put a node on the whitesphere cmd line at .1 and give it the:
Lightsrc=10
<P>
Both models should be affected by that squib light. Remember… Only 1 light can effect the
model.
<P>
<B>DIFFUSE LIGHTING</B><BR>
DIFFUSE=[hexvalue(color),X,Y,Zdirection]<BR>
<P>
A neat lighting tool that can be changes many times on a models cmd path.
<P>
Place a white sphere on a path. Keep it motionless. Add lighting=0=.1=.1=.1<BR>
This will make it easier to see what we are about to do.
<P>
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.
<P>
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
<P>
NOTE: You can only have ONE of these lights.
<P>
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)
<P>
Set all the diffuse parameters to 0 (zero) to restore it to the defaults.
<P>
<P>&nbsp;<P>
</BODY>
</HTML>