Editing Darkplaces material system/Introduction

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|}}
+
{{navigation | Darkplaces material system | p= | n=Key Concepts}}
 +
= Introduction =
  
== What is a Material? ==
+
Darkplaces material system is created to put more direct control over the surfaces qualities of textures into the hands of designers and artists.
 +
 
 +
=== What is a Material? ===
 
Materials are short text scripts that define the properties of a surface as it appears and functions in a game world (or compatible editing tool). By convention, the documents that contain these scripts usually has the same name as the texture set which contains the textures being modified (e.g; textures_inn, models_mapobjects_crypt, etc,). Several specific script documents have also been created to handle special cases, like liquids, environments and special effects.
 
Materials are short text scripts that define the properties of a surface as it appears and functions in a game world (or compatible editing tool). By convention, the documents that contain these scripts usually has the same name as the texture set which contains the textures being modified (e.g; textures_inn, models_mapobjects_crypt, etc,). Several specific script documents have also been created to handle special cases, like liquids, environments and special effects.
  
Line 11: Line 14:
 
  '''textures/crypt/stone'''
 
  '''textures/crypt/stone'''
 
  {
 
  {
     <font color=green>// keywords</font>
+
     <font color=green>// parameters</font>
 
     <font color=blue>qer_editorImage</font> '''radiant/textures/crypt/stone'''
 
     <font color=blue>qer_editorImage</font> '''radiant/textures/crypt/stone'''
+
    <font color=blue>q3map_textureImage</font> '''radiant/textures/crypt/stone'''
 +
    <font color=blue>dpglossexponentmod</font> 0.5
 
     <font color=blue>surfaceparm</font> '''stone'''
 
     <font color=blue>surfaceparm</font> '''stone'''
    <font color=blue>dpglossexponentmod</font> 0.5
 
 
     <font color=green>// base stage</font>
 
     <font color=green>// base stage</font>
 
     {
 
     {
Line 26: Line 29:
 
  }
 
  }
  
== Material names & Conventions ==
+
=== Material names & Conventions ===
 
The first line is the material name. Material names can be up to 63 characters long. The names are often a mirror of a pathname to a .tga file without the extension or basedir (/Blood Omnicide/kain in our case), but they do not need to be.
 
The first line is the material name. Material names can be up to 63 characters long. The names are often a mirror of a pathname to a .tga file without the extension or basedir (/Blood Omnicide/kain in our case), but they do not need to be.
  
Line 37: Line 40:
 
Material pathnames have a case sensitivity issue - on windows, they aren't case sensitive, but on unix they are. Try to always use lowercase for filenames, and always use forward slashes "/" for directory separators.
 
Material pathnames have a case sensitivity issue - on windows, they aren't case sensitive, but on unix they are. Try to always use lowercase for filenames, and always use forward slashes "/" for directory separators.
  
=== Material scripts Formatting ===
+
==== Material scripts Formatting ====
  
 
In order to get materials to be easily readable and editable it is recommended to format all material scripts like this template:
 
In order to get materials to be easily readable and editable it is recommended to format all material scripts like this template:
  
  &lt;materialname&gt;
+
  materialname
 
  {
 
  {
 
     &lt;Editor Specific Keywords&gt;
 
     &lt;Editor Specific Keywords&gt;
Line 47: Line 50:
 
     &lt;Q3Map2 Specific Keywords&gt;
 
     &lt;Q3Map2 Specific Keywords&gt;
 
     &lt;General Keywords&gt;
 
     &lt;General Keywords&gt;
 +
    &lt;Engine Specific Keywords&gt;
 
     {
 
     {
 
           &lt;Stage Keywords&gt;
 
           &lt;Stage Keywords&gt;
Line 52: Line 56:
 
  }
 
  }
  
== Inspired by Quake 3 but different ==
+
=== Inspired by Quake 3 but different ===
 
Quake 3 shader scripts was an inspiration for darkplaces material system and visual look of material scripts is very very close to quake 3. So if you are familiar with Id Tech 3 [[Shader | shaders]] system, you will be right home with material script syntax. Therefore Darkplaces material system was written independently and there is some serious differences:
 
Quake 3 shader scripts was an inspiration for darkplaces material system and visual look of material scripts is very very close to quake 3. So if you are familiar with Id Tech 3 [[Shader | shaders]] system, you will be right home with material script syntax. Therefore Darkplaces material system was written independently and there is some serious differences:
  
=== Realtime lighting ===
+
==== Realtime lighting ====
 
Any shader keywords that is not compatible with realtime lighting was removed. Other ones have sligtly changed behavior.
 
Any shader keywords that is not compatible with realtime lighting was removed. Other ones have sligtly changed behavior.
  
Aiming to realtime lighting changes the way stages working. There is no render passes (so multilayered material can only be created by duplicating real surfaces).
+
Aiming to realtime lighting changes the way stages working. Darkplaces material render pipeline can have 1 to 3 fixed usage stages:
Darkplaces material render pipeline can have 1 to 3 fixed usage stages:
+
* No draw: 0 stages
* No draw (0 stages)
+
* Unlit texture: 1 stage
* Unlit texture (1 stage)
+
* Lit texture: 2 stages
* Lit texture (2 stages)
+
* Lit texture with terrain blending: 3 stages
* Lit texture with terrain blending (3 stages)
+
 
+
 
All other Id Tech 3 stage configuration such as skies are not supported.
 
All other Id Tech 3 stage configuration such as skies are not supported.
  
{{design|To simulate multilayer materials, should make several copies of surface with different material attached (for map surfaces can use Q3map2's cloneShader keyword)}}
+
'''Design Notes:''' To simulate multilayer materials, should make several copies of surface with different material atatched (for map surfaces can use Q3map2's cloneShader keyword)
  
=== New keywords ===
+
==== New keywords ====
 
Darkplaces introduces many of it's own keywords that not exist in Id Tech 3.
 
Darkplaces introduces many of it's own keywords that not exist in Id Tech 3.
  
=== Q3 Texture = Darkplaces skinframe ===
+
==== Q3 Texture = Darkplaces skinframe ====
 
Id tech 3 only need color info for texture. Darkplaces engine using normalmap, specularity map, glow texture and other textures that store additional info. All that texture files toggether (color + normalmap + glossmap + glow etc.) forms a skinframe.  
 
Id tech 3 only need color info for texture. Darkplaces engine using normalmap, specularity map, glow texture and other textures that store additional info. All that texture files toggether (color + normalmap + glossmap + glow etc.) forms a skinframe.  
 
Read more at [[Texture]] article.
 
Read more at [[Texture]] article.
  
=== Different speed costs ===
+
==== Different speed costs ====
 
Darkplaces's engine rendering pipeline is very different from Id Tech 3. By using pixel and vertex shaders, it introduces new speed cost parameters that was not exist in Idtech 3:
 
Darkplaces's engine rendering pipeline is very different from Id Tech 3. By using pixel and vertex shaders, it introduces new speed cost parameters that was not exist in Idtech 3:
 
* shader instructions - amount of vertex and pixel shader instructions generated for particular material (depends of effects used)
 
* shader instructions - amount of vertex and pixel shader instructions generated for particular material (depends of effects used)
Line 83: Line 85:
 
* use of Lighting - realtime light is slower on blended (add more draws of surface, one per light) or offset mapped surfaces (offset mapping is processed again for each light)  
 
* use of Lighting - realtime light is slower on blended (add more draws of surface, one per light) or offset mapped surfaces (offset mapping is processed again for each light)  
  
=== Material is 'Shader' ===
+
==== Material is 'Shader' ====
 
Since Darkplaces uses tools with Id Tech 3 roots, materials is often spelled as 'shaders' there. To not be confused, this terms are identical in q3 tools:
 
Since Darkplaces uses tools with Id Tech 3 roots, materials is often spelled as 'shaders' there. To not be confused, this terms are identical in q3 tools:
 
* Shader = Material  
 
* Shader = Material  
Line 91: Line 93:
 
* etc.
 
* etc.
  
== Material Types ==
+
=== Material Types ===
 
The keywords that affect materials are divided into three classes. The first class of keywords are global parameters. Some global parameters ( "surfaceparms" And all "q3map_" keywords) are processed by [[Q3Map2 | Q3MAP2]] and change physical attributes of the surface that uses the material. These attributes can affect the player. To see changes in these parameters one must re-compile the [[MAP | map]].
 
The keywords that affect materials are divided into three classes. The first class of keywords are global parameters. Some global parameters ( "surfaceparms" And all "q3map_" keywords) are processed by [[Q3Map2 | Q3MAP2]] and change physical attributes of the surface that uses the material. These attributes can affect the player. To see changes in these parameters one must re-compile the [[MAP | map]].
  
Line 100: Line 102:
 
Material keywords are not case sensitive.
 
Material keywords are not case sensitive.
  
{{important|some of the material commands may be order dependent, so it's good practice to place all global material commands (keywords defined in this section) at the very beginning of the material and to place material stages at the end.}}
+
'''IMPORTANT NOTE''': some of the material commands may be order dependent, so it's good practice to place all global material commands (keywords defined in this section) at the very beginning of the material and to place material stages at the end (see various examples).
  
{{navigation footer|Key Concepts}}
+
{{navigation | Darkplaces material system | p= | n=Key Concepts}}
{{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