iddevnet/quake4/ArtReference_Q4Shaders_Guides.html

297 lines
24 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="robots" content="index,nofollow">
<title>ArtReference Q4Shaders Guides - Quake 4 SDK Documentation</title>
<script type="text/javascript" src="wiki/common/js/common.js"></script>
<script type="text/javascript">
<!--// common functions
// We keep here the state of the search box
searchIsDisabled = false;
function searchChange(e) {
// Update search buttons status according to search box content.
// Ignore empty or whitespace search term.
var value = e.value.replace(/\s+/, '');
if (value == '' || searchIsDisabled) {
searchSetDisabled(true);
} else {
searchSetDisabled(false);
}
}
function searchSetDisabled(flag) {
// Enable or disable search
document.getElementById('fullsearch').disabled = flag;
document.getElementById('titlesearch').disabled = flag;
}
function searchFocus(e) {
// Update search input content on focus
if (e.value == 'Search') {
e.value = '';
e.className = '';
searchIsDisabled = false;
}
}
function searchBlur(e) {
// Update search input content on blur
if (e.value == '') {
e.value = 'Search';
e.className = 'disabled';
searchIsDisabled = true;
}
}
function actionsMenuInit(title) {
// Initialize action menu
for (i = 0; i < document.forms.length; i++) {
var form = document.forms[i];
if (form.className == 'actionsmenu') {
// Check if this form needs update
var div = form.getElementsByTagName('div')[0];
var label = div.getElementsByTagName('label')[0];
if (label) {
// This is the first time: remove label and do buton.
div.removeChild(label);
var dobutton = div.getElementsByTagName('input')[0];
div.removeChild(dobutton);
// and add menu title
var select = div.getElementsByTagName('select')[0];
var item = document.createElement('option');
item.appendChild(document.createTextNode(title));
item.value = 'show';
select.insertBefore(item, select.options[0]);
select.selectedIndex = 0;
}
}
}
}
//-->
</script>
<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="wiki/modern/css/common.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="wiki/modern/css/screen.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="print" href="wiki/modern/css/print.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="projection" href="wiki/modern/css/projection.css">
<!-- css only for MSIE browsers -->
<!--[if IE]>
<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="wiki/modern/css/msie.css">
<![endif]-->
<link rel="Start" href="./Quake4SDK.html">
2021-04-10 13:40:18 +00:00
<link rel="Alternate" title="Wiki Markup" href="./ArtReference_Q4Shaders_Guides?action=raw">
<link rel="Alternate" media="print" title="Print View" href="./ArtReference_Q4Shaders_Guides?action=print">
<link rel="Search" href="./FindPage.html">
<link rel="Index" href="./TitleIndex.html">
<link rel="Glossary" href="./WordIndex.html">
<link rel="Help" href="./HelpOnFormatting.html">
</head>
<body lang="en" dir="ltr">
<div id="header">
<div id="logo"><a href="./Quake4SDK.html"><img src="wiki/common/moinmoin.png" alt="MoinMoin Logo"></a></div>
<form id="searchform" method="get" action="">
<div>
<input type="hidden" name="action" value="fullsearch">
<input type="hidden" name="context" value="180">
<label for="searchinput">Search:</label>
<input id="searchinput" type="text" name="value" value="" size="20"
onfocus="searchFocus(this)" onblur="searchBlur(this)"
onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search">
<input id="titlesearch" name="titlesearch" type="submit"
value="Titles" alt="Search Titles">
<input id="fullsearch" name="fullsearch" type="submit"
value="Text" alt="Search Full Text">
</div>
</form>
<script type="text/javascript">
<!--// Initialize search form
var f = document.getElementById('searchform');
f.getElementsByTagName('label')[0].style.display = 'none';
var e = document.getElementById('searchinput');
searchChange(e);
searchBlur(e);
//-->
</script>
2021-04-10 13:40:18 +00:00
<ul id="username"><li><a href="./ArtReference_Q4Shaders_Guides?action=login" id="login">Login</a></li></ul>
<div id="locationline">
<ul id="pagelocation">
2021-04-10 13:40:18 +00:00
<li><a class="backlink" title="Click to do a full-text search for this title" href="./ArtReference_Q4Shaders_Guides?action=fullsearch&amp;value=linkto%3A%22ArtReference+Q4Shaders+Guides%22&amp;context=180">ArtReference Q4Shaders Guides</a></li>
</ul>
</div>
<ul id="navibar">
<li class="wikilink"><a href="./GettingStarted.html">GettingStarted</a></li><li class="wikilink"><a href="./ScriptFile.html">ScriptFile</a></li><li class="wikilink"><a href="./MakeAMod.html">MakeAMod</a></li><li class="wikilink"><a href="./LevelEditor.html">LevelEditor</a></li><li class="wikilink"><a href="./FXEditor.html">FXEditor</a></li><li class="wikilink"><a href="./GUIEditor.html">GUIEditor</a></li><li class="wikilink"><a href="./Sounds.html">Sounds</a></li><li class="wikilink"><a href="./Animations.html">Animations</a></li><li class="wikilink"><a href="./ArtReference.html">ArtReference</a></li><li class="wikilink"><a href="./DownloadableContent.html">DownloadableContent</a></li><li class="wikilink"><a href="./RecentChanges.html">RecentChanges</a></li><li class="wikilink"><a href="./FindPage.html">FindPage</a></li><li class="wikilink"><a href="./HelpContents.html">HelpContents</a></li><li class="current"><a href="./ArtReference_Q4Shaders_Guides.html">ArtReferenc...ders Guides</a></li>
</ul>
<div id="pageline"><hr style="display:none;"></div>
2021-04-10 13:40:18 +00:00
<ul class="editbar"><li><span class="disabled">Immutable Page</span></li><li><a href="./ArtReference_Q4Shaders_Guides?action=info">Info</a></li><li><a href="./ArtReference_Q4Shaders_Guides?action=AttachFile">Attachments</a></li><li>
<form class="actionsmenu" method="get" action="">
<div>
<label>More Actions:</label>
<select name="action"
onchange="if ((this.selectedIndex != 0) &&
(this.options[this.selectedIndex].disabled == false)) {
this.form.submit();
}
this.selectedIndex = 0;">
<option value="raw">Raw Text</option>
<option value="print">Print View</option>
<option value="RenderAsDocbook">Render as Docbook</option>
<option value="refresh">Delete Cache</option>
<option value="show" disabled class="disabled">------------</option>
<option value="SpellCheck">Check Spelling</option>
<option value="LikePages">Like Pages</option>
<option value="LocalSiteMap">Local Site Map</option>
<option value="show" disabled class="disabled">------------</option>
<option value="RenamePage" disabled class="disabled">Rename Page</option>
<option value="DeletePage" disabled class="disabled">Delete Page</option>
<option value="show" disabled class="disabled">------------</option>
<option value="MyPages">My Pages</option>
<option value="SubscribeUser">Subscribe User</option>
<option value="show" disabled class="disabled">------------</option>
<option value="Despam">Remove Spam</option>
<option value="PackagePages">Package Pages</option>
</select>
<input type="submit" value="Do">
</div>
<script type="text/javascript">
<!--// Init menu
actionsMenuInit('More Actions:');
//-->
</script>
</form>
</li></ul>
</div>
<div id="page" lang="en" dir="ltr">
<div dir="ltr" id="content" lang="en"><span class="anchor" id="top"></span>
<span class="anchor" id="line-1"></span><p class="line874">Texture guides are the shorthanded versions of texture shader entries ONLY. It basically references a template to be used. Use the guides first, since if theyre generally easier to write, and save space in out material files, and nearly impossible to mess up. <span class="anchor" id="line-2"></span><span class="anchor" id="line-3"></span><p class="line867"><strong>Heres an example of a texture guide line:</strong> <span class="anchor" id="line-4"></span><span class="anchor" id="line-5"></span><pre>guide textures/terminal/t1_wall1 generic_shader("terminal/t1_wall1")
<span class="anchor" id="line-6"></span></pre><span class="anchor" id="line-7"></span><p class="line867"><strong>"Generic_shader"</strong> is THE basic shader. It will show the basic base texture in game. If you use this shader it will default to solidmetal as the material type. <span class="anchor" id="line-8"></span><span class="anchor" id="line-9"></span><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-10"></span><span class="anchor" id="line-11"></span><p class="line867">
<h3 id="head-d8b1c82f3f9c142b7495448b7e8639ca847a8684">Lets break the above example down piece by piece:</h3>
<span class="anchor" id="line-12"></span><span class="anchor" id="line-13"></span><p class="line867"><strong>Guide</strong> this lets the game know to reference a guide. This looks for a template in the materials.guide file. <span class="anchor" id="line-14"></span><span class="anchor" id="line-15"></span><p class="line867"><strong>Textures/terminal/t1_wall</strong> is the shader title, so this is what shows up in the editor, and is referenced by the game. <span class="anchor" id="line-16"></span><span class="anchor" id="line-17"></span><p class="line867"><strong>Generic_shader</strong> is the type of shader being used. There are a lot of different generic shaders, and depending on what you want the texture to do, this name may change. (i.e. generic_glow, generic_alpha, etc,) There is a listing all of the current generic shaders at the end of this section. <span class="anchor" id="line-18"></span><span class="anchor" id="line-19"></span><p class="line867"><strong>(“terminal/t1_wall1”)</strong> is the targa being referenced. <span class="anchor" id="line-20"></span><span class="anchor" id="line-21"></span><p class="line874">Youre probably wondering where these templates are, what the guide references, and what they look like and do. <span class="anchor" id="line-22"></span><span class="anchor" id="line-23"></span><p class="line867"><span class="anchor" id="line-24"></span><pre>guide generic_shader(TextureParm)
<span class="anchor" id="line-25"></span>{
<span class="anchor" id="line-26"></span> qer_editorimage textures/TextureParm_d
<span class="anchor" id="line-27"></span>
<span class="anchor" id="line-28"></span> bumpmap addnormals ( textures/TextureParm_local, heightmap ( textures/TextureParm_h, 1 ) )
<span class="anchor" id="line-29"></span> diffusemap textures/TextureParm_d
<span class="anchor" id="line-30"></span> specularmap textures/TextureParm_s
<span class="anchor" id="line-31"></span>}
<span class="anchor" id="line-32"></span></pre><span class="anchor" id="line-33"></span><p class="line862">As you can see, they look exactly like a long hand version of a texture shader, but the targa entries use a <strong><a class="nonexistent" href="./TextureParm.html">TextureParm</a></strong> entry. Place the shader title between the guide and generic_shader entries. That entry will be what appears in the editor. The <a class="nonexistent" href="./TextureParm.html">TextureParm</a> in the shader title replaces all of the <a class="nonexistent" href="./TextureParm.html">TextureParm</a> entries in the body of the shader. So in the terminal/t1_wall1 example above it would do the following: <span class="anchor" id="line-34"></span><span class="anchor" id="line-35"></span><pre>guide textures/terminal/t1_wall1 generic_shader("terminal/t1_wall1")
<span class="anchor" id="line-36"></span>{
<span class="anchor" id="line-37"></span> qer_editorimage textures/terminal/t1_wall1_d
<span class="anchor" id="line-38"></span>
<span class="anchor" id="line-39"></span> bumpmap addnormals ( textures/terminal/t1_wall1_local, heightmap ( textures/ terminal/t1_wall1_h, 1 ) )
<span class="anchor" id="line-40"></span> diffusemap textures/terminal/t1_wall1_d
<span class="anchor" id="line-41"></span> specularmap textures/terminal/t1_wall1_s
<span class="anchor" id="line-42"></span>}
<span class="anchor" id="line-43"></span></pre><span class="anchor" id="line-44"></span><span class="anchor" id="line-45"></span><p class="line874">You can write any number of shader guides, but theres a point where you should just write it long hand… heres an example of a shader guide that uses more than one parm: <span class="anchor" id="line-46"></span><span class="anchor" id="line-47"></span><pre>guide generic_glow(TextureParm, Glowparm)
<span class="anchor" id="line-48"></span>{
<span class="anchor" id="line-49"></span> qer_editorimage textures/TextureParm_d
<span class="anchor" id="line-50"></span>
<span class="anchor" id="line-51"></span> bumpmap addnormals ( textures/TextureParm_local, heightmap ( textures/TextureParm_h, 1 ) )
<span class="anchor" id="line-52"></span> diffusemap textures/TextureParm_d
<span class="anchor" id="line-53"></span> specularmap textures/TextureParm_s
<span class="anchor" id="line-54"></span> {
<span class="anchor" id="line-55"></span> blend GL_ONE, GL_ONE
<span class="anchor" id="line-56"></span> map textures/Glowparm
<span class="anchor" id="line-57"></span>
<span class="anchor" id="line-58"></span> red Parm0
<span class="anchor" id="line-59"></span> green Parm1
<span class="anchor" id="line-60"></span> blue Parm2
<span class="anchor" id="line-61"></span> }
<span class="anchor" id="line-62"></span>}
<span class="anchor" id="line-63"></span></pre><span class="anchor" id="line-64"></span><span class="anchor" id="line-65"></span><p class="line874">It would be written as a texture guide like this: <span class="anchor" id="line-66"></span><span class="anchor" id="line-67"></span><pre>guide textures/terminal/t_shaft1 generic_glow("terminal/t_shaft1", "terminal/t_shaft1_g")
<span class="anchor" id="line-68"></span></pre><span class="anchor" id="line-69"></span><p class="line874">If you have Multiple Parameters in the shader guide they must be separated by a comma and a space, all parameters need to be in quotes and the whole parameter section must be opened and closed by parentheses. <span class="anchor" id="line-70"></span><span class="anchor" id="line-71"></span><p class="line862">The first entry is the <a class="nonexistent" href="./TextureParm.html">TextureParm</a> while the second is the <a class="nonexistent" href="./GlowParm.html">GlowParm</a>. If youre writing a new shader guide or using an existing guide, you should take a look at how theyve been written, since sometimes the parameters may have been switched or moved. If you decide to write a shader guide try to name it something fairly descriptive, since generic_1 isnt a good way to keep things in order. Generic_1 tells me nothing of what the shader can do at a glance, but generic_glow does. <span class="anchor" id="line-72"></span><span class="anchor" id="line-73"></span><p class="line874">Heres a listing of the current shader guides: <span class="anchor" id="line-74"></span><span class="anchor" id="line-75"></span><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-76"></span><span class="anchor" id="line-77"></span><p class="line867">
<h3 id="head-b80655f9b7db4b7944f093c7755ab8cffc2dd013">Generic guides:</h3>
<span class="anchor" id="line-78"></span><span class="anchor" id="line-79"></span><p class="line862">guide generic_shader(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>base generic shader</em><br />
<span class="anchor" id="line-80"></span>guide generic_shader2sided(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>generic 2 sided shader</em><br />
<span class="anchor" id="line-81"></span>guide generic_shader_mi(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>generic shader with an impact image.</em><br />
<span class="anchor" id="line-82"></span>guide generic_typeshader(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, <a class="nonexistent" href="./TypeParm.html">TypeParm</a> ) <em>generic shader with one impact surface. Youll need to enter a type impact name.</em> <span class="anchor" id="line-83"></span><span class="anchor" id="line-84"></span><p class="line862">guide generic_full_noheight(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>a shader that uses no height map</em> <span class="anchor" id="line-85"></span><span class="anchor" id="line-86"></span><p class="line862">guide generic_shader_heightmap(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, Heightparm) <em>a shader with a height parameter variable.</em> <span class="anchor" id="line-87"></span><span class="anchor" id="line-88"></span><p class="line862">guide generic_nonormal(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>a shader with no normal map</em><br />
<span class="anchor" id="line-89"></span>guide generic_nonormal_height(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, Heightparm) <em>a shader with no normal and can change the numerical entry of the height pass.</em><br />
<span class="anchor" id="line-90"></span>guide generic_nonormal_height_type(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, Heightparm, <a class="nonexistent" href="./TypeParm.html">TypeParm</a> ) <em>no local map, with a height variable, and can call out an impact type</em> <span class="anchor" id="line-91"></span><span class="anchor" id="line-92"></span><p class="line862">guide generic_Localvariant(<a class="nonexistent" href="./LocalParm.html">LocalParm</a>, <a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>a shader that uses a different local map</em> <br />
<span class="anchor" id="line-93"></span>guide generic_Localvariant_mi(<a class="nonexistent" href="./LocalParm.html">LocalParm</a>, <a class="nonexistent" href="./TextureParm.html">TextureParm</a>) - <em>local variant with a material image</em> <span class="anchor" id="line-94"></span><span class="anchor" id="line-95"></span><p class="line862">guide generic_colorvariant(<a class="nonexistent" href="./VariantParm.html">VariantParm</a>, <a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>shader that uses a different diffuse variant</em><br />
<span class="anchor" id="line-96"></span>guide generic_colorvariant_mi(<a class="nonexistent" href="./VariantParm.html">VariantParm</a>, <a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>generic shader using a different diffuse with a material image</em> <span class="anchor" id="line-97"></span><span class="anchor" id="line-98"></span><p class="line867">
<h3 id="head-d47358b29b6404dbdbabec1bc51225ae68808c5c">Alpha</h3>
<span class="anchor" id="line-99"></span><span class="anchor" id="line-100"></span><p class="line862">guide generic_alpha(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>hard edged alpha</em><br />
<span class="anchor" id="line-101"></span>guide generic_alpha_mi(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>hard edged alpha with a material image</em><br />
<span class="anchor" id="line-102"></span>guide generic_alpha_type(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, <a class="nonexistent" href="./TypeParm.html">TypeParm</a>) <em>hard edged alpha with an impact type.</em> <span class="anchor" id="line-103"></span><span class="anchor" id="line-104"></span><p class="line862">guide generic_shader2sidedalpha_mi(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>2 sided hard edged alpha with material image</em><br />
<span class="anchor" id="line-105"></span>guide generic_shader2sidedalpha(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>2 sided hard edged alpha</em> <span class="anchor" id="line-106"></span><span class="anchor" id="line-107"></span><p class="line862">guide generic_alpha_lv(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, <a class="nonexistent" href="./LocalParm.html">LocalParm</a>) <em>hard edged alpha local variable</em><br />
<span class="anchor" id="line-108"></span>guide generic_shader2sidedalpha_lv(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, <a class="nonexistent" href="./LocalParm.html">LocalParm</a>) <em>2 sided hard edged alpha with a local variant.</em> <span class="anchor" id="line-109"></span><span class="anchor" id="line-110"></span><p class="line862">guide generic_alphaNoShadow2S(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>) <em>hard edged alpha, no shadow, 2 sided.</em> <span class="anchor" id="line-111"></span><span class="anchor" id="line-112"></span><p class="line867">
<h3 id="head-854c188b76acf8529e0945700d122013293c32d6">Glow passes</h3>
<span class="anchor" id="line-113"></span><span class="anchor" id="line-114"></span><p class="line862">guide generic_glow(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, Glowparm) <em>a shader with a glow pass</em><br />
<span class="anchor" id="line-115"></span>guide generic_glow_mi(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, Glowparm) <em>glow pass with a material image</em> <span class="anchor" id="line-116"></span><span class="anchor" id="line-117"></span><p class="line862">guide generic_alphaglow(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, Glowparm) <em>hard edged alpha with a glow pass</em> <span class="anchor" id="line-118"></span><span class="anchor" id="line-119"></span><p class="line862">guide generic_glowflicker(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, Glowparm, Flickerparm) <em>glow pass with a flicker table</em><br />
<span class="anchor" id="line-120"></span>guide generic_glowflicker2(<a class="nonexistent" href="./TextureParm.html">TextureParm</a>, Glowparm1, Flickerparm1, Glowparm2, Flickerparm2) <em>2 glow passes, 2 tables (should probably write it long hand)</em> <span class="anchor" id="line-121"></span><span class="anchor" id="bottom"></span></div><p id="pageinfo" class="info" lang="en" dir="ltr">ArtReference Q4Shaders Guides (last edited 2006-01-22 23:56:06 by <span title="MattBreit @ 24-241-228-159.dhcp.mdsn.wi.charter.com[24.241.228.159]"><a class="nonexistent" href="./MattBreit.html" title="MattBreit @ 24-241-228-159.dhcp.mdsn.wi.charter.com[24.241.228.159]">MattBreit</a></span>)</p>
<div id="pagebottom"></div>
</div>
<div id="footer">
2021-04-10 13:40:18 +00:00
<ul class="editbar"><li><span class="disabled">Immutable Page</span></li><li><a href="./ArtReference_Q4Shaders_Guides?action=info">Info</a></li><li><a href="./ArtReference_Q4Shaders_Guides?action=AttachFile">Attachments</a></li><li>
<form class="actionsmenu" method="get" action="">
<div>
<label>More Actions:</label>
<select name="action"
onchange="if ((this.selectedIndex != 0) &&
(this.options[this.selectedIndex].disabled == false)) {
this.form.submit();
}
this.selectedIndex = 0;">
<option value="raw">Raw Text</option>
<option value="print">Print View</option>
<option value="RenderAsDocbook">Render as Docbook</option>
<option value="refresh">Delete Cache</option>
<option value="show" disabled class="disabled">------------</option>
<option value="SpellCheck">Check Spelling</option>
<option value="LikePages">Like Pages</option>
<option value="LocalSiteMap">Local Site Map</option>
<option value="show" disabled class="disabled">------------</option>
<option value="RenamePage" disabled class="disabled">Rename Page</option>
<option value="DeletePage" disabled class="disabled">Delete Page</option>
<option value="show" disabled class="disabled">------------</option>
<option value="MyPages">My Pages</option>
<option value="SubscribeUser">Subscribe User</option>
<option value="show" disabled class="disabled">------------</option>
<option value="Despam">Remove Spam</option>
<option value="PackagePages">Package Pages</option>
</select>
<input type="submit" value="Do">
</div>
<script type="text/javascript">
<!--// Init menu
actionsMenuInit('More Actions:');
//-->
</script>
</form>
</li></ul>
<ul id="credits">
<li><a href="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a></li><li><a href="http://www.python.org/">Python Powered</a></li><li><a href="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a></li>
</ul>
</div>
</body>
</html>