mirror of
https://github.com/dhewm/iddevnet.git
synced 2024-11-21 20:11:27 +00:00
112 lines
4.4 KiB
HTML
112 lines
4.4 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
|||
|
<!-- saved from url=(0043)https://www.iddevnet.com/doom3/lighting.php -->
|
|||
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
|||
|
<title>id.sdk [Lighting]</title>
|
|||
|
<link rel="stylesheet" href="style.css">
|
|||
|
</head>
|
|||
|
|
|||
|
|
|||
|
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
|
|||
|
|
|||
|
<table border=0 cellpadding=0 cellspacing=0 style="width: 100%; height: 99px">
|
|||
|
<tr>
|
|||
|
<td style="width: 171px"><img src="images/doom.jpg" style="width: 171px; height: 99px" alt=""></td>
|
|||
|
<td style="background: url(images/tile.gif)">
|
|||
|
<table border=0 cellpadding=0 cellspacing=0 width=600>
|
|||
|
<tr>
|
|||
|
<td style="height: 19px; background: url(images/sdk.gif) no-repeat"></td>
|
|||
|
<td rowspan=4 align=right><img src="images/id.gif" style="width: 42px; height: 99px" alt=""></td>
|
|||
|
</tr>
|
|||
|
<tr><td style="height: 29px; background: url(images/top.jpg) no-repeat"></td></tr>
|
|||
|
<tr><td style="height: 27px; background: url(images/middle.gif)" class="title"> Making DOOM 3 Mods : Lighting</td></tr>
|
|||
|
<tr><td style="height: 24px; background: url(images/bottom.jpg) no-repeat"></td></tr>
|
|||
|
</table>
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
<table border=0 cellpadding=0 cellspacing=0 style="width: 770px">
|
|||
|
<tr>
|
|||
|
<td colspan=2 style="background: url(images/boxtop.gif);"><img src="images/span.jpg" style="width: 397px; height: 20px; float: left" alt=""></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td style="vertical-align: top; width: 152px; background: url(images/tileleft.gif)">
|
|||
|
<div class="leftMenu">
|
|||
|
<script src="menu.js"></script>
|
|||
|
</div>
|
|||
|
</td>
|
|||
|
<td class="mainContent">
|
|||
|
|
|||
|
<p>
|
|||
|
The biggest technological advancement in the Doom 3 engine is the
|
|||
|
unified per-pixel lighting.
|
|||
|
|
|||
|
</p><p>
|
|||
|
In previous engines, world geometry
|
|||
|
went through a different rendering and lighting path than model
|
|||
|
geometry (such as characters and objects). If an object moved,
|
|||
|
the lighting would always look wrong on it. Either the lighting
|
|||
|
would not move with the object, or there simply wouldn't be
|
|||
|
lighting and shadows for the object. It is very hard to create
|
|||
|
tension because you would get the effect seen in cartoons
|
|||
|
where you could pick out the brick that was going to move because
|
|||
|
it was always a different color.
|
|||
|
|
|||
|
</p><p>
|
|||
|
In Doom 3, however, all triangles go through the same render backend.
|
|||
|
This means you can have an entity next to a piece of world geometry,
|
|||
|
and they will look exactly the same. You never know which panel
|
|||
|
the imp is going to pop out of, because all the wall panels integrate
|
|||
|
seemlessly into the world.
|
|||
|
|
|||
|
</p><p>
|
|||
|
Every object has a material on it. This material defines how the lighting
|
|||
|
and shadow system will interact with the object (it also defines how the
|
|||
|
sound system interacts, but we won't get in to that).
|
|||
|
|
|||
|
</p><p>
|
|||
|
Each triangle has three seperate images associated with it: the bump map,
|
|||
|
the diffuse map, and the specular map.
|
|||
|
|
|||
|
</p><p>
|
|||
|
The bump map (or normal map) is a way to simulate geometry on a flat surface.
|
|||
|
Normally, when light hits a flat surface, it reflects at the exact angle
|
|||
|
of impact. When a surface has a normal map on it, the angle of reflection
|
|||
|
is perturbed some amount depending on the RGB value of the pixel the light
|
|||
|
hit.
|
|||
|
|
|||
|
</p><p>
|
|||
|
<img src="images/lighting_a.gif">
|
|||
|
|
|||
|
</p><p>
|
|||
|
Bump maps are explained in greater detail in the <a href="bumpmaps.html">bumpmaps</a>
|
|||
|
section.
|
|||
|
|
|||
|
</p><p>
|
|||
|
A specular map is a gray scale image that defines how 'shiny' an object is. The
|
|||
|
more white a pixel is, the more it reflects light back in to the camera. Something
|
|||
|
like a dirt road would pretty much have a pure black specular map, but something
|
|||
|
like chrome would have almost a pure white specular map.
|
|||
|
|
|||
|
</p><p>
|
|||
|
The diffuse map is what actually gives the object color. It should only be "local
|
|||
|
color" with no shadows or highlights because those will be added in later by the
|
|||
|
lighting system. The diffuse map should be created as if the object were being
|
|||
|
lit on all sides by pure white ambient light.
|
|||
|
|
|||
|
<br>
|
|||
|
</p></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td colspan="2" bgcolor="#CCCCCC"><img src="images/span2.gif" style="width: 397px; height: 8px; float: left;"></td>
|
|||
|
</tr>
|
|||
|
</tbody></table>
|
|||
|
|
|||
|
<table border="0" cellpadding="0" cellspacing="0" width="770">
|
|||
|
<tbody><tr>
|
|||
|
<td align="left" class="legalese">Copyright <20> 2004 <a href="http://www.idsoftware.com/">id software</a></td>
|
|||
|
</tr>
|
|||
|
</tbody></table>
|
|||
|
|
|||
|
|
|||
|
</body></html>
|