<li><aclass="backlink"title="Click to do a full-text search for this title"href="./ArtReference_Q4Shaders_Models?action=fullsearch&value=linkto%3A%22ArtReference+Q4Shaders+Models%22&context=180">ArtReference Q4Shaders Models</a></li>
<spanclass="anchor"id="line-1"></span><pclass="line874">Writing shaders for models is almost the same as texture shaders… in fact it is the same with the exception to the path of the targa files as well as a render line. <spanclass="anchor"id="line-2"></span><spanclass="anchor"id="line-3"></span><pclass="line867"><strong>Setting up material shaders</strong><spanclass="anchor"id="line-4"></span><spanclass="anchor"id="line-5"></span><pclass="line874">This is the clincher, and the thing that most people get wrong. It’s easy to mess this up, so in this stage it’s essential to be patient and not to panic. <spanclass="anchor"id="line-6"></span><spanclass="anchor"id="line-7"></span><pclass="line874">Some definitions: <spanclass="anchor"id="line-8"></span><strong>Materials</strong>: the actual file format. <spanclass="anchor"id="line-9"></span><strong>Shaders</strong>: the individual entries in the material. <spanclass="anchor"id="line-10"></span><spanclass="anchor"id="line-11"></span><pclass="line874">Here’s a typical shader for a model, and we’ll be using it for an example: <spanclass="anchor"id="line-12"></span><spanclass="anchor"id="line-13"></span><pre>models/mapobjects/strogg/barrels_and_containers/barrels/medium1_low
<spanclass="anchor"id="line-24"></span></pre><spanclass="anchor"id="line-25"></span><pclass="line874">The only thing we’re concerned with right now is the shader name and the render line. The rest of it is used to get the .tga files linked and in game. <spanclass="anchor"id="line-26"></span><spanclass="anchor"id="line-27"></span><ul><listyle="list-style-type:none"><pclass="line891"><strong>4.1 Where do I put my material shaders?</strong> Since you will have the game loaded onto your personal computer and may not have a network, it’ll be a tad different from what we do here at Raven. You’ll need to create your materials locally. Meaning you’ll have to create them on your computer and then save them out in the appropriate directory inside the Quake4 game. <spanclass="anchor"id="line-28"></span><oltype="i"><li><pclass="line862">Through your computer’s Explorer, go into the Quake4 directories. <strong>(C:\Program Files\id Software\Quake 4)</strong><spanclass="anchor"id="line-29"></span><spanclass="anchor"id="line-30"></span></li><liclass="gap"><pclass="line862">Open the q4base folder and find the <strong>pk4 files.</strong><spanclass="anchor"id="line-31"></span><spanclass="anchor"id="line-32"></span></li><liclass="gap"><pclass="line862">Underneath the <strong>pk4 files</strong>, you’ll need to create a materials folder. Name it <strong>materials</strong> in all lower case letters. <spanclass="anchor"id="line-33"></span><spanclass="anchor"id="line-34"></span></li><liclass="gap"><pclass="line862">Open <strong>notepad</strong> on your computer and write out your model’s or texture’s material to render your normal map from. It’s very important that the material paths need to point to the directories you saved your model in and where your normal and skin maps will be located. <spanclass="anchor"id="line-35"></span><spanclass="anchor"id="line-36"></span></li><liclass="gap"><pclass="line862">After writing your material, name it and save it as an .mtr file in your newly created materials folder. Don’t save as a .txt file, but as an <strong>.mtr file</strong>. You can easily rewrite the suffix to .mtr. <spanclass="anchor"id="line-37"></span><spanclass="anchor"id="line-38"></span></li></ol><pclass="line891"><strong>4.2 Writing the shader for renderbump</strong>: This is the key to make your render work. So what do you do? Well the safest and easiest thing to do is to copy and paste a previous entry and change the path names. Here’s the breakdown using the above example: <spanclass="anchor"id="line-39"></span><spanclass="anchor"id="line-40"></span></li></ul><pclass="line862">The top line: <tt>models/mapobjects/strogg/barrels_and_containers/barrels/medium1_low</tt> is the <em>Shader title</em>: this is what the game looks for when you activate a render. Think of it as an alias or a chapter title. <spanclass="anchor"id="line-41"></span><spanclass="anchor"id="line-42"></span><pclass="line867"><tt>Unsmoothedtangents</tt>: Unsmoothed tangents are for animated models. If the model isn’t animated DO NOT use unsmoothed tangents. <spanclass="anchor"id="line-43"></span><spanclass="anchor"id="line-44"></span><pclass="line867"><tt>Renderbump</tt>: This is the command the game looks for when you ask for a renderbump. If the shader doesn’t have this command in it, it won’t render. <spanclass="anchor"id="line-45"></span><spanclass="anchor"id="line-46"></span><pclass="line867"><tt>-size 256 256</tt>: Size is pretty self-explanatory, this is the size of the final rendered Targa. <spanclass="anchor"id="line-47"></span><spanclass="anchor"id="line-48"></span><pclass="line867"><tt>-trace .05</tt>: Trace is the height in which the model renders. Think of the low poly model as the surface in which the high poly is being drawn onto. If the high poly has a lot of floating geometry, you may need to render the model multiple times at different trace heights. <spanclass="anchor"id="line-49"></span><spanclass="anchor"id="line-50"></span><pc
<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>