4 Material creation for DP
5 ========================
7 Quick notes by LordHavoc (in need of cleanup and completion!):
9 All texture files are optional except for diffuse, a q3 shader allows additional options to be set but is not required for common materials.
14 Formats supported: tga (recommended), png (loads very slowly), jpg (loads slowly), pcx, wal, lmp
16 Usually you want to put replacement content in either `id1/` or another directory such as `pretty/` inside your quake directory, in DarkPlaces you can run multiple `-game` options at once (such as `-game ctf -game pretty -game dpmod` to have texture overrides from pretty, maps from ctf, and gameplay from dpmod) or multiple gamedirs specified with the gamedir console command (`gamedir ctf pretty dpmod`).
18 All texture layers are optional except diffuse (the others are NOT loaded without it)
21 progs/player.mdl\_0.tga - diffuse
22 progs/player.mdl\_0\_**norm**.tga - normalmap (can have alpha channel with bumpmap height for offsetmapping/reliefmapping)
23 progs/player.mdl\_0\_**bump**.tga - bumpmap (not loaded if normalmap is present)
24 progs/player.mdl\_0\_**glow**.tga - glow map (use `_luma` if tenebrae compatibility is a concern)
25 progs/player.mdl\_0\_**luma**.tga - alternate tenebrae-compatible name for glow map (use one or the other)
26 progs/player.mdl\_0\_**pants**.tga - pants image, greyscale and does not cover the same pixels as the diffuse texture (this is additive blended ('Screen' mode in photoshop) ontop of the diffuse texture with a color tint according to your pants color)
27 progs/player.mdl\_0\_**shirt**.tga - shirt image, same type as pants
29 **Replacing textures in specific maps:**
30 textures/**e1m1**/ecop1\_6.tga
31 textures/**e1m1**/ecop1\_6\_norm.tga
32 textures/**e1m1**/ecop1\_6\_bump.tga
33 textures/**e1m1**/ecop1\_6\_glow.tga
34 textures/**e1m1**/ecop1\_6\_luma.tga
35 textures/**e1m1**/ecop1\_6\_pants.tga - pants and shirt layers are possible on bmodel entities with quakec modifications to set their .colormap field
36 textures/**e1m1**/ecop1\_6\_shirt.tga
38 **Replacing textures in all maps:**
40 textures/quake\_**norm**.tga
41 textures/quake\_**bump**.tga
42 textures/quake\_**glow**.tga
43 textures/quake\_**luma**.tga
44 textures/quake\_**pants**.tga
45 textures/quake\_**shirt**.tga
47 **Replacing hud and menu pictures:**
50 Diffuse Color + Alpha (Opacity)
51 -------------------------------
53 `textures/texturepackname/texturename.tga`
55 Generally should have ambient occlusion baked into the color (in other words, the grooves are dark), but no shading.
57 NormalMap + Relief Height
58 -------------------------
60 `textures/texturepackname/texturename_norm.tga`
62 The normalmap is OpenGL-style with green pointing up (often normalmap tools call this "inverted"), matching Doom3/Quake4/etc behavior, but contrary to several other games.
64 The height channel is black for deep areas and white for being flush with the surface, the height is used only when offsetmapping (`r_glsl_offsetmapping`) or reliefmapping (`r_glsl_offsetmapping_reliefmapping` also on) are active.
66 For best results the height channel should be fairly smooth, no fine bumps, just the overall shape of the material.
68 Specular Color + Specular Exponent
69 ----------------------------------
71 `textures/texturepackname/texturename_gloss.tga`
73 The specular (gloss) color is full color and basically indicates how bright the specular reflection should when a light illuminates this surface, it should be black where you want the surface to look dull and bright where you want a shiny appearance.
75 For best results, color the gloss according to the material involved, for example plastic or car paint has a white specular color, copper has an orange specular color, gold has a yellow specular color, steel has a very slight blue tint to its otherwise white specular color, aluminum also has a very slight tint.
77 Generally the specular color should have ambient occlusion baked into the color (just like the diffuse does).
79 The alpha channel of this texture will multiply the specular exponent (`r_shadow_glossexponent`), white alpha will be sharp highlights, dark alpha produces very broad highlights very bright highlights, in general sharp highlights indicate metal or hard plastic materials, aluminum has a different specular hardness than steel, etc.
84 `textures/texturepackname/texturename_glow.tga`
86 This is the luminous glow of the material, pretty much you want this to be black with color only where a light emitting part of the surface exists (for example a series of red dots for red LED lights).
88 Be sure not to have any glow color in the diffuse texture as it will not add up properly.
90 Alpha is unused at this time.
92 Reflection mask for cubemap environment mapping
93 -----------------------------------------------
95 `texturename_reflect.tga` - mask for the reflection, looks similar to gloss texture, basically this is where things will be shiny and what color of reflection (use orange for copper, yellow for gold, a slight blue tinted white color for steel, etc)
97 In shader: `dpreflectcube map/mapname/reflect1`
99 You can produce such a texture with this console command: `envmap map/mapname/reflect1 512`
101 Which will produce files such as:
102 `map/mapname/reflect1px.tga map/mapname/reflect1py.tga map/mapname/reflect1pz.tga map/mapname/reflect1nx.tga map/mapname/reflect1ny.tga map/mapname/reflect1nz.tga`
104 `map/mapname/reflect1ft.tga map/mapname/reflect1rt.tga map/mapname/reflect1bk.tga map/mapname/reflect1lf.tga map/mapname/reflect1up.tga map/mapname/reflect1dn.tga`
106 The first 6 are a cubemap, the last 6 are a skybox, keep one or the other set of files, you don't need both.
108 Material description (.shader) file
109 -----------------------------------
111 In gamedir/scripts the engine will load all files with the extension .shader using a Quake3-compatible shader loader, however not all features will be utilized (for example it only supports one layer shaders, additional layers may be used to activate special behaviors - such as lightmapping - but will not be directly rendered).
113 The syntax of the Quake3-compatible .shader files is best explained by examples, so there are several here to look at.
115 Many additional features can be added to any shader with expected results, such as `tcmod scroll 1 0` (makes a texture scroll in one direction), `deformvertexes autosprite` (makes a surface consisting of quads render as billboards facing the view), `deformvertexes autosprite2` (makes a surface consisting of rectangular quads - not square - rotate around their long axis to face the view, useful for flame trail sprites and torch flames among other things)...
120 textures/texturepackname/texturename
128 map textures/texturepackname/texturename
130 blendFunc GL_DST_COLOR GL_ZERO
134 Transparent additive-blend unlit material
135 -----------------------------------------
137 textures/texturepackname/texturename
140 surfaceparm nolightmap
146 map textures/texturepackname/texturename
152 Note: you can omit some of the surfaceparms (keep trans!) when making a model material rather than a map material.
157 textures/texturepackname/texturename
160 map textures/texturepackname/texturename
161 rgbgen lightingDiffuse
165 Model material that does not cast shadows
166 -----------------------------------------
168 textures/texturepackname/texturename
172 map textures/texturepackname/texturename
173 rgbgen lightingDiffuse
177 Invisible shadow-casting model material
178 ---------------------------------------
180 textures/common/shadowmesh
185 Lightmapped material with reflection cubemap and dpmeshcollisions
186 -----------------------------------------------------------------
188 textures/texturepackname/texturename
190 dpreflectcube textures/texturepackname/reflect1
198 map textures/texturepackname/texturename
200 blendFunc GL_DST_COLOR GL_ZERO
207 dp_reflect distort r g b a
209 Makes surfaces of this shader reflective with `r_water`. 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.
211 dp_refract distort r g b
213 Makes surfaces of this shader refractive with `r_water`. The refraction replaces the transparency of the texture. distort is used in conjunction with the normalmap to simulate a nonplanar water surface.
215 dp_water <reflectmin> <reflectmax> <refractdistort> <reflectdistort> <refractr> <refractg><refractb>
216 <reflectr> <reflectg> <reflectb> <alpha>
218 This combines the effects of dp_reflect and dp_refract 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.
220 tcmod page <width> <height> <delay>
222 The texture is shifted by 1/<width> every <delay> seconds, and by 1/<height> every <delay>\*<width> seconds. It is some sort of animmap replacement that keeps all animation frames in a single texture.
224 To use it, make a texture with the frames aligned in a grid like this:
229 then align it in Radiant so only one of the animation frames can be seen on the surface, and specify "tcmod page 4 2 0.1". DP will then display the frames in order and the cycle will repeat every 0.8 seconds.