C#
public class BasicColorShader
{
[ShaderStage(Stage.Vertex)]
public VertexOutput Vertex(VertexInput input)
{
var output = new VertexOutput();
output.Position = new Vector4(
input.Position.X, input.Position.Y, 0f, 1f);
output.Color = input.Color;
return output;
}
[ShaderStage(Stage.Fragment)]
public Vector4 Fragment(VertexOutput input)
=> input.Color;
}
Tutorial · C#
Get Started
Learn from scratch how to write shaders in C# and see them run. The tutorial has one guide for each engine: MonoGame, KNI, FNA and Godot. The chapters and the shaders are the same; only the window, the project and the commands change. Pick your engine: