Skip to main content

Textures and Samplers

Texturing uses Texture2D resources and a Sampler.


Load a Texture

albedo is Texture2D.Load("examples/assets/checker.png");

Create a Sampler

linearSampler is Sampler.Create();

Sample in Shader

Fragment method(uv as Vector2) {
return albedo.Sample(linearSampler, uv) * tint;
}

Common Texture Flow

  1. Texture2D.Load(...)
  2. Sampler.Create()
  3. Bind both to Material<Shader>() fields
  4. Draw with cmd.DrawIndexed(...)

Next Steps