Rainbow Point Cloud
This example shows how to create intricate point clouds using jit.geom
that can then be used in a jit.gl.mesh
based rendering setup.
The Patch
Open the patch geom-to-pointcloud.maxpat.
The patcher to achieve this does the following steps.
- Generates a base shape using
jit.geom.shape
. - Distributes a random number of points on it using
jit.geom.distribute
. - Places many small shapes one the base shape using the points from the previous step with
jit.geom.multiple
. - It then deforms the resulting geometry using a couple of chained
jit.geom.twist
. - Finally, it uses another
jit.geom.distribute
to generate the visible point cloud. - Lastly,
jit.geom.tomatrix
is used so that the point cloud can be turned into ajit.gl.mesh
.
You will notice that there is one subpatcher called [p GenerateRotationAndScale]
. It is a simple helper to generate random rotation and scale values for the small shapes we want to place using jit.geom.multiple
.
Results
When playing around with the different settings that are exposed in the patch you can achieve a satisfying variety of point arrangements conveying different motion and texture.
To add animation you could use a custom vertex shader on the resulting jit.gl.mesh
to modulate the point cloud. I will leave this as an excercise for the reader.