User Tools

Site Tools


hpl3:engine:materials

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:engine:materials [2011/11/18 15:13]
nebej
hpl3:engine:materials [2012/10/09 08:39] (current)
thomas [Optimizing]
Line 12: Line 12:
  
 ---- ----
 +
 +==== Mipmaps ====
 +
 +All textures that can (all textures in the dds format basically) must have pregenerated mipmaps in them. In the exporter tool (like [[http://​code.google.com/​p/​nvidia-texture-tools/​|Nvidia Texture Tools]]) it should be possible to do this. Having mipmaps is crucial as it improves the graphical qualtiy and makes loading faster. Also, for all the compressed formats (which means pretty much all that are used) it is not possible generate mipmaps in the application,​ making it even more important that the created dds textures have mipmaps in them!
 +
 +The filer used to generate the mipmaps is also important. Normally "​box"​ filter is good enough, but when there are many smaller details, these can easily become too blurred or strange aliasing patterns might arise. It is then better to use something like "​bessel",​ "​cubic",​ "​catrom"​ or similar. In the texture export tools there should be a list of these to chose from under mipmap generation. Best is to zoom out so it looks OK, and only if there are any strangeness do you have to think closer about what filter is being used. As said normally it is not a problem.
 +
 +A list of all filters along with images of resizing can be found [[http://​www.wunderboy.org/​images/​articles/​vtf_mipmap_filters4.jpg|here]]:​
 ==== Optimizing ==== ==== Optimizing ====
  
Line 18: Line 26:
   * Never add a texture unless it adds to the final material. For example, do not use black specular, flat blue normal maps, and so on. It is almost always better to just not set the texture at all.   * Never add a texture unless it adds to the final material. For example, do not use black specular, flat blue normal maps, and so on. It is almost always better to just not set the texture at all.
   * For textures that only use alpha, it is a good idea to embed it in the alpha of a texture. That way a single texture can fill up two texture slots. However, take note that if a texture with alpha is used in many materials and/or can have a lower resolution than the one it is part of, it might be good to keep it separate. ​   * For textures that only use alpha, it is a good idea to embed it in the alpha of a texture. That way a single texture can fill up two texture slots. However, take note that if a texture with alpha is used in many materials and/or can have a lower resolution than the one it is part of, it might be good to keep it separate. ​
 +
 +----
 +
 +==== Alpha ====
 +
 +Some of the texture types below will have the channel as alpha. There are two ways of doing this texture:
 +
 +  - It can simply be the alpha channel for a texture. If you have a DDS texture remember that DXT1 only has alpha that is either 1 or 0, so only use this if you do not want any gradients. (This is for instance OK with transparency for the solid material that does not support gradients anyway.)
 +  - Use a single channel (grayscale) texture. The engine will always load single channel texture as if the texture only consist of an alpha channel (even though the image editor might name it an red channel or similar).
 +
 +If possible, it often is faster and saves space to have it as an alpha in a texture, so use that when possible.
 +
  
 ---- ----
Line 62: Line 82:
  
 **IlluminationBrightness** | The brightness of the illumination texture. Multiplies with the illumination map, used to make the illumination brighter than 1.0 \\ **IlluminationBrightness** | The brightness of the illumination texture. Multiplies with the illumination map, used to make the illumination brighter than 1.0 \\
 +
 +**LiquidTrickleColor** | The color and alpha of the liquid \\
 +**LiquidTrickleSpecular** | Specular color and power of the liquid (RGB, Power). If set to (0,0,0,0) the original specular map value will be used \\
 +**LiquidTrickleLoopFade** | If the liquid animation should loop and fade in again after it has faded out \\
 +**LiquidTrickleFadeSpeed** | How fast the liquid fades in and then stays before fading out again. Unit is in seconds (Fade In, Fade Out) \\
 +**LiquidTrickleEdgeSize** | The size of the normal map edge generated by the trickling liquid \\
 +**LiquidTrickleDryness** | How long the generated liquid normal map should stay before drying back to the original normal map \\
 +**LiquidTrickleBlendMode** | Which blend mode that should be used when combining the liquid with the color. Specular always uses Alpha blending. With Illumination blend mode the liquid is added to the illumination output \\
  
 === Diffuse ===  === Diffuse === 
Line 76: Line 104:
 **Channels:​** G and Alpha (must use special exporter for this!)\\ **Channels:​** G and Alpha (must use special exporter for this!)\\
 **Type:** 2D\\ **Type:** 2D\\
-**File format:** dds, 3dc.\\+**File format:** dds, 3dc (aka DXN, BC5).\\
 **Suffix:** “nrm”.\\ **Suffix:** “nrm”.\\
 The normal map for the material and uses the standard format rgb = xyz and is in tangent space. Note that this needs to be converted to a format of XY only though! ​ The normal map for the material and uses the standard format rgb = xyz and is in tangent space. Note that this needs to be converted to a format of XY only though! ​
Line 144: Line 172:
 === Detail Diffuse Map ===  === Detail Diffuse Map === 
 **Size:** NA, this is entirely up to how the texture is repeated\\ **Size:** NA, this is entirely up to how the texture is repeated\\
-**Channels:​** ​Alpha\\+**Channels:​** ​RGB\\
 **Type:** 2D\\ **Type:** 2D\\
-**File format:​** ​tgasingle channel (greyscale). (or dxt5 if mipmaps are needed!!)\\+**File format:​** ​ddsdxt1\\
 **Suffix:** “detail_diff”.\\ **Suffix:** “detail_diff”.\\
 A detail map is special in that it uses differnt UV coordinates from the rest of the textures (see variables). This map blends with the diffuse and specular (each according to weights, see variables section). The way it mixes, Grey (127) means that nothing is changed, darker (126 or below) makes the result darker, and brighter (128 or above) makes the result brighter).\\ A detail map is special in that it uses differnt UV coordinates from the rest of the textures (see variables). This map blends with the diffuse and specular (each according to weights, see variables section). The way it mixes, Grey (127) means that nothing is changed, darker (126 or below) makes the result darker, and brighter (128 or above) makes the result brighter).\\
Line 155: Line 183:
 **Channels:​** G and Alpha (must use special exporter for this!)\\ **Channels:​** G and Alpha (must use special exporter for this!)\\
 **Type:** 2D\\ **Type:** 2D\\
-**File format:** dds, 3dc.\\+**File format:** dds, 3dc (aka DXN, BC5).\\
 **Suffix:** “detail_nrm”.\\ **Suffix:** “detail_nrm”.\\
 Detail normal works basically like the diffuse version, but on the normal map. Detail normal works basically like the diffuse version, but on the normal map.
Line 166: Line 194:
 **Suffix:** “trans”.\\ **Suffix:** “trans”.\\
 This allows part of the texture to shine through to the backside when lit. This is good for thin organic shapes like nose-wings, leaves and fish-fins. Note that for this to work, the mesh must not cast a shadow or it must be thin enough (how thin depends on shadow settings). White means that all light from the front comes out back and black means that no light does. This allows part of the texture to shine through to the backside when lit. This is good for thin organic shapes like nose-wings, leaves and fish-fins. Note that for this to work, the mesh must not cast a shadow or it must be thin enough (how thin depends on shadow settings). White means that all light from the front comes out back and black means that no light does.
 +
 +=== Liquid Map === 
 +**Size:** 100% - 25%\\
 +**Channels:​** G and Alpha (must use special exporter for this!)\\
 +**Type:** 2D\\
 +**File format:** dds, 3dc (aka DXN, BC5), tga for high quality.\\
 +**Suffix:** “liquid”.\\
 +This texture shows how liquid should fade in, move and fade out over an object. The red channel contains a mask for how liquid should fade in on the image, the brighter a pixel is the earlier the liquid will cover it. The green channel contains a mask for how the liquid should fade out. If a 3dc compressed texture produces poor results then a RGBA tga should be used with the red channel stored in the alpha channel and the green channel stored in the blue channel.
 +If the liquid is very thin then the mip-map filter should be set to "​Point"​ when exporting the texture.
 +
  
 ---- ----
Line 217: Line 255:
 **SoftPartAlphaBasedThickness** | The percived thickness of the particle based on the alpha channel of the particle, measured in meters\\ **SoftPartAlphaBasedThickness** | The percived thickness of the particle based on the alpha channel of the particle, measured in meters\\
 **SoftPartDepthBias** | Moves the soft particle closer to or further away from the camera (Negative value only work for point billboards)\\ **SoftPartDepthBias** | Moves the soft particle closer to or further away from the camera (Negative value only work for point billboards)\\
 +
 +**LiquidTrickleColor** | The color and alpha of the liquid \\
 +**LiquidTrickleLoopFade** | If the liquid animation should loop and fade in again after it has faded out \\
 +**LiquidTrickleFadeSpeed** | How fast the liquid fades in and then stays before fading out again. Unit is in seconds (Fade In, Fade Out) \\
 +**LiquidTrickleEdgeSize** | The size of the normal map edge generated by the trickling liquid (Only used with refraction or EnvMap)\\
 +**LiquidTrickleDryness** | How long the generated liquid normal map should stay before drying back to the original normal map  (Only used with refraction or EnvMap) \\
  
 === Diffuse Map === === Diffuse Map ===
Line 233: Line 277:
 **Channels:​** G and Alpha (must use special exporter for this!)\\ **Channels:​** G and Alpha (must use special exporter for this!)\\
 **Type:** 2D\\ **Type:** 2D\\
-**File format:** dds, 3dc.\\+**File format:** dds, 3dc (aka DXN, BC5).\\
 **Suffix:** “nrm”.\\ **Suffix:** “nrm”.\\
 Instead of changing the way light is shaded (like with solid material), here the normal map is used to distort the background (if refraction is set to true) and/or to change the way reflection is calculated.\\ Instead of changing the way light is shaded (like with solid material), here the normal map is used to distort the background (if refraction is set to true) and/or to change the way reflection is calculated.\\
Line 262: Line 306:
 **Suffix:** “sway” (do NOT use "​height"​).\\ **Suffix:** “sway” (do NOT use "​height"​).\\
 This map is used for sway, so when sway is active and NOT for any parallax stuff. It act as a factor for the sway. Black = no sway, White = full sway and all in between for greyscale of course. So if doing a swaying plant, make it black at the base of the plant and whiter as it comes nearer the top. This map is used for sway, so when sway is active and NOT for any parallax stuff. It act as a factor for the sway. Black = no sway, White = full sway and all in between for greyscale of course. So if doing a swaying plant, make it black at the base of the plant and whiter as it comes nearer the top.
 +
 +=== Liquid Map === 
 +**Size:** 100% - 25%\\
 +**Channels:​** G and Alpha (must use special exporter for this!)\\
 +**Type:** 2D\\
 +**File format:** dds, 3dc (aka DXN, BC5), tga for high quality.\\
 +**Suffix:** “liquid”.\\
 +This texture shows how liquid should fade in, move and fade out over an object. The red channel contains a mask for how liquid should fade in on the image, the brighter a pixel is the earlier the liquid will cover it. The green channel contains a mask for how the liquid should fade out. If a 3dc compressed texture produces poor results then a RGBA tga should be used with the red channel stored in the alpha channel and the green channel stored in the blue channel.
 +If the liquid is very thin then the mip-map filter should be set to "​Point"​ when exporting the texture.
  
 ---- ----
Line 281: Line 334:
 === Variables === === Variables ===
  
-**HeightMapScale**\\ +**HeightMapScale** ​The scale of the height map.\\ 
-The scale of the height map.+**HeightMapBias** | Not used.\\
  
-**HeightMapBias**\\ +**FrenselBias** | Not used.\\ 
-Not used.+**FrenselPow** | Not used.\\
  
-**FrenselBias**\\ +**DetailUvMul** | The amount the UV maps are multiplied with. The higer the more the detail maps are repeated\\ 
-Not used. +**DetailWeight** | Weight for the diffuse detailValid values: 0 - 2.0\\ 
- +**DetailFadeStart** | When the details start fading out.\\ 
-**FrenselPow**\\ +**DetailFadeEnd** | When details have completely faded out\\
-Not used.+
  
 === Diffuse Map === === Diffuse Map ===
Line 306: Line 358:
 **Channels:​** G and Alpha (must use special exporter for this!)\\ **Channels:​** G and Alpha (must use special exporter for this!)\\
 **Type:** 2D\\ **Type:** 2D\\
-**File format:** dds, 3dc.\\+**File format:** dds, 3dc (aka DXN, BC5).\\
 **Suffix:** “nrm”.\\ **Suffix:** “nrm”.\\
 Instead of changing the way light is shaded (like with solid material), here the normal map is used to distort the background (if refraction is set to true) and/or to change the way reflection is calculated.\\ Instead of changing the way light is shaded (like with solid material), here the normal map is used to distort the background (if refraction is set to true) and/or to change the way reflection is calculated.\\
Line 326: Line 378:
 **Suffix:** “height”.\\ **Suffix:** “height”.\\
 Height map is more like a depth map actually. White = largest depth, Black = no depth and this is important to remember when creating it.  Height map is more like a depth map actually. White = largest depth, Black = no depth and this is important to remember when creating it. 
 +
 +=== Detail Diffuse ===
 +**Size:** NA, this is entirely up to how the texture is repeated\\
 +**Channels:​** RGB\\
 +**Type:** 2D\\
 +**File format:** dds, dxt1\\
 +**Suffix:** “detail_diff”.\\
 +A detail map is special in that it uses differnt UV coordinates from the rest of the textures (see variables). This map blends with the diffuse and specular (each according to weights, see variables section). The way it mixes, Grey (127) means that nothing is changed, darker (126 or below) makes the result darker, and brighter (128 or above) makes the result brighter).\\
 +There is a variable for fading this out at a distance, but in some special cases this might not look good. In that case use dxt5 and have custom mipmaps that fade to gray in an appropriate way. Only use this if really needed though!
 +
  
 ---- ----
Line 373: Line 435:
 If the water will cover a large surface and will need special sorting when rendering other transperant objects If the water will cover a large surface and will need special sorting when rendering other transperant objects
  
 +**HasVertexWaves"​**\\
 +If the vertices are animated.
 +
 +**VertexWaveSpeed**\\
 +The speed of the vertex waves.
 +
 +**VertexWaveAmplitude**\\
 +The size of the vertex waves.
 +
 +**VertexWaveFreq**\\
 +The frequency of the vertex waves.
 +
 +**FadeWhenShallowMul**\\
 +This determines when the water should start fading when in shallow water. In meters.
 +
 +**FadeWhenShallowPow**\\
 +How fast the shallow water drops off, higher means faster, lower means slower.
  
 === Blend Modes === === Blend Modes ===
Line 391: Line 470:
 **Channels:​** G and Alpha (must use special exporter for this!)\\ **Channels:​** G and Alpha (must use special exporter for this!)\\
 **Type:** 2D\\ **Type:** 2D\\
-**File format:** dds, 3dc.\\+**File format:** dds, 3dc (aka DXN, BC5).\\
 **Suffix:** “nrm”.\\ **Suffix:** “nrm”.\\
 Instead of changing the way light is shaded (like with solid material), here the normal map is used to distort the background (if refraction is set to true) and/or to change the way reflection is calculated.\\ Instead of changing the way light is shaded (like with solid material), here the normal map is used to distort the background (if refraction is set to true) and/or to change the way reflection is calculated.\\
Line 403: Line 482:
 **Suffix:** “env”.\\ **Suffix:** “env”.\\
 This will apply a cube to the mesh as if it is was reflecting it (hence called “environment map”). It will be used instead of the world reflection, thus making the water rendering ALOT faster! This will apply a cube to the mesh as if it is was reflecting it (hence called “environment map”). It will be used instead of the world reflection, thus making the water rendering ALOT faster!
- 
hpl3/engine/materials.1321629218.txt.gz · Last modified: 2011/11/18 15:13 by nebej