<li><aclass="backlink"title="Click to do a full-text search for this title"href="./ArtReference_Q4Shaders_Definitions?action=fullsearch&value=linkto%3A%22ArtReference+Q4Shaders+Definitions%22&context=180">ArtReference Q4Shaders Definitions</a></li>
<spanclass="anchor"id="line-1"></span><pclass="line874">Here are some basic definitions for shaders, using the example. <spanclass="anchor"id="line-2"></span><spanclass="anchor"id="line-3"></span><pclass="line874">The first thing we need to do is define the basics: <spanclass="anchor"id="line-4"></span><spanclass="anchor"id="line-5"></span><oltype="1"><li><pclass="line862">A <strong>Material</strong> is a file format (.mtr) that the game reads. <spanclass="anchor"id="line-6"></span><spanclass="anchor"id="line-7"></span></li><liclass="gap"><pclass="line862">A <strong>Shader</strong> is an entry in the material file. Shaders combine all of the source files (_d, _h, _s, _local plus extra passes) so the games lighting can be used properly. <spanclass="anchor"id="line-8"></span><spanclass="anchor"id="line-9"></span></li><liclass="gap"><pclass="line891"><strong>Spaces</strong> between shader commands and path names are used to begin and end strings and commands. <spanclass="anchor"id="line-10"></span><spanclass="anchor"id="line-11"></span></li><liclass="gap"><pclass="line891"><strong>Path names</strong> are used to point to a file. The directory paths on Q and the paths in the shaders are the same. <spanclass="anchor"id="line-12"></span><spanclass="anchor"id="line-13"></span></li><liclass="gap"><pclass="line862">// = <strong>Comment out</strong>. If you want the game to ignore a line in a shader, put this in front of the line and the game will ignore it. Using this is essential for troubleshooting. You can comment out blocks of entries by placing a /* before the area you want to have commented out and a */ after the area that you want commented out. The areas between these are commented out. <spanclass="anchor"id="line-14"></span><spanclass="anchor"id="line-15"></span></li><liclass="gap"><pclass="line891"><strong>Defaults</strong>: the game loads from q4base, so you won’t need to write q4base in the shader path names. <spanclass="anchor"id="line-16"></span><spanclass="anchor"id="line-17"></span></li></ol><pclass="line867"><strong>Example:</strong><spanclass="anchor"id="line-18"></span><spanclass="anchor"id="line-19"></span><pre>1) models/monsters/iron_maiden/base
<spanclass="anchor"id="line-38"></span></pre><spanclass="anchor"id="line-39"></span><pclass="line874">What we’ll do is define all of the shader line by line. <spanclass="anchor"id="line-40"></span><spanclass="anchor"id="line-41"></span><oltype="1"><li><pclass="line891"><strong>The shader title</strong> (models/monsters/iron_maiden/base) This is probably one of the most used lines in the game. This is the name of the shader that the game looks for when it’s used by an entity or brush in the game. <spanclass="anchor"id="line-42"></span><spanclass="anchor"id="line-43"></span><oltype="i"><li><pclass="line862">For <strong>Textures</strong> this is the name that appears in the editor. It also serves as a path name, so if you’re looking for a texture in medlabs and the name of the shader is textures/medlabs/wall1, the texture would be in the same directory. The last entry in the line is the texture name and the previous entries (textures/medlabs) are organizational directories in the editor <spanclass="anchor"id="line-44"></span><spanclass="anchor"id="line-45"></span></li><liclass="gap"><pclass="line862">For <strong>Models</strong>, the shader title needs to be added as a <em>surface on the model itself</em>. When the model is loaded into the game, it sees the shader name and loads the texture as projected by the UV map. You can have multiple shader titles on the same model. All you’d need to do is select the geometry in your 3d package and assign the shader name to it. <spanclass="anchor"id="line-46"></span><spanclass="anchor"id="line-47"></span></li></ol></li><liclass="gap"><pclass="line862">The <strong>Open bracket</strong> ({ ) begins the first pass of the shader. <em>ALL SHADERS NEED TO HAVE AN OPEN AND A CLOSE BRACKET</em>. If not, the game will either crash or break a long list of other shaders following it. Think of the shader title as a chapter title and the open and close brackets are the beginning and the ending of a chapter. <spanclass="anchor"id="line-48"></span><spanclass="anchor"id="line-49"></span></li><liclass="gap"><pclass="line891"><strong>Shader Parameters</strong> are <em>attributes that are applied to the whole shader</em>. <spanclass="anchor"id="line-50"></span><spanclass="anchor"id="line-51"></span></li><liclass="gap">Another Global Shader Parameter option <spanclass="anchor"id="line-52"></span><spanclass="anchor"id="line-53"></span></li><liclass="gap"><pclass="line862">The <strong>Render (bump) line</strong> is used ONLY in models. This line is NOT used in game for viewing a set of targas. Activating a model for rendering a normal map uses this line, otherwise it’s dormant string. <spanclass="anchor"id="line-54"></span><spanclass="anchor"id="line-55"></span></li><liclass="gap"><pclass="line862">The <strong><aclass="nonexistent"href="./MaterialImage.html">MaterialImage</a></strong> is an option that allows for a texture or a model to have multiple hit impacts, by using a color coated Targa. If you use this option you must point it to a targa by writing a path name to the file. So if you were to shoot the Iron Maiden in the above example, the impact would change depending on where you hit it. (The <aclass="nonexistent"href="./MaterialImage.html">MaterialImage</a> targa has colors for flesh, solidmetal, hollowmetal, and gelatinous fluids) <strong><aclass="nonexistent"href="./MaterialType.html">MaterialType</a></strong> is a command that assumes that the whole testure or skin has one attribure (all flesh, all rubber) it does not load a TGA, it uses a script so we save on texture memory! <spanclass="anchor"id="line-56"></span><spanclass="anchor"id="line-57"></span></li><liclass="gap"><pclass="line891"><strong>Diffusemap</strong> is a shortcut option that creates a rendering stage for the diffuse targa (base colors of the texture or skin) This line needs a path name to the file (.tga) being used. In this case (models/monsters/iron_maiden/base_d.tga) All diffuse targas should have an _d suffix. <spanclass="anchor"id="line-58"></s
<li><ahref="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a></li><li><ahref="http://www.python.org/">Python Powered</a></li><li><ahref="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a></li>