<li><aclass="backlink"title="Click to do a full-text search for this title"href="/quake4/Sounds_ShaderCreation?action=fullsearch&value=linkto%3A%22Sounds+ShaderCreation%22&context=180">Sounds ShaderCreation</a></li>
<spanclass="anchor"id="line-2"></span><spanclass="anchor"id="line-3"></span><pclass="line874">The concept of "channels", as used in Quake3, is completely gone. There is no more SND_IDLE, SND_ACTION etc. These have been replaced by sound shaders. A sound shader defines the wavefiles, and the way they are played. Both .wav files and .ogg files can be used with the new Quake4 engine. <spanclass="anchor"id="line-4"></span><spanclass="anchor"id="line-5"></span><pclass="line874">Sound shaders are just like the material shaders. They are located in the base\sound directory and have the extension .sndshd, you can create any number of sound shader files, they are all collected and loaded together at run time. <spanclass="anchor"id="line-6"></span><spanclass="anchor"id="line-7"></span><pclass="line874">The sound shader is the root of all things audio with the new Quake4 engine. After you create a new sound, it is always a good idea to go ahead and create the shader immediately after. This way, things stay organized and you know which sounds are available to be used in game and which are not. It is also a good idea to regularly go through past shaders and clean them of unused or invalid sounds, this eliminates error messages and just keeps a tighter ship. <spanclass="anchor"id="line-8"></span><spanclass="anchor"id="line-9"></span><pclass="line874">Here are a few examples of shaders: <spanclass="anchor"id="line-10"></span><spanclass="anchor"id="line-11"></span><pclass="line867"><pre>ambient_machinery11
<spanclass="anchor"id="line-21"></span></pre><spanclass="anchor"id="line-22"></span><spanclass="anchor"id="line-23"></span><pclass="line874">This particular shader is an ambient sound, which is created as a continuous loop. It begins the sound at full volume with a minimum distance of “40” and fades to silence over “600” units. The volume is set to the default setting of “0”, so it will play at whatever volume you have designed the sound for. Volume is measured in dB…so if you have a highly compressed sound, it probably isn’t a good idea to go over “0” in many instances, as you’ll get clipping/distortion. The “looping” entry has been inputted, thus making the sound loop to the beginning once it completes its playback cycle. <spanclass="anchor"id="line-24"></span><spanclass="anchor"id="line-25"></span><pclass="line874">Here are some other examples: <spanclass="anchor"id="line-26"></span><spanclass="anchor"id="line-27"></span><pclass="line867"><pre>gladiator_breathe
<spanclass="anchor"id="line-28"></span>{
<spanclass="anchor"id="line-29"></span> description "gladiator huffin and puffin"
<spanclass="anchor"id="line-55"></span></pre><spanclass="anchor"id="line-56"></span><spanclass="anchor"id="line-57"></span><pclass="line874">Notice that these have a selection of different sounds, the shader system will pull a random sound from this list whenever it fires one off. You will also notice that the minimum and maximum distance on these particular sounds are somewhat larger, which allows the player to hear the sound more distinctly from further away from the origin of the sound. <spanclass="anchor"id="line-58"></span><spanclass="anchor"id="line-59"></span><pclass="line867"><strong>Here are all of the options:</strong><spanclass="anchor"id="line-60"></span><spanclass="anchor"id="line-61"></span><pclass="line867"><em>description [string]</em> - a string that decribes what the sound is used for and/or how it is used. For dialog, it is normally the phrase that is spoken. It is purely for development purposes and is not required by the sound engine. <spanclass="anchor"id="line-62"></span><spanclass="anchor"id="line-63"></span><pclass="line867"><em>minDistance [float]</em>– sets the minimum distance from where the sound emanates in world units. It’s a good idea to set this to about 40 – 120 when use on a world object or creature. <spanclass="anchor"id="line-64"></span><spanclass="anchor"id="line-65"></span><pclass="line867"><em>maxDistance [float]</em>– sets the maximum distance from where the sound emanates. Beyond this distance the sound cannot be heard. <spanclass="anchor"id="line-66"></span><spanclass="anchor"id="line-67"></span><pclass="line867"><em>volumeDb [float]</em>– sets the volume for the sound within the world in decibels. 0 is the default volume, -60 is complete silence. <spanclass="anchor"id="line-68"></span><spanclass="anchor"id="line-69"></span><pclass="line867"><em>leadinVolume [float]</em> - volume of the leadin sound on a 0 (silence) to 1 (full volume) scale. <spanclass="anchor"id="line-70"></span><spanclass="anchor"id="line-71"></span><pclass="line867"><em>unclamped</em> - by default, each channel's volume is clamped to 1.0 after all the attenuation calculations. Setting this flag means this clamp is not applied. Unclamped can be applied to all channels by setting the cvar s_clipVolumes to 0. <spanclass="anchor"id="line-72"></span><spanclass="anchor"id="line-73"></span><pclass="line867"><em>looping</em>– sets the shader to loop. <spanclass="anchor"id="line-74"></span><spanclass="anchor"id="line-75"></span><pclass="line867"><em>playOnce</em> - don't restart the sound if it is already playing on this channel. <spanclass="anchor"id="line-76"></span><spanclass="anchor"id="line-77"></span><pclass="line867"><em>global</em>– this forces the sound to ignore the min/maxDistance settings and play it globally. Mainly used for music and Multiplayer announcements. <spanclass="anchor"id="line-78"></span><spanclass="anchor"id="line-79"></span><pclass="line867"><em>private</em> - only hear the sound on the player that plays the sound. <spanclass="anchor"id="line-80"></span><spanclass="anchor"id="line-81"></span><pclass="line867"><em>antiPrivate</em> - the player that plays this sound cannot hear it. <spanclass="anchor"id="line-82"></span><spanclass="anchor"id="line-83"></span><pclass="line867"><em>no_occlusion</em>– sets the shader to not occlude, meaning that you will hear them through walls and such. Very useful for creepy kind of stuff, music beds, and doors opening and closing. <spanclass="anchor"id="line-84"></span><spanclass="anchor"id="line-85"></span><pclass="line867"><em>omnidirectional</em> - by default, sounds navigate through the portal tree to work out their distance from the listener. Sounds with this flag do a simple distance check and play at the same volume in all speakers. <spanclass="anchor"id="line-86"></span><spanclass="anchor"id="line-87"></span><pclass="line867"><em>no_dups</em>– this is a setting that doesn’t allow the shader system to repeat two random sounds back to back
<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>