Vectorizer is a Unity asset that allows you to create mesh-based vector graphics in 3D space, created by Adalberto L. Simeone. It provides several 2D primitives, including an SVG parser, that approximate geometrical shapes via 3D vertices and indices. Check it out in action on YouTube!
Vectorizer is free for research and academic purposes. For more information on how to request a license, please refer to this page.
SVG Parser
Simply copy and paste the SVG data (found in an SVG path's d
attribute) in a VectorizerPath component to instantly render it! All SVG commands, relative and absolute, are supported: lines, cubic and quadratic (smooth) Bézier curves, and elliptical arcs.
2D Figures
Vectorizer supports out-of-the-box the following primitives: regular and rounded polygons (from triangles to n-gons), regular and rounded rectangles, ellipses, rings, arcs and n-pointed stars. Any other polygon can be drawn via SVG instructions.
Round
Miter
Bevel
Polylines
Polylines with configurable Miter, Round, and Bevel joins.
URP, HDRP and standard pipeline support
Vectorizer creates simple 3D meshes, with UV coordinates. Therefore, you can use any shader (and material) you want, including those based on Unity's new render pipelines. All figures allow you to define a different material for each of the stroke and fill parts.
Vectorizer requires Unity 2019 for URP and HDRP support, and Unity 2018 LTS for the standard pipeline.
Samples
The package contains out of the box three sample scenes: Overview
shows all the figures available with the current release; SVG Icons
shows some Bootstrap icons rendered within Vectorizer; HexGrid
contains a simple script showing how to lay out a grid of hexagons built with Vectorizer.
new DrawPolyline(width, points);
new FillPolygon(vertices);
Code API
All Vectorizer figures are implemented as a sequence of instructions. You can define new objects by deriving VectorizerFigure.
Limitations
- No line dash-stroke support or configurable end-caps.
- No SVG fill-rule support . A work-around consists in separating paths in multiple figures.
- UI support can be achieved via camera stacking .