Editing Darkplaces material system/Stages

Jump to: navigation, search

Warning: You are not logged in.

Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
{{navigation title|Special Keywords}}
+
{{navigation title|Darkplaces material system|Stages}}
 
== Texture Map ==
 
== Texture Map ==
 
Specifies the base texture map (a 24 or 32-bit TGA or JPEG file) used for this material.  
 
Specifies the base texture map (a 24 or 32-bit TGA or JPEG file) used for this material.  
Line 12: Line 12:
 
=== clampMap <textureName> ===
 
=== clampMap <textureName> ===
 
:Specifies the source texture map (see map). Clamping keeps texture from tiling (texture coordinates is clamped to 0-1).
 
:Specifies the source texture map (see map). Clamping keeps texture from tiling (texture coordinates is clamped to 0-1).
:'''Design notes''': level editor doesnt show clampMap properly, moreover [[brush | brushes]] use texture projection which is converted to real texture coordinates when map is compiled. To bypass that limitation use "Fit" instrument in surface/patch inspector as it always make 0-1-compliant texture projection.
+
'''Design note''': level editor doesnt show clampMap properly, moreover [[brush | brushes]] use texture projection which is converted to real texture coordinates when map is compiled. To bypass that limitation use "Fit" instrument in surface/patch inspector as it always make 0-1-compliant texture projection.
  
 
=== animMap <frequency> <texture1> ... <texture64> ===
 
=== animMap <frequency> <texture1> ... <texture64> ===
 
:The surfaces in the game can be animated by displaying a sequence of 1 to 64 frames (separate texture maps). These animations are affected by other keyword effects in the same and later shader stages.
 
:The surfaces in the game can be animated by displaying a sequence of 1 to 64 frames (separate texture maps). These animations are affected by other keyword effects in the same and later shader stages.
:* ''frequency'' : The number of times that the animation cycle will repeat within a one second time period. The larger the value, the more repeats within a second. Animations that should last for more than a second need to be expressed as decimal values.
+
:* '''frequency''' : The number of times that the animation cycle will repeat within a one second time period. The larger the value, the more repeats within a second. Animations that should last for more than a second need to be expressed as decimal values.
:* ''texture1...texture64'': the texture path/texture name for each animation frame must be explicitly listed. Up to 64 frames (64 separate texture files) can be used to make an animated sequence. Each frame is displayed for an equal subdivision of the frequency value.
+
:* '''texture1...texture64''': the texture path/texture name for each animation frame must be explicitly listed. Up to 64 frames (64 separate texture files) can be used to make an animated sequence. Each frame is displayed for an equal subdivision of the frequency value.
 
:If you want to clamp texture coordinates such as in '''clampMap''', put '''animClampMap''' instead of '''animMap'''.
 
:If you want to clamp texture coordinates such as in '''clampMap''', put '''animClampMap''' instead of '''animMap'''.
 
:'''Example''':
 
:'''Example''':
Line 31: Line 31:
 
The most common blend functions are set up here as simple commands, and should be used unless you really know what you are doing.
 
The most common blend functions are set up here as simple commands, and should be used unless you really know what you are doing.
  
=== blendFunc blend ===
+
'''blendFunc blend'''
 
:Traditional alpha blending (shorthand command for ''blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA'').
 
:Traditional alpha blending (shorthand command for ''blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA'').
  
=== blendFunc add ===
+
'''blendFunc add'''
 
:Additive blending  (shorthand command for ''blendFunc GL_ONE GL_ONE'').
 
:Additive blending  (shorthand command for ''blendFunc GL_ONE GL_ONE'').
  
=== blendFunc addalpha ===
+
'''blendFunc addalpha'''
 
:Additive blending with alpha (shorthand command for ''blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA'').
 
:Additive blending with alpha (shorthand command for ''blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA'').
  
=== blendFunc filter ===
+
'''blendFunc filter'''
 
:A filter will always result in darker pixels than what is behind it, but it can also remove color selectively. Lightmaps are filters. Shorthand command that can be substituted for either ''blendFunc GL_DST_COLOR GL_ZERO'' or ''blendFunc GL_ZERO GL_SRC_COLOR'').
 
:A filter will always result in darker pixels than what is behind it, but it can also remove color selectively. Lightmaps are filters. Shorthand command that can be substituted for either ''blendFunc GL_DST_COLOR GL_ZERO'' or ''blendFunc GL_ZERO GL_SRC_COLOR'').
  
=== blendFunc <source> <destination> ===
+
'''blendFunc <source> <destination>'''
 
:Alternative, GL-friendly blending mode definition. Source is pixel of texture. Destination is pixel in framebuffer. Possible codes for source and destination:
 
:Alternative, GL-friendly blending mode definition. Source is pixel of texture. Destination is pixel in framebuffer. Possible codes for source and destination:
 
:* GL_ONE
 
:* GL_ONE
Line 58: Line 58:
 
== alphaGen vertex ==
 
== alphaGen vertex ==
  
Enables vertex-controlled transparency. Reguires per-vertex rgba attributes which is supported on [[BModel | submodels]].
+
Enables vertex-controlled transparency. Reguires per-vertex rgba attributes which is supported on [[bmodel | submodels]].
  
 
[[ASE]] format used by [[misc_model]] (and converted to map geometry during compile) supports per-vertex transparency.  
 
[[ASE]] format used by [[misc_model]] (and converted to map geometry during compile) supports per-vertex transparency.  
Line 68: Line 68:
  
 
== tcMod <function> ==
 
== tcMod <function> ==
Specifies how texture coordinates are modified after they are generated. The valid functions for tcMod are ''rotate'', ''scale'', ''scroll'', ''stretch'', ''transform'', ''turb'' and ''page''. Up to 4 tcMod's are allowed.
+
:Specifies how texture coordinates are modified after they are generated. The valid functions for tcMod are ''rotate'', ''scale'', ''scroll'', ''stretch'', ''transform'', ''turb'' and ''page''. Up to 4 tcMod's are allowed.
When using multiple tcMod functions during a stage, place the scroll command last in order, because it performs a mod operation to save precision, and that can disturb other operations. Texture coordinates are modified in the order in which tcMods are specified.
+
:When using multiple tcMod functions during a stage, place the scroll command last in order, because it performs a mod operation to save precision, and that can disturb other operations. Texture coordinates are modified in the order in which tcMods are specified.
'''Example''':
+
:'''Example''':
 
  <font color=green>// texture coordinates will be scaled then scrolled.</font>
 
  <font color=green>// texture coordinates will be scaled then scrolled.</font>
 
  <font color=blue>tcMod scale</font> 0.5 0.5
 
  <font color=blue>tcMod scale</font> 0.5 0.5
Line 87: Line 87:
 
:Scrolls the texture coordinates with the given speeds. The values "s" and "t" conform to the "x" and "y" values (respectively) as they are found in the original texture file. The scroll speed is measured in "textures" per second. A "texture" is the dimension of the texture being modified and includes any previous material modifications to the original texture file). A negative s value would scroll the texture to the left. A negative t value would scroll the texture down.
 
:Scrolls the texture coordinates with the given speeds. The values "s" and "t" conform to the "x" and "y" values (respectively) as they are found in the original texture file. The scroll speed is measured in "textures" per second. A "texture" is the dimension of the texture being modified and includes any previous material modifications to the original texture file). A negative s value would scroll the texture to the left. A negative t value would scroll the texture down.
 
:'''Example''':  
 
:'''Example''':  
  <font color=green>// Moves the texture down and right (relative to the TGA files original coordinates) at the rate of a half texture each second of travel.</font>
+
  <font color=green>Moves the texture down and right (relative to the TGA files original coordinates) at the rate of a half texture each second of travel.</font>
 
  <font color=blue>tcMod scroll</font> 0.5 -0.5
 
  <font color=blue>tcMod scroll</font> 0.5 -0.5
 
:'''IMPORTANT NOTE''': This should be the last tcMod in a stage. Otherwise there may be a popping or snapping visual effect in some materials.
 
:'''IMPORTANT NOTE''': This should be the last tcMod in a stage. Otherwise there may be a popping or snapping visual effect in some materials.
Line 93: Line 93:
 
=== tcMod stretch &lt;func&gt; &lt;base&gt; &lt;amplitude&gt; &lt;phase&gt; &lt;frequency&gt; ===
 
=== tcMod stretch &lt;func&gt; &lt;base&gt; &lt;amplitude&gt; &lt;phase&gt; &lt;frequency&gt; ===
 
:Stretches the texture coordinates with the given function. Stretching is defined as stretching the texture coordinate away from the center of the polygon and then compressing it towards the center of the polygon. (see Key Concepts for waveform parameter definitions).
 
:Stretches the texture coordinates with the given function. Stretching is defined as stretching the texture coordinate away from the center of the polygon and then compressing it towards the center of the polygon. (see Key Concepts for waveform parameter definitions).
:'''Example''':
 
<font color=green>// stretch coordinates using sin wave with 1.5 seconds cycle time</font>
 
<font color=blue>tcMod stretch</font> <font color=orange>sin</font> 1.2 0.8 0 1.5
 
  
 
=== tcMod transform &lt;m00&gt; &lt;m01&gt; &lt;m10&gt; &lt;m11&gt; &lt;t0&gt; &lt;t1&gt; ===
 
=== tcMod transform &lt;m00&gt; &lt;m01&gt; &lt;m10&gt; &lt;m11&gt; &lt;t0&gt; &lt;t1&gt; ===
Line 101: Line 98:
 
:S = s * m00 + t * m10 + t0
 
:S = s * m00 + t * m10 + t0
 
:T = s * m01 + t * m11 + t1
 
:T = s * m01 + t * m11 + t1
:This is for use by programmers. S stands for side coordinate (width), T stands for top (height).
+
:This is for use by programmers.
'''Example''':
+
<span style="color:green">// Transform that does nothing</span>
+
<span style="color:blue">tcMod</span> transform 1 0 0 1 0 1
+
<span style="color:green">// Shift texture up by 1/128 of it's height</span>
+
<span style="color:blue">tcMod</span> transform 1 0 0 1 0 0.0078125
+
  
 
=== tcMod turb &lt;base&gt; &lt;amplitude&gt; &lt;phase&gt; &lt;freq&gt; ===
 
=== tcMod turb &lt;base&gt; &lt;amplitude&gt; &lt;phase&gt; &lt;freq&gt; ===
 
:Applies turbulence to the texture coordinate. Turbulence is a back and forth churning and swirling effect on the texture.
 
:Applies turbulence to the texture coordinate. Turbulence is a back and forth churning and swirling effect on the texture.
:* ''base'' : Undefined.
 
:* ''amplitude'' : This is essentially the intensity of the disturbance or twisting and squiggling of the texture.
 
:* ''phase'' : See the explanation for phase under the deformVertexes keyword.
 
:* ''freq'' : Frequency. This value is expressed as repetitions or cycles of the wave per second. A value of one would cycle once per second. A value of 10 would cycle 10 times per second. A value of 0.1 would cycle once every 10 seconds.
 
 
:'''IMPORTANT NOTE''': This should be first tcMod in a stage because it is only software tcMod (all other ones transform texture matrix).
 
:'''IMPORTANT NOTE''': This should be first tcMod in a stage because it is only software tcMod (all other ones transform texture matrix).
 +
:* '''base''' : Undefined.
 +
:* '''amplitude''' : This is essentially the intensity of the disturbance or twisting and squiggling of the texture.
 +
:* '''phase''' : See the explanation for phase under the deformVertexes keyword.
 +
:* '''freq''' : Frequency. This value is expressed as repetitions or cycles of the wave per second. A value of one would cycle once per second. A value of 10 would cycle 10 times per second. A value of 0.1 would cycle once every 10 seconds.
  
 
=== tcMod page &lt;width&gt; &lt;height&gt; &lt;delay&gt; ===
 
=== tcMod page &lt;width&gt; &lt;height&gt; &lt;delay&gt; ===
Line 178: Line 170:
 
     }
 
     }
 
  }
 
  }
 
{{navigation footer|}}
 
{{finished}}
 

Please note that all contributions to Blood Wiki are considered to be released under the Creative Commons Attribution Share Alike (see BloodWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)

This page is a member of 1 hidden category:

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox