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
Texture2D.Load(...)Sampler.Create()- Bind both to
Material<Shader>()fields - Draw with
cmd.DrawIndexed(...)
Next Steps
- Scene2D Basics - Sprite rendering with textures
- Mesh Builder - Building mesh UVs in script