Editing Darkplaces material system/General Keywords

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|Key Concepts}}
+
{{navigation title|Darkplaces material system|General Keywords|Special Keywords}}
==surfaceparm==
+
== surfaceparm ==
  
 
This is, by the fact, most widely used and most tricky material keyword.
 
This is, by the fact, most widely used and most tricky material keyword.
  
All surfaceparm keywords are preceded by the word ''surfaceparm'' as follows: ''surfaceparm nonsolid'' or ''surfaceparm trans''. Each surfaceparm have corresponding q3map_''surfaceparmname'' keyword ('''q3map_nonsolid''', '''q3map_trans''' etc.) which is only acquired by Q3map2. Surfaceparm keywords change the physical nature of the materials and the brushes. Changing any of these values will likely require the map to be re-compiled. These are global and affect the entire shader.
+
All surfaceparm keywords are preceded by the word ''surfaceparm'' as follows: ''surfaceparm nonsolid'' or ''surfaceparm trans''. Each surfaceparm have corresponding q3map_''surfaceparmname'' keyword ('''q3map_nonsolid''', '''q3map_trans''' etc.) which is only acquired by Q3map2. Surfaceparm keywords change the physical nature of the materials and the brushes that are marked with them. Changing any of these values will likely require the map to be re-compiled. These are global and affect the entire shader.
  
 
This document skips all Q3map2 surfaceparms that is not used by Blood Omnicide.
 
This document skips all Q3map2 surfaceparms that is not used by Blood Omnicide.
  
===General surfaceparms===
+
=== General surfaceparms ===
  
 
'''surfaceparm alphashadow'''
 
'''surfaceparm alphashadow'''
Line 40: Line 40:
 
:This surface will have no lightmap generated. This will save some memory and make map compilation faster.
 
:This surface will have no lightmap generated. This will save some memory and make map compilation faster.
 
:Used by Q3map2 light phase.
 
:Used by Q3map2 light phase.
:{{design|This keyword have no effect at vertex-based lighting (lighting calculated for vertices and being saved to their rgba attributes). Surface with no lightmap will be rendered with vertex-based lighting. To disable vertex lignting calculation, use '''q3map_noVertexLight''' keyword.}}
+
:{{design|This keyword have no effect at vertex-based lighting (lighting calculated for vertices and being saved to their rgba attributes). Surface with no lightmap will be rendered with vertex-based lighting. To disable vertex lignting calculation, use '''q3map_noVertexLight''' keyword.{{
  
 
'''surfaceparm nonsolid'''
 
'''surfaceparm nonsolid'''
Line 61: Line 61:
 
:{{design|This keyword is used on '''common/iwater''' material.}}
 
:{{design|This keyword is used on '''common/iwater''' material.}}
  
===System surfaceparms===
+
=== System surfaceparms ===
 
This is surfaceparms is only used in [[common materials]]. You dont need to specify them on your new materials.
 
This is surfaceparms is only used in [[common materials]]. You dont need to specify them on your new materials.
  
Line 88: Line 88:
 
:Used by q3map2 BSP phase.
 
:Used by q3map2 BSP phase.
  
===Custom surfaceparms===
+
=== Custom surfaceparms ===
  
 
This surface parameters are defined by [[custinfoparms.txt]] and used to assign a game-related properties to material, such as hit effect and step sound.
 
This surface parameters are defined by [[custinfoparms.txt]] and used to assign a game-related properties to material, such as hit effect and step sound.
Line 117: Line 117:
 
{{important|Blood Omnicide allows only one game-physics surfaceparm per material.}}
 
{{important|Blood Omnicide allows only one game-physics surfaceparm per material.}}
  
==cull none==
+
== cull none ==
  
 
Every surface of a polygon has two sides, a front and a back. Typically, we only see the front side. For example, a solid block you only show the front side. In some situations we see both (grates, screens etc.).
 
Every surface of a polygon has two sides, a front and a back. Typically, we only see the front side. For example, a solid block you only show the front side. In some situations we see both (grates, screens etc.).
Line 123: Line 123:
 
To "cull" means to remove. This keyword allows to disable side culling, so both sides of the surfaces would be visible.
 
To "cull" means to remove. This keyword allows to disable side culling, so both sides of the surfaces would be visible.
  
{{tip|[[realtime lighting | Realtime lighting]] and lightmaps dont work well with twosided surfaces, caused back side to be lit same as front. To avoid that, should create two one-sided surfaces in game.}}
+
{{tip|Realtime lighting and lightmaps dont work well with twosided surfaces, caused back side to be lit same as front. To avoid that, should create two one-sided surfaces in game.}}
  
 
{{design|When making things like grates and screens with [[Brush | brushes]], put the texture with the cull none property on one face only. On the other faces, use a non-drawing texture.}}
 
{{design|When making things like grates and screens with [[Brush | brushes]], put the texture with the cull none property on one face only. On the other faces, use a non-drawing texture.}}
  
==noPicMip==
+
== deformVertexes ==
This causes the texture to ignore '''r_picmip''' cvar. The image will always be high resolution. Applicate to a small low-resolution textures that will be overblurred with r_picmip. Not used in Blood Omnicide.
+
{{bug|Darkplaces can crash if texture have DDS file with no mipmap layers generated and allowed for mipmaps in material. Use this keyword to suppress that.}}
+
 
+
==noMipMaps==
+
Implies noPicMip. Also prevents the generation of any lower resolution mipmaps for use by the 3D card. This saves 25% of memory used to store this texture (both RAM and VRAM).
+
 
+
==deformVertexes==
+
  
 
This function performs a general deformation on the surface's vertexes, changing the actual shape of the surface before drawing the material. You can stack multiple deformVertexes commands to modify positions in more complex ways, making an object move in two dimensions, for instance.
 
This function performs a general deformation on the surface's vertexes, changing the actual shape of the surface before drawing the material. You can stack multiple deformVertexes commands to modify positions in more complex ways, making an object move in two dimensions, for instance.
  
===deformVertexes <nowiki>wave <div> <func> <base> <amplitude> <phase> <freq></nowiki> ===
+
=== deformVertexes <nowiki><wave> <div> <func> <base> <amplitude> <phase> <freq></nowiki> ===
 
:Designed for water surfaces, modifying the values differently at each point. It accepts the standard [[Darkplaces material system/Key Concepts#Waveform_Functions | waveform functions]].
 
:Designed for water surfaces, modifying the values differently at each point. It accepts the standard [[Darkplaces material system/Key Concepts#Waveform_Functions | waveform functions]].
 
:The "div" parameter is used to control the wave "spread" - a value equal to the tesselation distance (see q3map_tessSize, a subdivision size, in game units, used for the material when seen in the game world).
 
:The "div" parameter is used to control the wave "spread" - a value equal to the tesselation distance (see q3map_tessSize, a subdivision size, in game units, used for the material when seen in the game world).
  
Typical usage:
+
===deformVertexes normal <nowiki><div> <func> <base> <amplitude ~0.1-~0.5> <frequency ~1.0-~4.0></nowiki> ===
deformVertexes wave 128 sin 0 0.3 10 0.5
+
 
+
===deformVertexes normal <nowiki><div> <func> <base> <amplitude ~0.1-~0.5> <frequency ~1.0-~4.0></nowiki>===
+
 
:This deformation affects the normals of a vertex without actually moving it, which will effect later material options like lighting (especially specular) and environment mapping (see stage specific keywords for tcGen environment). If the materialdon't use normals in any of their calculations, there will be no visible effect.
 
:This deformation affects the normals of a vertex without actually moving it, which will effect later material options like lighting (especially specular) and environment mapping (see stage specific keywords for tcGen environment). If the materialdon't use normals in any of their calculations, there will be no visible effect.
  
Line 151: Line 141:
 
:'''Design Notes''': Putting values of 0.1 t o 0.5 in Amplitude and 1.0 to 4.0 in the Frequency can produce some satisfying results.
 
:'''Design Notes''': Putting values of 0.1 t o 0.5 in Amplitude and 1.0 to 4.0 in the Frequency can produce some satisfying results.
  
Typical usage:
+
=== deformVertexes bulge <nowiki><bulgeWidth> <bulgeHeight> <bulgeSpeed></nowiki> ===
deformVertexes normal 2 0.5
+
 
+
{{bug|On lightmapped surface, deformVertexes normal has no effect if tangentspace deluxemapping is used (since tangentspace deluxemapping do not use vertex normals). Use modelspace deluxemapping.}}
+
 
+
===deformVertexes bulge <nowiki><bulgeWidth> <bulgeHeight> <bulgeSpeed></nowiki>===
+
 
:This forces a bulge to move along the given S and T directions. Designed for use on curved pipes.
 
:This forces a bulge to move along the given S and T directions. Designed for use on curved pipes.
  
Typical usage:
+
=== deformVertexes move <nowiki><x> <y> <z> <func> <base> <amplitude> <phase> <freq></nowiki> ===
deformVertexes bulge 0.1 0.6 0.18
+
 
+
===deformVertexes roundwave <nowiki><radius> <wavesize> <radiusexponent> <x> <y> <z> {wavefunc}</nowiki>===
+
:Makes round waves coming from center point. Designed to simulate fountains and pools.
+
:"Radius" is max radius of roundwave. "Wavesize" is length of wave at the start. "Exponent" is a power function, it makes wave longer with the distance from center point. X,y,z are effect offsets from entity center (or from world origin for worldspawn surfaces).
+
:"Wavefunc" is standart wavefunction used to create waves - 5 parms (<wavefunc> <base> <amplitude> <phase> <freq>).
+
:example: deformVertexes roundwave 180 18 3 0 0 0 sin 0 1.00 0.0 1.2
+
 
+
===deformVertexes move <nowiki><x> <y> <z> <func> <base> <amplitude> <phase> <freq></nowiki>===
+
 
:This keyword is used to make a brush, curve patch or model appear to move together as a unit. The <x> <y> and <z> values are the distance and direction in game units the object appears to move relative to it's point of origin in the map.
 
:This keyword is used to make a brush, curve patch or model appear to move together as a unit. The <x> <y> and <z> values are the distance and direction in game units the object appears to move relative to it's point of origin in the map.
 
:The product of the function modifies the values x, y, and z. Therefore, if you have an amplitude of 5 and an x value of 2, the object will travel 10 units from its point of origin along the x axis. This results in a total of 20 units of motion along the x axis, since the amplitude is the variation both above and below the base.
 
:The product of the function modifies the values x, y, and z. Therefore, if you have an amplitude of 5 and an x value of 2, the object will travel 10 units from its point of origin along the x axis. This results in a total of 20 units of motion along the x axis, since the amplitude is the variation both above and below the base.
Line 174: Line 150:
 
:{{design|If an object is made up of surfaces with different shaders, all must have matching deformVertexes move values or the object will appear to tear itself apart.}}
 
:{{design|If an object is made up of surfaces with different shaders, all must have matching deformVertexes move values or the object will appear to tear itself apart.}}
  
===deformVertexes autosprite===
+
=== deformVertexes autosprite ===
 
:This function can be used to make any given triangle quad (pair of triangles that form a square rectangle) automatically behave like a [[sprite]] without having to make it a separate entity. This means that the "sprite" on which the texture is placed will rotate to always appear at right angles to the player's view as a sprite would. Any four-sided brush side, flat patch, or pair of triangles in an .md3 model can have the autosprite effect on it. The brush face containing a texture with this shader keyword must be square.
 
:This function can be used to make any given triangle quad (pair of triangles that form a square rectangle) automatically behave like a [[sprite]] without having to make it a separate entity. This means that the "sprite" on which the texture is placed will rotate to always appear at right angles to the player's view as a sprite would. Any four-sided brush side, flat patch, or pair of triangles in an .md3 model can have the autosprite effect on it. The brush face containing a texture with this shader keyword must be square.
 
:{{design|This is best used on objects that would appear the same regardless of viewing angle. An example might be a glowing light flare.}}
 
:{{design|This is best used on objects that would appear the same regardless of viewing angle. An example might be a glowing light flare.}}
  
===deformVertexes autosprite2===
+
=== deformVertexes autosprite2 ===
 
:Is a slightly modified "sprite" that only rotates around the middle of its longest axis. This allows you to make a pillar of fire that you can walk around, or an energy beam stretched across the room.
 
:Is a slightly modified "sprite" that only rotates around the middle of its longest axis. This allows you to make a pillar of fire that you can walk around, or an energy beam stretched across the room.
  
===Specific parameter definitions for deform keywords===
+
=== Specific parameter definitions for deform keywords ===
  
 
'''div'''
 
'''div'''
Line 202: Line 178:
  
 
{{tip|The <nowiki><div></nowiki> and <nowiki><amplitude></nowiki> parameters, when used in conjunction with liquid volumes like water should take into consideration how much the water will be moving. A large ocean area would have have massive swells (big div values) that rose and fell dramatically (big amplitude values). While a small, quiet pool may move very little.}}
 
{{tip|The <nowiki><div></nowiki> and <nowiki><amplitude></nowiki> parameters, when used in conjunction with liquid volumes like water should take into consideration how much the water will be moving. A large ocean area would have have massive swells (big div values) that rose and fell dramatically (big amplitude values). While a small, quiet pool may move very little.}}
 
==Engine renderer features==
 
This keywords controls various renderer features.
 
 
===dpOffsetMapping <nowiki><type> <scale> [<biastype> <biasvalue>]</nowiki>===
 
todo
 
 
===dpSelfShadowing <scale> <offsetscale> [<offsetbiastype> <offsetbiasvalue>]===
 
todo
 
 
===dpNoFog===
 
Disables fog rendering for a surface.
 
 
===dpPolygonOffset &lt;factor&gt; &lt;offset&gt;===
 
Allows arbitrary offsets of a surface's depth during rendering. Material with this keyword are able to stack over rest of geometry with no [[Radiant/Glossary | z-fighting]]. Useful for decals.
 
 
Both parameters are optional, if not used, a default factor of 0 and offset -2 is used.
 
 
{{tip|mod_q3shader_default_polygonfactor and mod_q3shader_default_polygonoffset controls default values.}}
 
 
===dpTransparentSort <nowiki><sort></nowiki>===
 
Rendering of blended materials requires software sorting to keep the depth order of geometry. This keyword changes default distance sorting to allow for special effects.
 
* '''distance''' : default distance-based sorting
 
* '''hud''' : this surface will always be ontop of all another blended materials
 
* '''sky''' : opposite to hud, this surface will always ve vehing all other blender materials.
 
 
==Per-Pixel Lightning==
 
This keywords controls various parameters used by per-pixel lighting of a surface.
 
 
===dpShadow===
 
Forces this material to be shadow caster even if it's blended or not drawn (blended surfaces by default is not casting shadows).
 
{{tip|This keyword is useful in creating '''shadow meshes''' a meshes that is invisible (and having lower polycont) but used for shadow casting.}}
 
 
===dpNoShadow===
 
Discards material from shadow casting.
 
 
===dpNoRtlight===
 
Disables any realtime lighting on a surface.
 
 
===dpGlossIntensityMod <nowiki><value></nowiki>===
 
Multiplies [[gloss]] intensity of this material. Default value is 1; 0.5 will halve gloss effect intensity, 2.0 will double it etc. This are used ontop on base gloss intensity set by a texture's _gloss color.
 
 
===dpGlossExponentMod <nowiki><value></nowiki>===
 
Scales gloss exponent for a surface. Gloss exponent controls how sharp gloss effect is. Low values will make surface matte, higher values will make it look like a covered by a plastic film. Just like intensity mod, this is a multiplier to a value in texture's _gloss alpha (if there is no alpha - base gloss exponent is forced to be 1).
 
 
Typical values are 0.25 (wood), 2.0 (glass).
 
 
===dpRtlightAmbient <nowiki><value></nowiki>===
 
Smooths out shading of a surface by adding amount of ambient light. This is useful on very grude and lowpoly surfaces (such as grass) because strong shading will show artefacts caused by low detalisation of a mesh.
 
 
==Reflection and refraction==
 
This material keywords allows to add refraction and reflection effects to a surface. All reflective and refractive effects are part of water shader, so they are only visible when '''r_water''' cvar is 1.
 
 
===dpReflect <nowiki><distortion> <r> <g> <b> <a></nowiki>===
 
Make this material reflective. The reflection is alpha blended on the texture with the given alpha, and modulated by the given color. Distort is used in conjunction with the normalmap to simulate a nonplanar water surface.
 
{{important|This is a 'hard' shader that requires much computation time. Abuse of this will slowdown rendering.}}
 
 
===dpRefract <nowiki><distortion> <r> <g> <b></nowiki>===
 
Works pretty same as reflection and can be combined with it (though it's not good). The refraction replaces the transparency of the texture. Distort is used in conjunction with the normalmap to simulate a nonplanar water surface.
 
 
===dpWater <nowiki><reflectmin> <reflectmax>  <refractdistort> <reflectdistort>  <refractR> <refractG> <refractB>  <reflectR> <reflectG> <reflectB>  <alpha></nowiki>===
 
Add a water shader to a material. This combines the effects of dpreflect and dprefract to simulate a water surface. However, the refraction and the reflection are mixed using a Fresnel equation that makes the amount of reflection slide from reflectmin when looking parallel to the water to reflectmax when looking directly into the water. The result of this reflection/refraction mix is then layered BELOW the texture of the shader, so basically, it "fills up" the alpha values of the water. The alpha value is a multiplicator for the alpha value on the texture (set this to a small value like 0.1) to emphasize the reflection and make the water transparent; but if r_water is 0, alpha isn't used, so the water can be very visible then too.
 
 
Typical usage:
 
dpwater  0.4 1.0  0.3 1.0  0.28 0.21 0.18  0.80 0.76 0.65  0.0
 
 
===dpWaterScroll <nowiki><speedScale> <globalScale></nowiki> ===
 
Animate surface normalmap in water shader by duplicating it, scrolling, offsetting and multiplying the layers.
 
{{tip|Globalscale affects speed.}}
 
 
===dpCamera===
 
Flags this surface as camera surface. Used to make portal effects like ones seen in Pray. Not used in Blood Omnicide.
 
 
===dpReflectCube <nowiki><cubemap></nowiki>===
 
Sets static [[cubemap]] texture for reflections.
 
{{important|A _reflect [[skinframe]] texture sets local intensity of reflections and should be presented in order effect to work.}}
 
{{tip|Cubemapped reflections alot faster than realtime ones.}}
 
 
Typical usage:
 
 
dpreflectcube textures/environment/reflect1
 
 
==Shader Kill==
 
This keywords are used to hide this material (as if it has no stages) under certain circumstances. Only affects visual appearance of material, not collisions or contents.
 
 
===dpShaderKillIfCvar <nowiki><cvar> <operator> <value></nowiki>===
 
Kills this material is [[CVar | cvar]] matches a value.
 
<font color=green>// kill this shader if r_foo is 42</font>
 
dpshaderkillifcvar r_foo == 42
 
Operators are:
 
* '''==''' - equal
 
* '''!=''' - not equal
 
* '''>''' - greater
 
* '''>=''' - greater or equal
 
* '''<''' - lesser
 
* '''<=''' - lesser or equal
 
 
===dpNoShaderKillIfCvar <nowiki><cvar> <operator> <value></nowiki>===
 
Prevents material from being killed. Have a priority over dpshaderkillifcvar.
 
 
===dpShaderKillIfCvarZero <nowiki><cvar></nowiki>===
 
Kills material is supplied cvar's float value is 0.
 
 
===dpNoShaderKillIfCvarZero <nowiki><cvar></nowiki>===
 
Opposite to above.
 
 
 
==Physics==
 
This keywords controls parameters for game physics.
 
 
===dpMeshCollisions===
 
Use surface's draw geometry for collision detection instead of generated BSP geometry (some models have no one). This works only if [[BIH]] is enabled.
 
 
===dpNoBih===
 
Disable Bounding Interval Hierarchy tree construction for a surface. Used an an optimisation on surfaces which never need game physics (such as grass).
 
 
 
{{navigation footer|Special Keywords}}
 
{{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