Predefined Effects |
DigitalRune Graphics contains several predefined effects (see also Pre-Built Content). This topic contains a list of all included effects.
This topic contains the following sections:
The effects listed in this topic can be used to render models. (This topic does not contain effects used for post-processing or other render passes.)
Supported features:
The tables below list the supported combinations. New variants or combinations can be added as needed. The existing effects can also be used as a reference implementation for writing custom effects. The source code of these effects is included in the DigitalRune Engine.
In the "GBuffer" pass a light pre-pass renderer renders the models into the G-Buffer. The G-buffer stores depth, normal, and specular power of each pixel. The following effects can be used for the G-buffer pass:
Effect | Morphing | Mesh Skinning | Normal Map | Alpha Test | Screen-Door Transparency |
---|---|---|---|---|---|
DigitalRune/Materials/GBuffer | |||||
DigitalRune/Materials/GBufferSkinned | X | ||||
DigitalRune/Materials/GBufferMorphSkinned | X | X | |||
DigitalRune/Materials/GBufferNormal | X | ||||
DigitalRune/Materials/GBufferNormalSkinned | X | X | |||
DigitalRune/Materials/GBufferNormalMorphSkinned | X | X | X | ||
DigitalRune/Materials/GBufferAlphaTest | X | ||||
DigitalRune/Materials/GBufferAlphaTestNormal | X | X | |||
DigitalRune/Materials/GBufferTransparent | X | ||||
DigitalRune/Materials/GBufferNormalTransparent | X | X |
These effects use the following effect parameters:
Parameter | Type | Description | Used By |
---|---|---|---|
SpecularPower | float | The specular power (a.k.a. specular exponent). | GBuffer, GBufferAlphaTest, GBufferSkinned, GBufferMorphSkinned, GBufferNormal, GBufferAlphaTestNormal, GBufferNormalSkinned, GBufferMorphNormalSkinned, GBufferNormalTransparent, GBufferTransparent |
DiffuseTexture | Texture | The diffuse texture (RGB) with alpha (A). | GBufferAlphaTest, GBufferAlphaTestNormal |
NormalTexture | Texture | The normal map. | GBufferNormal, GBufferAlphaTestNormal, GBufferNormalSkinned, GBufferMorphNormalSkinned, GBufferNormalTransparent, |
ReferenceAlpha | float | The reference alpha for alpha testing. | GBufferAlphaTest, GBufferAlphaTestNormal, |
InstanceAlpha | float | The opacity value for screen-door transparency. | GBufferNormalTransparent, GBufferTransparent |
In the "Material" pass a light pre-pass renderer combines the material properties (diffuse color, specular color, etc.) with the light information (diffuse light, specular light) stored in the light buffer. The following effects can be used for the Material pass:
Effect | Morphing | Mesh Skinning | Alpha Test | Emissive Map | Screen-Door Transparency |
---|---|---|---|---|---|
DigitalRune/Materials/Material | |||||
DigitalRune/Materials/MaterialSkinned | X | ||||
DigitalRune/Materials/MaterialMorphSkinned | X | X | |||
DigitalRune/Materials/MaterialAlphaTest | X | ||||
DigitalRune/Materials/MaterialAlphaTestEmissive | X | X | |||
DigitalRune/Materials/MaterialEmissive | X | ||||
DigitalRune/Materials/MaterialEmissiveSkinned | X | X | |||
DigitalRune/Materials/MaterialTransparent | X |
These effects use the following effect parameters:
Parameter | Type | Description | Used By |
---|---|---|---|
DiffuseColor | float3 | The diffuse material color. | Material, MaterialAlphaTest, MaterialAlphaTestEmissive, MaterialEmissive, MaterialEmissiveSkinned, MaterialMorphSkinned MaterialSkinned, MaterialTransparent |
SpecularColor | float3 | The specular material color. | Material, MaterialAlphaTest, MaterialAlphaTestEmissive, MaterialEmissive, MaterialEmissiveSkinned, MaterialMorphSkinned MaterialSkinned, MaterialTransparent |
EmissiveColor | float3 | The emissive material color. | MaterialAlphaTestEmissive, MaterialEmissive, MaterialEmissiveSkinned, |
DiffuseTexture | Texture | The diffuse texture (RGB) with optional alpha (A). | Material, MaterialAlphaTest, MaterialAlphaTestEmissive, MaterialEmissive, MaterialEmissiveSkinned, MaterialMorphSkinned MaterialSkinned, MaterialTransparent |
SpecularTexture | Texture | The specular texture (RGB) with optional emissive mask (A). | Material, MaterialAlphaTest, MaterialAlphaTestEmissive, MaterialEmissive, MaterialEmissiveSkinned, MaterialMorphSkinned MaterialSkinned, MaterialTransparent |
ReferenceAlpha | float | The reference alpha for alpha testing. | MaterialAlphaTest, MaterialAlphaTestEmissive, |
InstanceAlpha | float | The opacity value for screen-door transparency. | MaterialTransparent |
In the "ShadowMap" pass the shadow-casting models are rendered into the shadow map. The following effects can be used for the shadow map pass:
Effect | Morphing | Mesh Skinning | Alpha Test |
---|---|---|---|
DigitalRune/Materials/ShadowMap | |||
DigitalRune/Materials/ShadowMapSkinned | X | ||
DigitalRune/Materials/ShadowMapMorphSkinned | X | X | |
DigitalRune/Materials/ShadowMapAlphaTest | X | ||
DigitalRune/Materials/ShadowMapAlphaTestSkinned | X | X |
These effects use the following effect parameters:
Parameter | Type | Description | Used By |
---|---|---|---|
DiffuseTexture | Texture | The diffuse texture (RGB) and alpha mask (A). | ShadowMapAlphaTest, ShadowMapAlphaTestSkinned |
ReferenceAlpha | float | The reference alpha for alpha testing. | ShadowMapAlphaTest, ShadowMapAlphaTestSkinned |
The "AlphaBlend" pass uses normal forward rendering to render models which can be transparent. The following effects can be used for forward rendering and alpha-blending:
Effect | Description |
---|---|
DigitalRune/Materials/Forward | Renders a model with diffuse and specular texture. The effect supports 1 ambient light, 1 one directional light and 1 fog effect. |
DigitalRune/Materials/ForwardTwoSided | Renders a model with diffuse and specular texture. The effect supports 1 ambient light, 1 one directional light and 1 fog effect. The model is rendered in two passes: First the back-sides are rendered, then the front-sides are rendered. |
These effects use the following effect parameters:
Parameter | Type | Description | Used By |
---|---|---|---|
DiffuseColor | float3 | The diffuse material color. | Forward, ForwardTwoSided |
SpecularColor | float3 | The specular material color. | Forward, ForwardTwoSided |
SpecularPower | float | The specular power (a.k.a. specular exponent). | Forward, ForwardTwoSided |
DiffuseTexture | Texture | The diffuse texture (RGB) and alpha (A). | Forward, ForwardTwoSided |
SpecularTexture | Texture | The specular texture. | Forward, ForwardTwoSided |
Alpha | float | The opacity of the mesh. | Forward, ForwardTwoSided |
The "Occluder" pass is a special pass that is used to render meshes into the occlusion buffer for occlusion culling. An example is given in: OcclusionBuffer
Caution |
---|
Most meshes are too complex to be used as occluders. It is recommended to use occlusion proxies (see class Occluder) instead. |
Effect | Mesh Skinning |
---|---|
DigitalRune/Materials/Occluder | |
DigitalRune/Materials/OccluderSkinned | X |
These effects do not require effect parameters.
Material capture effects ("MatCap") render an object by sampling a surface material texture using the normal vector.
Effect | Mesh Skinning | Normal Map |
---|---|---|
DigitalRune/Materials/Matcap | ||
DigitalRune/Materials/MatcapSkinned | X | |
DigitalRune/Materials/MatcapNormal | X | |
DigitalRune/Materials/MatcapNormalSkinned | X | X |
These effects use the following effect parameters:
Parameter | Type | Description | Used By |
---|---|---|---|
MatcapTexture | Texture | The material capture texture. | Matcap, MatcapNormal, MatcapNormalSkinned, MatcapSkinned |
NormalTexture | Texture | The normal map. | MatcapNormal, MatcapNormalSkinned |
The XNA stock effects are also supported:
The XNA AlphaTestEffect.
This effect uses the following effect parameters:
Parameter | Type | Description |
---|---|---|
Alpha | float | The material alpha. |
DiffuseColor | float3 | The diffuse material color. |
Texture | Texture | The diffuse texture. |
ReferenceAlpha | int | The reference alpha for alpha testing. |
VertexColorEnabled | bool | A value indicating whether vertex colors are enabled. |
The XNA BasicEffect.
This effect uses the following effect parameters:
Parameter | Type | Description |
---|---|---|
Alpha | float | The material alpha. |
DiffuseColor | float3 | The diffuse material color. |
EmissiveColor | float3 | The emissive material color. |
SpecularColor | float3 | The specular material color. |
SpecularPower | float | The specular power (a.k.a. specular exponent). |
Texture | Texture | The diffuse texture. |
VertexColorEnabled | bool | A value indicating whether vertex colors are enabled. |
The XNA DualTextureEffect.
This effect uses the following effect parameters:
Parameter | Type | Description |
---|---|---|
Alpha | float | The material alpha. |
DiffuseColor | float3 | The diffuse material color. |
Texture | Texture | The base texture. |
Texture2 | Texture | The overlay texture. |
VertexColorEnabled | bool | A value indicating whether vertex colors are enabled. |
The XNA EnvironmentMapEffect.
This effect uses the following effect parameters:
Parameter | Type | Description |
---|---|---|
Alpha | float | The material alpha. |
DiffuseColor | float3 | The diffuse material color. |
EmissiveColor | float3 | The emissive material color. |
EnironmentMapSpecular | float3 | The specular light color which is multiplied by the environment map alpha and added to the material. (Used to simulate specular highlights.) |
EnvironmentMapAmount | float | The amount of the environment map color that will be blended with the base texture. |
FresnelFactor | float | The Fresnel factor used for environment map blending. |
Texture | Texture | The diffuse texture. |
EnvironmentMap | TextureCube | The environment map texture. |
The XNA SkinnedEffect.
This effect uses the following effect parameters:
Parameter | Type | Description |
---|---|---|
Alpha | float | The material alpha. |
DiffuseColor | float3 | The diffuse material color. |
EmissiveColor | float3 | The emissive material color. |
SpecularColor | float3 | The specular material color. |
SpecularPower | float | The specular power (a.k.a. specular exponent). |
Texture | Texture | The diffuse texture. |
WeightsPerVertex | int | The number of skinning weights per vertex (max 4). |
Decals are similar to models. They are also rendered using materials. However, decals need to be rendered with different vertex and pixel shaders and therefore require different effects.
The following effects can be used for decals:
Effect | Description |
---|---|
DigitalRune/Decals/GBuffer | Equivalent to DigitalRune/Materials/GBuffer. |
DigitalRune/Decals/GBufferAlphaTest | Equivalent to DigitalRune/Materials/GBufferAlphaTest. |
DigitalRune/Decals/GBufferAlphaTestNormal | Equivalent to DigitalRune/Materials/GBufferAlphaTestNormal. |
DigitalRune/Decals/GBufferNormal | Equivalent to DigitalRune/Materials/GBufferNormal. |
DigitalRune/Decals/Material | Equivalent to DigitalRune/Materials/Material. |
DigitalRune/Decals/MaterialAlphaTest | Equivalent to DigitalRune/Materials/MaterialAlphaTest. |
DigitalRune/Decals/MaterialAlphaTestEmissive | Equivalent to DigitalRune/Materials/MaterialAlphaTestEmissive. |
DigitalRune/Decals/MaterialEmissive | Equivalent to DigitalRune/Materials/MaterialEmissive. |
Here is an example which shows how these effects can be used in a material definition file.
<?xml version="1.0" encoding="utf-8"?> <Material> <Pass Name="Default" Effect="SkinnedEffect" Profile="Any"> <Parameter Name="DiffuseColor" Value="1,1,1" /> <Parameter Name="SpecularColor" Value="0.1,0.1,0.1" /> <Parameter Name="SpecularPower" Value="10" /> <Texture Name="Texture" File="upBodyC.tga" /> </Pass> <Pass Name="ShadowMap" Effect="DigitalRune/Materials/ShadowMapSkinned" Profile="HiDef" /> <Pass Name="GBuffer" Effect="DigitalRune/Materials/GBufferNormalSkinned" Profile="HiDef"> <Parameter Name="SpecularPower" Value="10" /> <Texture Name="NormalTexture" Format="Normal" File="upBodyN.tga" /> </Pass> <Pass Name="Material" Effect="DigitalRune/Materials/MaterialSkinned" Profile="HiDef"> <Parameter Name="DiffuseColor" Value="1,1,1" /> <Parameter Name="SpecularColor" Value="1,1,1" /> <Texture Name="DiffuseTexture" File="upBodyC.tga" /> <Texture Name="SpecularTexture" File="upBodyS.tga" /> </Pass> </Material>