Getting Started (version 1.1.0)
You can add VectorizerFigures
to your scene either via the menu GameObject/Vectorizer/Add ...
or manually by creating an empty GameObject
; then click on AddComponent
and start typing Vectorizer...
; finally choose the element you want from the list.
Every VectorizerFigure
will create two child GameObjects
: one representing the Stroke
part of the figure (if its StrokeThickness
is greater than zero), and another for the Fill.
StrokeThickness
Every VectorizerFigure
provides object-specific properties. One that you can find in every object is the StrokeThickness
. Defines how many units of width to use to draw the outline of the figure. If it is equal to zero, the Stroke
part of the mesh will not be drawn.
Materials
In order to assign the material you wish to use for the figure's Stroke
and Fill
, remember to do so via the corresponding properties in the root GameObject
.
The library provides a special URP shader called StrokeDepthOffset
. This material applies a customisable Offset Bias to the rendered figure, to avoid Z-Fighting. In most figures, this is unnecessary. However, in some complex figures with hundreds of vertices (such as partial rings) or SVG figures (not designed for use in Vectorizer) the stroke might appear to overlap with the fill part. This material, when applied to the stroke, will make sure that it appears always on top.
There is also another URP shader, called TextureUV
, that allows you to visualise UV coordinates.
Debugging
Click on either the Stroke or Fill child gameobject you wish to debug and add a VectorizerMeshDebugger
component. This will allow you to inspect the vertices, indices, and Texture coordinates of the generated figure. Built-in methods allow you to display in the Scene View which vertex or triangle the values refer to.
It also allows you to save the generated mesh to disk, by clicking on Save Asset
. Files will be saved in the Assets/Vectorizer
folder.
Notes on Performance
VectorizerFigure
are essentially just meshes. Simple icon-like graphics will likely have very few vertices, and therefore the performance will be negligible on modern GPUs. Round figures such as circles, ellipses, paths with Bézier curves, etc. will instead need several vertices. You can control the tessellation of these figures via the object's properties. In more extreme cases, you can consider saving the generated meshes as an asset via the built-in Save Asset
feature of the VectorizerMeshDebugger
component.