Built-in Shaders

From Multiverse

Jump to: navigation, search
This is a work in progress. It will be incomplete and may contain errors or omissions until it is finished.



Contents

Overview of built-in shaders

The Multiverse Sampleworld asset repository comes with a set of built-in shaders in the GpuPrograms directory.

These shaders are:

  • AlphaSplatTerrain.cg
  • AlphaSplatTerrain.program
  • Blur0_ps20.hlsl
  • Blur0_vs11.hlsl
  • Blur1_ps20.hlsl
  • Blur1_vs11.hlsl
  • Combine_fp.cg
  • Compound_Basic_Skinned.cg - a basic vertex shader with hardware skinning for animations with blend weight per vertex.
  • DetailVeg.cg
  • DiffuseBump.cg - Bump mapping shader
  • GlassFP.cg
  • GrayScale.cg
  • HMETerrain.cg
  • HeatVision.cg
  • InvertFP.cg
  • LaplaceFP.cg
  • MVSMShadows.cg
  • MVSMShadows.program
  • Multiverse.program
  • Ocean.cg
  • OldMovieFP.cg
  • OldTV.cg
  • PosterizeFP.cg
  • SharpenEdgesFP.cg
  • StdQuad_vp.cg
  • StdQuad_vp.program
  • Terrain.cg
  • TilingFP.cg
  • Trees.cg
  • hdr.hlsl


Bump mapping shader

The DiffuseBump.cg shader performs bump mapping. This shader is provided in the Sampleworld and basic Client asset repositories.

The following table describes the functions in this shader.

Function Description Required shader programs
SimpleVS_Skinned Maps the light and eye directions into tangent space. Tangents are passed in with the tangent semantic. This also handles the light setup, including attenuation for up to two lights, and linear fog.
DiffuseBumpPS_20_NS Apply the normal map and specular map.
DiffuseBumpPS_20_N Apply the normal map. Specular color should be scaled down.
AmbientOneVS Basic ambient lighting vertex program.
AmbientOneVS_Skinned Basic ambient lighting vertex program.
CompoundVS Used for models that have normal maps and static geometry.

The tangent data should be in the vertex buffer with the TANGENT semantic. This shader also sets up the fog parameters.

Vertex shader 1.1 or better
CompoundVS_Skinned Used for models that have normal maps and uses hardware skinning for animation.

The tangent data should be in the vertex buffer with the TANGENT semantic. This shader also sets up the fog parameters.

Vertex shader 2.0 or better
CompoundVS_TexTangent Used for models that have normal maps and static geometry.

The tangent data should be in the vertex buffer with the TEXCOORD1 semantic. This shader also sets up the fog parameters.

Vertex shader 1.1 or better
CompoundVS_TexTangent_Skinned Used for models that have normal maps and uses hardware skinning for animation.

The tangent data should be in the vertex buffer with the TEXCOORD1 semantic. This shader also sets up the fog parameters.

Vertex shader 2.0 or better
CompoundPS_20_NS Uses a normal map and specular map to light a model.

It expects some parameters such as the eye direction, light direction and attenuation properties to have been set up by the vertex shader. This shader supports two lights as well as ambient and emissive.

Pixel shader 2.0 or better
CompoundPS_20_N Uses a normal map to light a model.

It expects some parameters such as the eye direction, light direction and attenuation properties to have been set up by the vertex shader. This shader supports two lights as well as ambient and emissive.

Pixel shader 2.0 or better

Additional shaders

The following shaders are not included in the Multiverse asset repositories, but you can use them for additional effects.

Basic ambient lighting vertex shader

The Example_Basic.cg shader is a basic ambient lighting vertex program.

Functions:

  • ambientOneTexture_vp
  • hardwareSkinningOneWeight_vp
  • hardwareSkinningOneWeightCaster_vp
  • hardwareSkinningFourWeights_vp
  • hardwareMorphAnimation
  • hardwarePoseAnimation

For the source code of this shader, see Example_Basic.cg Source.

Bump mapping shader

The Example_BumpMapping.cg shader is a basic example of a bump mapping shader.

  • main_vp
  • main_shadowreceiver_vp
  • main_fp
  • main_shadowreceiver_fp
  • specular_vp
  • specular_fp

For the source code of this shader, see Example_BumpMapping.cg Source.

Cel shader

The Example_CelShading.cg shader is an example of a simple cel shader.

Functions:

  • main_vp
  • main_fp

See Example_CelShading.cg Source.

Personal tools