Skip to content
Caspar Jacob edited this page Jun 4, 2013 · 4 revisions

Using Fusee Shaders

There are some predefined Shaders in Fusee, ready to use in your Application. The first step you have to do is to get a shader and assign it to a variable from type ShaderProgram.

ShaderProgram _sp = MoreShaders.GetShader("Name of the Shader", RC);

A Shader contains parameters, you have to set. For example textures, colors or other values. Set the Shader in RenderContext, create parameter handels from type IShaderParam and fill it with shader parameters.

//Set the Shader

RC.SetShader(_sp);

//Get the shader parameter and assign it to the created handle

IShaderParam color = RC.GetShaderParam(_sp, "color");

Now you can set the shader values, using your handles

//Fill the shader parameter with a random color

RC.SetShaderParam(color, new float4(1,0,0,1);

List of different shaders and shader parameter

Simple Color

Get it with: MoreShaders.GetShader("color", RC);

Parameters, you have to set:

  • float4 color;

Simple Texture

Get it with: MoreShaders.GetShader("texture", RC);

Parameters, you have to set:

  • iTexture texture1;

Diffuse-Shader

Get it with: MoreShaders.GetShader("diffuse", RC);

Parameters, you have to set:

  • iTexture texture1;

Hint: Set a light to use this shader.

Specular-Shader

Get it with: MoreShaders.GetShader("specular", RC);

Parameters, you have to set:

  • iTexture texture1;
  • float specularLevel;
  • float shininess;

Hint: Set a light to use this shader.

Bump-Shader

Get it with: MoreShaders.GetShader("bump", RC);

Parameters, you have to set:

  • iTexture texture1;
  • iTexture normalTex;
  • float specularLevel;
  • float shininess;

Hint: Set a light to use this shader.

[Get FUSEE going] (HOWTO-Get-FUSEE-Going-(download,-build-and-run-step-by-step))

Overall Project Structure

[How FUSEE Builds] (How-FUSEE-Builds)

Clone this wiki locally