// ExampleShader.usf // Include common material functions #include "Common.usf" // Vertex shader input structure struct VertexInput { float4 Position : ATTRIBUTE0; // Vertex position float2 UV : ATTRIBUTE1; // Texture coordinates }; // Vertex shader output structure struct VertexOutput { float4 Position : SV_POSITION; // Clip-space position float2 UV : TEXCOORD0; // Texture coordinates passed to the pixel shader }; // Vertex shader function VertexOutput MainVS(VertexInput In) { VertexOutput Out; // Transform the vertex position to clip space Out.Position = mul(In.Position, View.WorldToClip); // Pass the UV coordinates to the pixel shader Out.UV = In.UV; return Out; } // Pixel shader function float4 MainPS(VertexOutput In) : SV_Target { // Define a constant color (e.g., blue) float3 BaseColor = float3(0.0, 0.0, 1.0); // Return the color with full opacity return float4(BaseColor, 1.0); } // Register the shaders VS_Main(MainVS); // Register the vertex shader PS_Main(MainPS); // Register the pixel shader
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter