anachronox-sdk/docs/modellights.html

112 lines
4.7 KiB
HTML
Raw Permalink Normal View History

2002-01-21 00:00:00 +00:00
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="Microsoft Word 97">
<TITLE>HOW TO USE MODEL LIGHTS</TITLE>
</HEAD>
<BODY TEXT="#FFFFFFFF" LINK="#0000ff" VLINK="#800080" BGCOLOR="#000000">
<FONT FACE="Tahoma">
<center>
<p><h1><font color="#FFFF00">HOW TO USE MODEL LIGHTS</P></h1></font>
</center>
<blockquote><p><i>Yes, that's right, we finally have model lights on MD2s. Thanks to Henrik's fixing of
lw2md2, you can model light entities that have been redelivered with the new tool (or CTCs) </p></i></blockquote>
<h2><P>Creating Lights</P></h2>
<blockquote>
<h3><p>Creating Point Lights</h3></p>
<p>To make point lights, you must make an entity with the classname "modellight". Then, set the key, "lighting" to be the radius of the light.
This is the distance from the source that the light will affect entities. Set the R, G, and B keys to be the color of the light.</p>
<p><h3>Creating a World Ambient Light</h3></p>
<p>You can also have a default light source which will affect all entities that aren't in the range of one of the light entities. This is
the world ambient light source. To set this, you set the angles of the worldspawn for the direction and the R,G,B values for the color. This
is an infinite parallel light source which will affect all relevant entities.</p>
</blockquote>
<p><h2>Flagging an Entity as Lit</h2></p>
<blockquote>
<p>By default, all entities are not directionally lit. That is, if the lighting field in the entity.dat is 0, it won't be affected by
these model lights. To change this, change the field to either 1 or 2. If 1 is selected, only model lights will affect the entity (including the world ambient).
If it is set to 2, the normal lighting scheme will be mixed with the directional light so it's effectively combining both the standard Quake2 lighting model with
the model lights</p>
</blockquote>
<p><h2>Controlling Ambient Lights</h2></p>
<blockquote><p>
You can modify the direction and color of the dynamic light through a series of APE and Planet commands. This is useful for when you move to
significantly different areas where the lighting needs to be drastically different (such as going from inside to outside, etc.)</p>
</blockquote>
<blockquote>
<p><h3>In APE</h3></p>
<p>Change the color with the following command:</p>
<font = "courier"><i>
LIGHT_SetAmbientColor [r] [g] [b]
</font></i>
<p>
Where R, G, and B are the Red, Green, and Blue components of the ambient light color
</p>
<p>Change the direction with the following command:</p>
<font = "courier"><i>
LIGHT_SetAmbientDir [yaw] [pitch] [roll]
</font></i>
<p>
Where, yaw pitch and roll are the angles of the light direction vector.
</p>
<p><h3>In Planet</h3></p>
<p>Change the color with the following command:</p>
<font = "courier"><p><i>
setambientcolor [r] [g] [b]
</p></font></i>
<p>Where r, g, and b are the red, green, and blue components of the color.</p>
<font = "courier"><p><i>
setambientdir [yaw] [pitch] [roll]
</p></font></i>
<p>Where yaw, pitch, and roll are the angles of the light direction vector.</p>
</blockquote>
<p><h2>Special Effects and Other Features</h2></p>
<blockquote>
<p>Because the lights are entities, and use the RGB fields to determine their color, you can do a color lerp on the entity to change the color of the light itself.</p>
<p>The lights can also be triggered, much like the particles to be off or on. By setting the light_disable key in noxdrop, the light will be spanwed as off.
When it is triggered, the light will activate. By default, the lights are on until that key is set. If they are on, the triggering will turn
the light off </p>
</blockquote>
<p><h2>Performance Considerations</h2></p>
<blockquote>
<p>Only flag essential entities as lit. Lighting is computationally expensive. Only entities that you feel need to be lit should be marked as such in the entity.dat.</p>
<p>Keep the lights to a minimum. Only the single closest light is applied to the model. It's not that hard to change it to multiple light sources, but we
also incur a major performance hit (essentially doubles the work for 2 lights, etc.). For now, I'm keeping it at a single source--either ambient or a light entity.</p>
<p>Right now I have it capped at 4 lights per PVS. I'm going to add a light # in the performance meter so you can gague your progress. Also, 4 lights is
a tad oppressive, so I may max it to 16, but please, keep these lights to a minimum</p>
</blockquote>
<hr>
<p>Complain about this document to the wonderful author, <A HREF="mailto:ralph@ionstorm.com">Ralph Barbagallo</a></p>
</HTML>