Return to the tutorials list.

6 - Custom Glsl shader

To demonstrate the use of a custom shader, this tutorial implement a glsl shader to render normal as color.

To connect with attribute and uniform such as vertex position, normal and matrices, the shader uses ShaderAttribute and ShaderUniform name. The engine will automatically detect them and send the appropriate value when rendering with the shader.
It also demonstrate the use of a user uniform to control in realtime the rendering of the shader. In this tutorial, the uniform is used as a scale factor to the color.

Preview
Custom shader

Shader off


Source Code