Kolam Animator

john's Avatar

john

14 Jun, 2021 08:28 AM

I am pleased to present the Kolam Animator, made in collaboration with Mr. Ramanraj Krishnaraju of Chennai, India.

Kolam is an ancient form of traditional decorative art often made by drawing lines made of chalk or rice flour around a series of dots. For more see: https://en.wikipedia.org/wiki/Kolam

You can easily find thousands of beautiful kolam designs on the web, but to truly appreciate the meditative experience of kolam you need to see the lines form as they would be drawn. NodeBox is ideal for this type of animation, but doing it from scratch for each design would be tiresome. What is needed is a way to make the animations data driven by means of a simple CSV. This is what Ramanraj and I set out to do.

Ramanraj developed a way to create symmetrical kolam designs using an iPad app called DrawinDots. For each gesture he chooses a tool (dot, line, quadratic, bezier, or ellipse) and taps a few positions on a simplified grid. (See below for an example of a grid.). For our CSV we simply record these tool choices and coordinates in a fixed order.

The CSV has three columns: Step, Tool, and Coordinates. Step is simply a step number. You can insert fractional values if you miss a step, but the steps must be in sequential order.

The tool and coordinates columns are one of the following:

  • Dot (x,y) for location of each dot
  • Line (x,y)(x,y) for start and end. Lines may be omitted if the gestures before and after are connected.
  • Quadratic (x,y)(x,y)(x,y) for start, end, and control point
  • Bezier (x,y)(x,y)(x,y)(x,y) for start, C1, C2, and end (drawn in counter-clockwise direction)
  • BezierCW (x,y)(x,y)(x,y)(x,y) for start, C1, C2, and end (drawn in clockwise direction)
  • Break (no coordinates) to break a stream of gestures into separate paths
  • Circle (x,y)(d) where (x,y) is the location of the circle and (d) is the diameter in standard units. A break is implied before and after each circle

To create an animation, simply set the CSV node at the top of the NodeBox network and export movie. I have made it easy to make additional adjustments by placing five nodes on the left toward the bottom:

  • movie_length. Sets animation movie length in frames at 25 frames per second. The default is 400 (16 seconds). When making a looping movie I like to add an additional fifty frames to movie length (e.g. 0 to 450) to provide a two second pause after each cycle so viewers can appreciate the final design.
  • consecutive. If checked, paths will be drawn consecutively. If unchecked, paths will be drawn simultaneously. If there is only one path, this setting is ignored. When multiple paths are drawn simultaneously, each path requires the entire animation length to complete. This means that short paths will be drawn more slowly than long paths and you may want to reduce the overall movie length.
  • stroke_width. The stroke width of kolam path. The default is 6; increase to make it thicker, decrease to make it thinner.
  • magnification. The final magnification of kolam. The default is 100% based on a grid of 50 pixels per unit. Increase or decrease to make the kolam fit comfortably within the canvas. Current canvas is 600 x 600, but this is easy to modify if you want larger images.
  • title. An optional title that can be superimposed over the movie. Adjust font, alignment, position, and size in the usual way. Leave text blank if no title is desired.

You can of course make other adjustments anywhere in the network to change dot size, colors (including background color), or other changes.

The screenshot shows a typical kolam in its final form at the end of the movie. I have also attached a movie of this kolam (which uses almost all the possible tools). The zip file includes the CSV file for this kolam as well as a second kolam CSV for comparison. For this second kolam I also include a PNG of the chart Ramanraj used to record that design. I also include a blank grid which you can use to find the necessary coordinates. Either print and draw a kolam or resize and superimpose a kolam image over the grid.

I have been interested in kolam for years. I hope this NodeBox network will make it possible to produce many new animations to introduce this art form to a wider audience and deepen the appreciation of each design.

All kolam included here and produced during development are by Ramanraj Krishnaraju. You can see hundreds of his beautiful kolam (including some recent animations made with this program) on his kolam Instagram site, Mech_Kolar:

https://www.instagram.com/mech_kolar/

Comments welcome!

John

  1. 1 Posted by Ramanraj K on 14 Jun, 2021 12:37 PM

    Ramanraj K's Avatar

    Dear John,

    Congratulations! Thank you so much for developing a very sophisticated Kolam network code in just two weeks with all the bells and whistles for drawing a wide variety of Kolams. Kolam Animator will surely revitalise the Art of Kolam and bring it back to the fore worldwide.

    A special thanks to you for introducing NodeBox 3 to me - its so awesome. I have been using it for only two weeks now, but will go far and say that it heralds a major paradigm shift from the POSIX doctrine where "everything is a file" to not necessarily "everything is geometry" but, "everything is text and geometry" to pave way for more light based computing.

    The Kolam is a morning ritual and a good number of people would connect with it instantly. I hope this collaboration helps in promoting geometry in the minds of the very young. The ui we use on mobiles and devices ought to provide a graphic design interface by default like we take text input keyboards for granted today. The work here is certainly an important step in that direction.

    Warm Regards,
    Ramanraj K

  2. 2 Posted by Ramanraj K on 14 Jun, 2021 05:23 PM

    Ramanraj K's Avatar

    New animations just created with John's Kolam Animator. A very quick how it was done: the kolam was drawn on a grid as shown in kolam-sikku-5-5.png. The coordinates were written to kolam-sikku-5-5.csv and imported into Kolam Animator. From File > Export Movie, kolam-sikku-5-5.mp4 was made, and the kolam-sikku-5-5-simult.mp4 was made with consecutive node unchecked.

    Enjoy!

    Have fun !!

  3. 3 Posted by Ramanraj K on 15 Jun, 2021 12:59 PM

    Ramanraj K's Avatar

    Nice long unusual Bezier curves make this Kolam.

    Btw, "Export Movie" does not save mp4 file to destination on Gnu/Linux systems, and the work around is to "Export Range" as png files and make a movie from them using ffmpeg or other tools:

    # cat *.png | ffmpeg -f image2pipe -r 24 -vcodec png -i - -vcodec libx264 kolam.mp4

  4. 4 Posted by Ramanraj K on 16 Jun, 2021 03:44 PM

    Ramanraj K's Avatar

    Lakshmi kolam in exactly 80 steps – 40 dots in all, with 5 each radially in the cardinal and inter-cardinal directions, and 40 quadratic curves connecting the dots in an Eulerian circuit, with each vertex having exactly two edges.

    The formula traditionally used to draw is given as “1-3-5-2-4-1”, dots in each direction numbered 1 to 5, from outside to inside. One may start anywhere, but while proceeding clockwise, the number rule is followed. So if one starts with dot 5 in the North, then connect with dot 3 Northeast, 5 in East and so on to complete the circuit.

    Goddess Lakshmi is associated with the eight preternatrual powers – ashtamasiddhi that are in this order: anima > laghima > maghima >garima > prapthi > prakamyam > isitvam > vasitvam and the Kolam is seen as central to attainment through contemplation – pure thought to manifestation of the desire through work.

    A better version would certainly be welcome, with more perfect quadratic curves in the edges that may go to the very root of all matter.

  5. 5 Posted by Ramanraj K on 17 Jun, 2021 04:09 AM

    Ramanraj K's Avatar

    A revised Maha Lakhmi Kolam. It would be interesting to extent the Eulerian path in three dimensional space, where the cycle may go on and on in a loop.

    This may also relate to Kaprekar's Constant 6174 for four digit numbers and Mega Constants 97508421 and 63317664 for eight digit numbers - a note this is at https://calpp.org/nDspace/6174_v2.php

    This is significant from a geometric point of view taking into view the rearrangement, reflection and subtraction repeated until a final result is obtained. The output for eight digit numbers that does not terminate in a step or two appear to go on like a beam of light. .. its relatable to physical properties like imaginary lines of force in magnetism. Two positive and negative forces that come in contact in this fashion would be forced to remain in that state forever and ever. The mathematics here is very straight forward and gives a very good basis for infinite attraction that defies logic."

  6. 6 Posted by Ramanraj K on 18 Jun, 2021 03:00 AM

    Ramanraj K's Avatar

    The Maha Durga Kolam that is much like the Maha Lakhsmi Kolam posted yesterday, except that the path taken is "1-5-4-3-2-1". Gnu/Linux os users may have one more issue - the mp4 files created with ffmpeg do not appear to render correctly on Instagram. To fix this, open the mp4 in Shotcut Video Editor (at https://shotcut.org/ ) or others and export - this creates a slightly bloated file but works everywhere.

  7. 7 Posted by Ramanraj K on 19 Jun, 2021 04:03 AM

    Ramanraj K's Avatar

    A brief step by step note on how to make kolam animations for those completely new to NodeBox 3:

    First visit https://www.nodebox.net/node/documentation/tutorial/getting-started.html and do all the actions listed on this page. Then,

    1. Draw a kolam on a grid with coordinates and keep it ready for reference. If doing this with digital tools, save it as, for example, kolam.png. Sample coordinates of commonly used shapes is attached for reference.

    2. Enter the coordinates of the dots in the kolam into a kolam.csv file.

    3. Open NodeBox 3, go to “File” > “Open ...” to load John Cartan’s Kolam Animator.

    4. Click on “import_csv”, to load the kolam.csv file that has the dot coordinates. Play the animation to see the dots on the screen. If any of the dots are not correctly displayed or if any dots have been missed, correct the csv file and save it. Now click “Rewind” and again hit “Play”. The corrected pattern would be displayed on NodeBox. Let play be on to see the frame counter progressing next to it.

    5. Now, enter the first Line, Bezier or Quadratic coordinates of the first kolam move in the csv. Save the csv file in the text editor and check on the NodeBox screen Viewer if the move is correctly displayed. This is best done line by line to weed out errors at the outset, much like one would have done coding on ZX Sinclair Spectrum, BBC Micro or other devices to write Basic programs interpreted as lines get written.

    6. Go forward and enter the next kolam move only after step 5 has been done correctly and seen to be visibly right on the NodeBox screen Viewer.

    7. After the whole kolam is done, export movie from the File menu on NodeBox.

    Please not that it may be far too hard to first write the whole csv then load it into NodeBox for rendering.

    Hope this helps to get started with John Cartan's Kolam Animator. Have fun!

  8. 8 Posted by Ramanraj K on 23 Jun, 2021 01:36 AM

    Ramanraj K's Avatar

    A brief animation how to for kolam artists totally new to NodeBox 3. Drawing a kolam is one thing, and planning its drawing ("execution" for animation) is quite another. This is where algorithms for Eulerian paths come handy. The well written page at https://www.geeksforgeeks.org/fleurys-algorithm-for-printing-eulerian-path/ is a handy guide for drawing sikku kolams and animations.

    Most sikku kolams are Eulerian paths - one may start anywhere and finish without break or taking hands off the paper or ground. But, if the kolam includes vertices with odd edges, then, the vertices with odd edges need to be paired, and one necessarily must start from an odd vertex and finish at another odd vertex sequentially, as many times as the pairings.

    The kolam for the day is a slightly unusual sikku with deliberately introduced vertices having three edges for demo purposes. The simultaneous render is followed by the consecutive render here.

    Examining this property led to the Mech-Cartan Theorem “Every pair of vertices having an odd degree add a path to a connected graph and the Eulerian trail is equal to the sum of such paths”. Thanks are always due to John Cartan for the tremendous amount of work and effort on his part to make these beautiful animations possible.

    Ref:

    https://en.wikipedia.org/wiki/Eulerian_path

    https://www.geeksforgeeks.org/fleurys-algorithm-for-printing-eulerian-path/

  9. 9 Posted by Ramanraj K on 27 Jun, 2021 01:32 AM

    Ramanraj K's Avatar

    I added a new node “copy” to John Cartan’s Kolam Animator at the “combine” threshold, to create drawings that emulate kolams drawn with two or more lines (double line or multi line) usually done with fingers on the go. The zip file attached has the ndbx file and csv file used along with sample drawings generated with various parameters. Have fun!

  10. Support Staff 10 Posted by john on 27 Jun, 2021 03:28 AM

    john's Avatar

    Nice!

    By fiddling with the settings on the copy node you can generate endless kaleidoscopic effects.

  11. 11 Posted by Ramanraj K on 29 Jun, 2021 12:55 PM

    Ramanraj K's Avatar

    John, Thanks! Some more kaleidoscopic drawings generated with Kolam Animator using the swastika pattern. The zip file attached has ndbx files and csv file used along with few sample drawings generated. Have fun!

  12. 12 Posted by Ramanraj K on 18 Jan, 2022 01:38 AM

    Ramanraj K's Avatar

    Kolanimator is John's Kolam Animator published as a sub-network. This allows combining two or more csv files to generate new art. One may copy and paste as many kolanimator nodes as need be to run many different kolam patterns in tandem and create new “art”.
    As always, many, many thanks to John for all the amazing nodebox networks created and posted here.
    Have fun.

  13. Support Staff 13 Posted by john on 18 Jan, 2022 03:03 AM

    john's Avatar

    Thanks, Ramanraj, for packaging my network as a single subnetwork with lots of parameters. As you say, this makes it even easier to create finished PNGs and combine multiple kolam into a larger piece of art - maybe even a gigantic kolam mural!

    I encourage everyone to check out Ramanraj's Instagram feed at:

    https://www.instagram.com/mech_kolar/

    He has been cranking out scores of great kolam, pushing the limits to achieve new effects. I look forward to seeing what he will do with this "Kolanimator"!

    John

  14. 14 Posted by Rakshith R on 29 Sep, 2024 02:34 AM

    Rakshith R's Avatar

    Hello,

    Is there a way to utilise the GPU so the video export time can be decreased.
    I am using NodeBox 3.0.53(which is the latest release).

    Thanks

  15. Support Staff 15 Posted by john on 29 Sep, 2024 07:57 AM

    john's Avatar

    Rakshith,

    I wish there was.

    I think it's fair to say that Nodebox was not originally designed for speed. It was designed to make generative art easier for artists.

    In theory, a functional list processing language like Nodebox could be faster than it is. It is inherently parallel and multi-threaded by its very nature and is elegantly simple. It was build in a time before modern GPUs, so my hunch is it could be rewritten to run much faster if optimized for GPUs.

    Although NodeBox is no longer being actively developed, it is open source, and there is nothing in theory to stop someone from forking the code and rewriting it. If you know anyone with the chops (and interest) to take on this challenge, please pass along your request.

    MEANWHILE, there is one small thing I can do.

    Attached is Kolaminator 1.1. I made only a single change to file Ramanraj posted back in 2022. I updated my subpath node, deep inside it, to the newer version. It should work exactly the same but run maybe 20% faster.

    Please someone give it a try. Time a render using the current kolaminator, then try it again using this newer version, and let me know what kind of render speed improvement you see.

    John

  16. 16 Posted by Ramanraj K on 29 Sep, 2024 09:30 AM

    Ramanraj K's Avatar

    John,

    Nice - does appear to render faster. Though, one issue I just noticed
    with the new version kolanimator_1.1 is that magnification does not
    magnify as expected.

    Warm regards,

    Ramanraj K

  17. Support Staff 17 Posted by john on 29 Sep, 2024 09:42 AM

    john's Avatar

    Ramanraj,

    That's odd, since I literally only made that one change. Are you saying that 1.1 magnifies something differently than 1.0 does?

    Could you please say precisely what you mean by "magnify as expected" and provide a code and csv sample that would allow me to compare the two versions and document a measurable difference?

    Thanks!

    John

  18. 18 Posted by Ramanraj K on 29 Sep, 2024 10:23 AM

    Ramanraj K's Avatar

    John,

    I was quite surprised myself! Anyway, Ive attached the NDBX file with
    both versions for your reference. The new version doesnt seem to
    magnify at all, just to clarify.

    Additionally, I timed the render process for both versions using the
    0928-skanda-n32.csv file, which contains about 160 lines/steps. Both
    versions took the same 50 seconds to render on my system. Ive attached
    the CSV file for your reference as well.

    Let me know if you need anything else!

    Thanks and warm regards,

    Ramanraj K

    On 29/09/24 3:12 pm, john wrote:

  19. 19 Posted by Rakshith R on 29 Sep, 2024 12:01 PM

    Rakshith R's Avatar

    John,

    Disclaimer: I’m just a noob developer tinkering with things I barely understand, but here we go! Also, I’m not sure if all the content in this reply belongs in this thread or another one, so please excuse me :)

    Thanks for the swift reply. I have already cloned NodeBox3 and have been going through the codebase to see how I can tweak it for better performance. I've also been looking into the NodeBox-OpenGL version, which hasn't been actively developed for the past three years. The last release of NodeBox-OpenGL is built on Python 2.6+. I studied the minimum API required to recreate the awesome Kolanimator, and I was able to get some good results. I managed to squeeze out every ounce of power from my dusty GPU, but the resolution of the output from NodeBox-OpenGL isn’t that great—maybe I’m missing some flags to render it properly.

    By the way, I’m using ffmpeg to render the output frames from NodeBox-OpenGL.

    Now, I’m kind of torn between two directions: whether to focus on finding a plan to integrate GPU support into NodeBox3 or update NodeBox-OpenGL to Python 3.11+ (which, I’m hoping, will be easier). Why Python 3.11+? Because it’s the latest version, and it would make building a GUI—perhaps using PyQt—much easier, similar to how NodeBox3 (the Java variant) works.

    Thanks
    Rakshith R

  20. Support Staff 20 Posted by john on 29 Sep, 2024 09:38 PM

    john's Avatar

    Ramanraj,

    For some reason your original note went to the spam folder - I wish I could figure out why it does this! Thanks for resending to my email. (I restored your original note above.)

    I looked at your test file. The reason kolaminator 1.1 (the kolanimator node in your test file) was not magnifying was that, apparently, you opened it up and accidentally rendered the colorize3 node, which is upstream from the final combine4 node. So the kolanimator node fires before it even gets to the magnification code below that point.

    I double-checked the file I posted above and it was correct. So if you use the node as I sent it, it magnifies just fine.

    In your test file you compare kolanimator 1.1 to the old version, which in your file is called kolanimator1. But that seems to be a different version. It has only 8 ports instead of 11, the ports have different names and are in a different order, it doesn't create a background fill color, etc.

    When doing time testing it's important to compare versions which differ by only the one variable in question. You were comparing apples to oranges.

    Nevertheless, when I redid your test comparing to versions which only differed by that one variable, I found that indeed kolanimator 1.1 was not significantly faster for the longer skanda-n32 CSV file. This may be because this particular design has no curves, only straight line segments.

    The updated version of subpath I used in kolanimator 1.1 only runs faster on paths that include curves. The file you shipped with your original kolanimator, Vyuha Lakshmi Sikku 5-5, is nothing but curves. So that probably explains the difference in our results.

    Please feel free to run more tests and report back. So far it looks like kolanimator 1.1 works fine, but only runs faster on designs with lots of curves.

    John

  21. Support Staff 21 Posted by john on 29 Sep, 2024 09:47 PM

    john's Avatar

    Rakshith,

    It is exciting to hear that you are even considering a fork to NodeBox. That would certainly be an interesting project! It could be the most exciting thing that has happened around here in ages.

    I have never used NodeBox-OpenGL and know little about it. I can well believe it would be simpler to use that as your base and develop a new GUI from scratch.

    But my only selfish desire would be to see a new version of Nodebox 3 that was fully compatible with all Nodebox 3 projects written to date, on both the Mac and PC.

    In a perfect world I would like to see a version which looks and behaves exactly the same as our current version, but runs faster. Once I was convinced I could fully trust it, I would then happily switch to that version and start begging you to start on my long list of UI improvements and feature requests.

    Whatever you decide to do, please keep us posted!

  22. 22 Posted by Rakshith R on 30 Sep, 2024 02:37 AM

    Rakshith R's Avatar

    John,

    Nodebox3 it is then. I’ve also found a way to achieve our goal in Java as well.

    Additionally, I just wanted to update you on my tests on new version which I forgot to mention in my previous post: I timed the both the versions.
    I kept the settings as follows: canvas size 600x600, movie length 1000, magnification 100, and the background color was the same, except not white. I tested both on the default CSV file available in the zip, i.e., Vyuha Lakshmi Sikku 5-5. It turns out the new version(1.1) is about 26-27% more efficient in terms of completion time.

    Thanks
    Rakshith R

  23. 23 Posted by Ramanraj K on 30 Sep, 2024 02:37 AM

    Ramanraj K's Avatar

    John,

    Thanks for your detailed note. I just profiled your new kolanimator 1.1
    using brahma.csv that has about 218 lines/steps with plenty of Bezier
    curves. The new version is more than 50% faster! The old version took
    130 seconds to generate 50 frames and the new version took just 50
    seconds to generate the same 50 frames (61.53% faster to be exact)!
    Congratulations and of course, curtain call with thunderous applause for
    the new update!!

    Your note also counts as the first line of a longer "how kolanimator
    works" :)

    Warm regards,

    Ramanraj K

    On 30/09/24 3:08 am, john wrote:

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • kolam_screenshot.png 533 KB
  • lakshmi.mp4 123 KB
  • kolam-sikku-7-1.png 118 KB
  • Kolam_Animator.zip 168 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

26 Jan, 2025 02:09 AM
24 Jan, 2025 07:50 AM
22 Jan, 2025 11:42 PM
21 Jan, 2025 09:43 AM
21 Jan, 2025 09:41 AM

 

21 Jan, 2025 09:36 AM
21 Jan, 2025 02:00 AM
16 Jan, 2025 08:30 PM
15 Jan, 2025 06:37 AM
04 Jan, 2025 04:09 AM
03 Jan, 2025 05:32 PM