VectorizeImage
by unn47ur411Y
VectorizeImage Plugin for Godot
VectorizeImage is a custom Godot plugin that turns raster textures into triangulated meshes using random distribution and edge detection without segmentation or with segmentation. Perfect for stylized assets or experimental image-based mesh generation.
Note: This plugin is currently only available for local use and not yet published on the Godot Asset Library.
Features
- Supports 3 generation modes:
Random
,Edge
, andSegment
- Adjustable color modes:
Single
(flat color) orBlend
(gradient) - Built-in mesh generation using Godot’s 2D rendering
- Highly configurable dot spacing, thresholds, and resolution scaling
- Regenerate meshes live in the editor
Prerequisites
- Godot Engine 4.1 and later.
Installation
- Copy the plugin folder to your project:
res://addons/VectorizeImagePlugin/
Usage
- Add a
VectorizeImage
node to your scene. - Assign a texture to the Texture Image field.
- Choose a Generation Mode:
Random
: Places dots randomlyEdge
: Places dots along detected edgesSegment
: Places dots along color segment boundaries
- Choose a Color mode:
Single
: Uses center color of triangleBlend
: Averages colors between vertices
- Adjust relevant parameters:
Down Scale Multiplier
: Reduce input resolutionEdge Threshold
,Dot Spacing
,Edge Contrast Threshold
, etc.- NB! Generation Mode Options are split into subcategories based on the selected mode. For example, selecting
Edge
activates parameters under 'Edge' and 'Edge and Segment', likeedge_threshold
,color_contrast_threshold
, anddot_spacing
.
- Enable the Generate checkbox to create the mesh.
Exported Parameters
These are the exported variables available in the VectorizeImage
node and their descriptions:
Variable | Type | Description |
---|---|---|
texture_image |
Texture2D |
Input image. |
down_scale_multiplier |
float |
Reduces the input image resolution before processing. Higher values simplify shapes and improve performance. |
generation_mode |
int |
Selects the algorithm for generating dots and triangulation. Options: Random , Edge , Segment . |
color |
int |
Controls how color is applied. Single uses one color from the center of the triangle, Blend averages between vertices. |
random_spacing |
int |
Controls the approximate distance between randomly placed dots. Lower values result in more dots. |
edge_threshold |
float |
Minimum value to consider a pixel an edge. Higher values result in narrower edges. |
segment_threshold |
float |
Minimum value to consider a pixel an edge (used in segmentation). |
color_contrast_threshold |
float |
Minimum difference between colors to detect a transition between colors. |
dot_spacing |
int |
Controls how frequently dots are placed in non-edge areas. Lower values increase edge dot density. |
Generate |
bool |
Generates and displays a triangulated mesh from the dot pattern based on the selected algorithm and parameters. |
Recommended Variables
How variables affect processing time:
- Increasing
down_scale_multiplier
reduces processing time. - Increasing
random_spacing
reduces processing time. - Increasing
edge_threshold
reduces processing time. - Increasing
segment_threshold
significantly reduces processing time. - Decreasing
color_contrast_threshold
reduces processing time. - Increasing
dot_spacing
reduces processing time.
Note:
These recommendations describe how changing the variables can increase or decrease processing time.
It does not mean that higher or lower values cannot be chosen — it only affects the performance characteristics.
Recommendations based on generation mode:
-
Random Generation Mode:
Withrandom_spacing
set to2
, it is recommended to keep the texture size under 512×512 using thedown_scale_multiplier
. -
Edge Generation Mode:
Withedge_threshold
set to0.5
,color_contrast_threshold
set to1
, anddot_spacing
set to10
, it is recommended to keep the texture size under 256×256 using thedown_scale_multiplier
. -
Segment Generation Mode:
Withsegment_threshold
set to0.5
,color_contrast_threshold
set to1
, anddot_spacing
set to10
, it is recommended to keep the texture size under 128×128 using thedown_scale_multiplier
.
Feedback
Feel free to submit suggestions, issues, or feature requests via GitHub Issues.
Download
Support
If you need help or have questions about this plugin, please contact the author.
Contact Author