I have a bit-map image:
( However this should work with any arbitrary image )
An approach similar to the one proposed by Ef Dot:
SCNMaterial
per color.SCNGeometryElement
) use the same material. In other words, use one geometry element per material (color).So you will have to build a SCNGeometry
that has N
geometry elements and N
materials where N
is the number of distinct colors in your image.
If you don't feel comfortable with triangulating the polygons yourself your can leverage SCNShape
.
UIBezierPath
and a build a SCNShape
with that.SCNGeometry
Note that some vertices will be duplicated if you use a collection of SCNShape
s to build the geometry. With little effort you can make sure that no two vertices in your final source have the same position. Update the indexes in the geometry elements accordingly.