131 lines
7.9 KiB
HTML
131 lines
7.9 KiB
HTML
<?xml version="1.1" encoding="iso-8859-1"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|
<head>
|
|
<title>Q3Map2 Shader Manual</title>
|
|
<meta name="keywords" content="id software, quake, radiant, qeradiant, gtkradiant, q3map, q3map2, shader, manual, ydnar, obsidian" />
|
|
<meta name="description" content="Q3Map2 Shader Manual" />
|
|
<meta name="copyright" content="Obsidian © 2010" />
|
|
<link rel="stylesheet" href="default.css" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/_css/default.css" type="text/css" media="all" title="Default styles" />
|
|
</head>
|
|
<body id="articles">
|
|
|
|
<div id="nav">
|
|
<div id="navbutton">
|
|
<ul>
|
|
<div id="navtop"></div>
|
|
<li><a href="index.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/index.html">Q3Map2 Shader Manual</a></li>
|
|
<li><a href="contents.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/contents.html">Full Contents</a></li>
|
|
<li>Introduction
|
|
<ul>
|
|
<li><a href="preface.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/preface.html">Preface</a></li>
|
|
<li><a href="shader-concepts.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/shader-concepts.html">Shader Concepts</a></li>
|
|
</ul>
|
|
</li>
|
|
<li>Directives
|
|
<ul>
|
|
<li><a href="general-directives.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/general-directives.html">General Directives</a></li>
|
|
<li><a href="q3map-global-directives.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/q3map-global-directives.html">Q3Map Global Directives</a></li>
|
|
<li><a href="q3map-surface-parameter-directives.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/q3map-surface-parameter-directives.html">Q3Map Surface Parameter Directives</a></li>
|
|
<li><a href="quake-editor-radiant-directives.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/quake-editor-radiant-directives.html">Quake Editor Radiant Directives</a></li>
|
|
<li><a href="stage-directives.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/stage-directives.html">Stage Directives</a></li>
|
|
</ul>
|
|
</li>
|
|
<li>Articles
|
|
<ul>
|
|
<li><a href="texture-creation.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/texture-creation.html">Texture Creation</a></li>
|
|
<li><a href="alpha-channels.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/alpha-channels.html">Alpha Channels</a></li>
|
|
<li><a href="light-emitting-shaders.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/light-emitting-shaders.html">Light Emitting Shaders</a></li>
|
|
<li><a href="lightstyles.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/lightstyles.html">Lightstyles</a></li>
|
|
<li><a href="cel-shading.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/cel-shading.html">Cel Shading</a></li>
|
|
<li><a href="decal-tricks.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/decal-tricks.html">Decal Tricks</a></li>
|
|
<li><a href="foghull.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/foghull.html">Foghull</a></li>
|
|
<li><a href="fur.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/fur.html">Fur</a></li>
|
|
<li><a href="terrain-and-alphamod-blends.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/terrain-and-alphamod-blends.html">Terrain and alphaMod Blends</a></li>
|
|
<li><a href="triggerable-shader-entities.html" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/triggerable-shader-entities.html">Triggerable Shader Entities</a></li>
|
|
</ul>
|
|
</li>
|
|
<div id="navlow"></div>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<h1>Lightstyles</h1>
|
|
<p>Q3Map2 light styles are a way to simulate flickering/blinking dynamic lights by modulating values between up to 3 different dynamic lightmap styles per surface. This feature was added in Q3Map2 to support Quake 3 and RTCW. SOF2/JK2 already have native support for light styles. Light styles will only affect lightmapped objects, it has no effect on vertex lit objects and the light grid.</p>
|
|
<img src="lightstyles.jpg" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/_images/lightstyles.jpg" width="416" height="316" alt="slstyle" class="center" />
|
|
|
|
<h2>Worldspawn Keys</h2>
|
|
<p>To create some flickering lights, we need some waveform functions. These are set on the worldspawn entity in Radiant's Entity Inspector using two new available key/value pairs: _style<em>N</em>rgbGen and _style<em>N</em>alphaGen keys, where "N" is the style index number, an integer between 1 and 31. Both keys will take <a href="shader-concepts.html#waveformfunctions" tppabs="http://robotrenegade.com/q3map2/docs/shader_manual/shader-concepts.html#waveformfunctions">standard waveform functions</a> as values. As an example:</p>
|
|
<pre>
|
|
_style1alphaGen wave sin .5 .3 .25 1.5
|
|
_style1rgbGen wave noise 0.5 1 0 5.37
|
|
_style2alphaGen wave sin .8 .3 .25 1.5
|
|
_style2rgbGen wave square -.3 1.3 0 5.3
|
|
classname worldspawn
|
|
</pre>
|
|
|
|
<h2>Lights</h2>
|
|
<p>Next, we need to associate your lights with the style index numbers that were set in the worldspawn. You can add light styles to either light entities or light emitting shaders.</p>
|
|
|
|
<h3>Light Entities</h3>
|
|
<p>With a light entity selected, open up the Entity Inspector and add a "style" key. Use a value between 1 and 31 matching the style index number previously set in the worldspawn.</p>
|
|
|
|
<h3>Light Emitting Shaders</h3>
|
|
<p>You can also use q3map_lightStyle N, where "N" is a value between 1 and 31 matching the style index number set in the worldspawn, on light-emitting shaders to have them emit styled light.</p>
|
|
<pre>
|
|
textures/slstyle/light
|
|
{
|
|
q3map_surfacelight 3700
|
|
q3map_lightStyle 1 // sets style index #1
|
|
{
|
|
map $lightmap
|
|
rgbGen identity
|
|
}
|
|
q3map_styleMarker // note: after the $lightmap stage
|
|
{
|
|
map textures/slstyle/light.tga
|
|
blendFunc GL_DST_COLOR GL_ZERO
|
|
rgbGen identity
|
|
}
|
|
{
|
|
map textures/slstyle/light.blend.tga
|
|
blendfunc GL_ONE GL_ONE
|
|
}
|
|
}
|
|
</pre>
|
|
|
|
<h2>Lightmapped Surfaces</h2>
|
|
<p>For any shaders that may be hit by a styled light, you'll need to add q3map_styleMarker after the lightmap stages and before the texture stages so Q3Map2 can properly create the fake lightmap stages. For masked textures where a depthFunc equal is required, add q3map_styleMarker2.</p>
|
|
<p>Shaders with lightmaps after texture passes will look odd. This may change in the future. Try to rearrange your shaders, if possible, to have lightmaps first.</p>
|
|
<pre>
|
|
textures/slstyle/plywood2sided
|
|
{
|
|
cull none
|
|
qer_editorImage textures/slstyle/plywood-2-tone.tga
|
|
{
|
|
map $lightmap
|
|
rgbGen identity
|
|
}
|
|
q3map_styleMarker // note: after the $lightmap stage
|
|
{
|
|
map textures/slstyle/plywood-2-tone.tga
|
|
blendFunc GL_DST_COLOR GL_ZERO
|
|
rgbGen identity
|
|
}
|
|
}
|
|
</pre>
|
|
|
|
<h2>Compiling</h2>
|
|
<p>Compile your map with Q3Map 2.5.5-test-6 or later. Be sure to use the -nocollapse switch in the -light phase. This is important, because styled lights generate shaders, and this minimizes the number of unique shaders.</p>
|
|
<p>In game, you might get a warning message in the console, "WARNING: reused image *lightmap4 with mixed glWrapClampMode parm", which you can safely ignore.</p>
|
|
|
|
<h3>References</h3>
|
|
<ul>
|
|
<li><a href="http://www.splashdamage.com/forums/showthread.php?t=1857" tppabs="http://www.splashdamage.com/forums/showthread.php?t=1857">Q3Map 2.5.5-test-6 (lightstyles)</a>, ydnar 2003</li>
|
|
<li><a href="http://shaderlab.com/q3map2/samples/map-slstyle.zip" tppabs="http://shaderlab.com/q3map2/samples/map-slstyle.zip">slstyle demo map</a> (<a href="http://robotrenegade.com/q3map2/downloads/samples/maps/map-slstyle.zip" tppabs="http://robotrenegade.com/q3map2/downloads/samples/maps/map-slstyle.zip">mirror</a>), ydnar 2003.</li>
|
|
</ul>
|
|
|
|
</body>
|
|
</html> |