writing your own roto/tracking software


Hi there,

i am some background in programming and i have become increasingly interested in software development for some time. I am currently working in film vfx but not so much on the technical side. When i was working at Double Negative there was a guy that basically created his own in-house version of ‘Silhouette’ the roto software. But his version was obviously tailor made for our needs and far out performed silhouette in every aspect.

I wanted to do the same, as part of a large ongoing personal project, i want to basically write my own roto/tracking software as a standalone package. Disregarding for a moment the implausibility of my goal, can anyone please enlighten me as to where on earth one begins with such an aim.

I have a fairly decent python background as well as c++. But only within certain packages, Nuke/Maya etc.

Could anyone put into laymans terms where to be looking. How others may have achieved this. Like the guy i mentioned at Double Negative. Any advice is welcome. I just want to get started, even if it takes 10 years ha…



How to write a whole, complete software toolkit from scratch is neigh impossible to give an answer to. That said, no, the concept of writing one isn’t that far fetched if you’re driven and hard working.

Doing it entirely from scratch including the close-to-the-metal components would be a monumental task though, nobody writes like that these days.

I’d say you first need to break it down into feature based milestones.
What do you consider an absolute minimal roto software? Something that can load images, draw splines on it, and export BnW masks from those splines? I would say that’s a good starting point, even if it means the software will be useless it’s an attainable milestone.

Break it down further and you need a basic UI framework, which points you towards learning Qt, an image loader, which you can choose to write from scratch for some specific formats or to use a library for.
A very simple items manager (Qt + internal storage of the splines and their indexing).
And finally basic spline handling, which is probably worth doing from scratch for the learning exercise.

Once you have that working with file load and save you can move on to refining one or more of the components. Say add more properties to the splines to antialias/feather the output, or layer/items management, or both. Maybe a bit more UI work, or richer scene and project data… and so on.

Go by milestones, use libraries to facilitate your work unless a subject is bite sized and worthy of your time to learn/implement from scratch, evolve, discard, start off from scratch with your newly acquired knowledge, rinse&repeat.

It’s, IMO, both possible and a worthy endeavour. Not everyone can take an idea like this past a few weeks, almost nobody past a few months, but that shouldn’t prevent you from trying. If you’re smart with your time and really, really F’ing stubborn, methodical and persistent you will grow immensely as a developer.


thanks alot, thats the spirit!

I understand that i will need that qt thing for the UI stuff. But when it comes down to the nitty gritty code, can i do it all in C++ editor and compiler program. Especially when it comes to heavy stuff like writing a tracker or something. Can it all be done in the same document.

Im a bit clueless about the logistics of where to write it, as ive only been coding through Maya and Nuke so far. I guess i just need something that i can write and then compile and run to see how it looks as a program.



You are phrasing questions and punctuating statements; it’s very confusing :slight_smile:
If you’re asking “can it all be done in C++?”, yes, get visual studio 2013 community on windows, get Qt, get working. VS will have an IDE, the arguably the best and easiest debugger on the planet, and the compiler isn’t half bad these days.
If you’re asking “can it all be under one project?”: Yes, to start things your collection of modules would be very simple, possibly even non-existent and you would just have fairly straight forward and linear structure solving to a single table and flow.
If you’re asking “Can it all be done in one single text file?”: Well, theoretically yes, but I wouldn’t recommend it.

I would also suggest working off a version management system right away. VS community offers a free one with the free account, and also manages git repos egregiously. A free one like github or bitbucket will work just fine with it.

If you never used one though, and are wondering WTF I’m talking about, that might be a bit of a trauma, and a first pass working off VS projects alone saved locally would make it easier to get into the groove for the first few revisions, you can then move to a repo when you’ll do your first scrap and redo.

I have a hunch that you could, before embarking on this, gain A LOT from following some of the “from scratch” series on youTube. They are usually game centric, but might be worth your time.
I have recommended, with great response, this in the past to enthusiastic neophytes in need of structure: https://www.youtube.com/watch?v=XNmmKKsf3P0

Handmade Hero is also pretty awesome, but it’s clean C, and a bit more hard core style mentality. Still worth keeping an eye on:


cool thanks. Yeah that message made perfect sense in my head voice, but i forgot to press the question mark button.

I will check out all this stuff. thanks for the help



Its a good idea, after you got your basic framework established, to use it to prototype the functionality in subprojects… For example: create the spline functionality or the tracker in a separate program first and reimplement the functionality in your main program afterwards.
This not only helps keeping your original code clean. But also helps:

  • to focus on the milestones (As everything jaco said)
  • beeing able to experiment with the various libraries available… *
  • and last but not least, keeps your compile time on a productive (= fun) level.

*As for tracking I would recomend opencv for a starting point, not because of it capabillity itself (wich might be enough), but because its quite well documented, and provides you a pathway to grasp the theories behind it…

but again I really recommend to concentrate on the basic framework (ui / export/import) first. Especially getting used to QT takes a significant amount of time and energy.


This is the best way to learn software development! Nothing will push your learning as the challenges you face when developing a large project, with a well defined functionality, and a complex user interface. Enjoy it!

Besides everything JacO and tischbein3 said, I’d like to add how I manage my own projects:

Organize your solution with at least 3 projects:
Engine: This is the code that implements the functionality. In your case the keying code would be in the engine, it takes as input the before image, the background color, the shapes, the new background, and returns as output the after image.
UnitTest: A console executable that calls the engine directly. You use this project to fine tune and test your engine while developing it, then you add test cases with a known result you can compare to a control result. If you change something in the engine, and the unit test fails, you know you made a mistake right away! The keying test would call your keying code with the images, shapes and background color, and return an image. You save this image in your repository as a control image, and when testing the engine you compare the output images with the control images.
UserInterface: The executable that opens a window. This project has all the windows, viewports and dialogs, and it calls the engine for execution. Here is where the user enters the file names, draws the shapes, defines the colors, and sees the final result.

Revision Control
As JacO said, this is very important. Revision Control not only keeps a backup of your project, it keeps the whole history of changes.
If you don’t want to use an external service you can create repositories in your PC using TortoiseSVN (subversion), TortoiseHg (Mercurial) or TortoiseGit (git). You can also work locally with Perforce.

CMake generates Visual Studio solutions and projects from text documents. With CMake you can have a directory with the source code, and build directories for each ide - platform (Win32, Win64, etc).

Some libraries you might find useful:

Qt: Best user interface framework.
Boost Filesystem: For everything related with file paths.
Boost Threads: For multithreading.
TinyXML: Read and write xml files. Great for loading and saving simple projects.
FreeImage: For reading and writing images.
OpenCV: A computer vision library.


I’m not sure I would recommend Boost to a beginner :slight_smile: Particularly not Threads given C++11 has caught up with the standard library to pretty much 99% of the truly useful stuff.
In general I would say that Boost is something worth staying away for literally as long as possible in a project these days (and I love Boost and can’t be thankful enough to the developers for what they did pre C++11).

Some of the less painful hpp and things like their various macro like statement replacements are nice to have though and are pretty much just an include; I happily make exception for those.

The rest I pretty much agree with.


Yes, true, boost thread is advanced stuff, and std implements almost all of its features.


(Background: I’ve been coding a personal project in C++ for half a year, all back-end data processing and integrating a few external libraries; I haven’t explored how to use any UI packages yet like Qt. In the future I may or may not want to build a user interface for it, but I’d like to start researching.)

I have a question along these lines, so I thought I’d just ask it in this thread… I’ve been considering developing something with a layer based timeline UI element, (and perhaps a node based UI too) but I haven’t seen any high level information about how this would be constructed.

Are there any books or articles about the theory behind how to design and hook up these UI elements to your underlying code? Or would a developer usually need to come up with the concept on his own and build those from scratch? There are a number of softwares with timeline based and node based interfaces, and I’m curious if there is a definitive reference for these that I just haven’t come across yet.