Daniel Lyons' Notes

Metal

uv mapping in Metal

Case study

// Called in SwiftUI using .colorEffect()
[[ stitchable ]] float2 wave(
	float2 position, float time, float2 rect) {
		float2 uv = position / rect; // 👈🏼
		pos.y += sin(time * 5 + position.y / 20) * 5;
		return position;
	}
)
Width X UV
100 0 0
100 50 0.5
200 50 0.25
Metal
Interactive graph
On this page
uv mapping in Metal
Case study