Recently I was looking for a solution for drawing curves with a wacom, and retain the pressure data and curves so that it can be procedurally animated after it has been drawn. I was trying to find ways to recreate/trace consteallation drawings from the 1661 book Uranometria (http://skytonight.org/Bayer-1661)
The goal was to get clean curves that could be procedurally animated after they had been drawn, and also to get an image that is not obscured by the stars that you can see in the above snap.
I was trying to use inkscape, which is great for drawing with but I had no idea how I could get any data out of it, and it seemed to make solid shapes instead of curves (when trying to use a tapering pen)
Houdini has the 'stroke' SOP which works well with the wacom, capturing pressure data and working out of the box. However on my machine I was having a problem where any hiccups in performance would also cause an interruption in the data that was captured ... as you can see in this screenshot, drawing a fast circle sometimes results in large gaps in the shape:
After some googling around for some other ways to get good data out of a wacom, I found that Qt supports tablets, and I could use the Python Panel in Hoduini in order to use Qt to draw with the wacom -- so I ended up making a panel that can be drawn in. It seems that regardless of Houdini's performance, Qt will still capture all of the data from the wacom, and any loss of performance will only affect the display and not the data....
In the python panel, a circle drawn with roughly the same speed as I did in the stroke SOP above, I end up with much more consistent data, even if something cooks and Houdini stutters around a bit, the input data doesn't seem to be interrupted.
The parts are:
- The python panel, which has some buttons and sliders for controls and a drawing widget that captures and displays the stokes.
- a SOPs node that takes a string of all of the stroke data.
- a setting on the panel for which SOP is being worked on.
When a sop is selected from the drop down on the panel, the data is loaded from a string parm on the SOP, and can be added to. If a SOP is selected in the network view, the panel will change to show the curves from that SOP.
The units in the panel are pixels, so it is also pixels when it is read into SOPs. Zero is at the cross in the centre of the python panel.
A background image can be loaded into the panel, which is always centred and 1:1 for pixel size. The path to the image is saved on a parm in the SOP, so I can have different reference images for different nodes (and teh path to the reference image is saved)
The panel also has panning and zooming, which SEEMS like a simple feature but it was a bit of a pain :)
There are a few other features to make workflow easier too, like a "duplicate" button, which just duplicates the current SOP and starts editing it. The "dup and clear" button is the same as pressing duplicate and clear and makes the workflow quite a bit faster.
There are a few things that the panel does to keep the stroke that I am drawing updating quickly, it:
- only shows that last 10 strokes when you are drawing, as with 100s of strokes the widget gets quite slow to update.
- only sends data from the widget to the SOP when the pen is lifted from the tablet, as generally I don't look at the scene view when drawing.
For the Uranometria drawings, there are some specific things in them that I wanted to be able to trace easily. The first is smooth outlines or very straight lines -- I wanted a way to define a curve using breakpoints instead of trying to freehand it:
There is a setting on the SOP called "Curves as Breakpoints", which will interpret each curve (just a tap with the wacom) as a breakpoint in a curve. It adds handles to ensure the created curve passes through the breakpoints, and converts it to a bezier curve. Super useful for the very smooth lines! The only downside to this is that you have to have a node for every curve you want to draw -- which is why the "dup and clear" button is useful... as it makes it a lot quicker to start a new curve.
The other feature that is common in the Uranometria drawings is very regular lines for the shading. I added a setting to the SOP node to add new lines at regular spacing between all drawn lines:
Making it much quicker to add a lot of the shading detail. The SOP also adds a bit of noise (had to be some in there somewhere)
In the drawings the outlines are very often just made from regulary spaced dots, so the duplication tool is useful for those too!
The problem with this mode is also that you have to have a node for every section of hatching to create.
I have tried a few practice drawings to test out the tools, and I do end up with way too many nodes:
Oh also. .... the 'undo' button, doesn't really undo, but just deletes the last drawn line. Also there is no way to edit what has already been drawn -- so it is good to have the drawing split into many nodes.
It would probably be better to have all of the curves on one node, but I also don't want a massive multi-parm on one node..... we will see!
Next I am going to try getting the procedural animation working, to make sure there is nothing else I need in the tools first.
Here is a timelapse of tracing one of the more simple constellations, which shows the curve tool and the duplication tool:
The python panel and the OTL can be downloaded here
Beware that these files were made with an Indie licence!