Vector texture shader

I've been working on a glsl shader to use SVG-like vector images instead of textures… It works by checking to see if each pixel is in a shape.

So far I've just got shader code for basic shapes:

  • Rectangle

  • Ellipse

  • Triangle

  • Rounded Rectangle

Currently working on the curve.. Instead of interpolating points into triangles, I'm transforming a curve into a circle for the shape inclusion test.

Things to do:

  • Convert polygon data into triangles, use boolean intersection to remove curve volume

  • Parse SVG to internal format

  • Save within texture as bytecode and data

  • Parse from texture and run bytecode for each pixel

  • Add support for transformations

  • Add support for texturing with mini tileable units

  • Add support for gradients.

  • Use multiple program textures for different objects but use the same render pass.


  • I would like to see clearer textures when close. Last attempt used batik to render SVG to texture was slow and memory intensive.

  • We could use this for splatting textures of variable resolutions, so say, a car door could have a pretty boring low-res fill, but maybe a higher resolution bullet-hole.

  • We could blend textures with gradients.

  • We could outline prominent features on textures.

  • We could potentially remove detail at distance based on pixel depth, transition, or switch to different LOD.

  • We could use this on text characters.

I don't currently intend to get into the interactable side of the SVG spec, mainly because the method I am using for curves currently needs to be pre-processed..

Some random dev photos: