Wednesday, July 23, 2014

Nuke get(channels=0xf) but request(channels=0x7) error

I'm doing some paint fix work and Nuke is getting pretty annoying with its get(channels=0xf) but request(channels=0x7) error. It randomly throws it on different nodes and while in viewer everything renders correctly, Write nodes crash with an error.

At first I searched the forums and Nuke release notes but found nothing very useful except the discussion about motion vector channels in The Foundry Nuke user forum. First suggestion was to copy all nodes to clean project, but this didn't help me. Another suggestion was to remove motion vectors related stuff so I turned m-vectors off on all ScanlineRender nodes. It didn't solve the problem, so I started testing different things. After some fumbling I removed all other channels except RGBA from all pipes that come from renderers and it seems that this removed the error, at least for now!

So if you get these cryptic get(channels= ....) errors, try removing all channels that are not used, especially the motionvector channels, this might fix the problem.

A little teaser also:


Monday, July 21, 2014

SanDisk Extreme PRO 240GB SSD

Bought new SSD drive to act as a cache & in-production project files drive. First impressions are that performance is pretty solid with both read and write speeds noticeably higher than 500 MB/s with all file sizes. Let's see how it performs as a cache disk for Nuke and AE.

Thursday, July 17, 2014

12 bit TIFF files in Nuke

Opened up a sequence one day and it looked very strange with false colors and some width lost. Found out that Nuke does not support 12-bit TIFF files:


At first I thought there was an issue with color encoding and tried some different stuff but as image was thinner it occurred that there was something else going on. Metadata viewer told that image has 12 bits per channel, but Nuke's tiffReader thinks it is 16-bit tiff and reads accross channel borders in byte array. This is why 1/4 of width was lost. Images originate from DVS Clipster DI soft, so they are not so rare probably.

I searched the internet for solution and made a support query to Foundry. Comes out that 12-bit tiffs are not supported yet, but the good part is that they turned it into feature request so we may see it implemented in future releases.

My workaround was to convert the sequences in AfterEffects, but as I used the "jump to Nuke" discount program with my AE serial code it is somewhat ironic.


Tuesday, July 8, 2014

Convert checkerboard lens grid to SynthEyes dot pattern

This quick tutorial is based on a question from SynthEyes user forum topic Using traditional checkerboard grids, not 'calibrated' grid. How to use the checker lens grids with SynthEyes lens calibration scripts that expect a certain dot pattern? Solution is rather easy and can be replicated in almost any compositing software.

As a starting point we have a checkerboard lens grid shot with our camera and lens of interest. It looks something like this:


Trying to use SynthEyes lens grid scripts on this one (Shot > Create Lens Grid Trackers) produces a funky, but unusable result:


So what can we do instead of manually positioning all the trackers for SynthEyes to crunch on? Solution is rather easy and is based on filtering techniques, specifically convolution matrices that "search" for the areas with contrasting corners.

In Nuke, the overall node setup looks like this:


We'll speak about the top and bottom nodes in a second, lets first concentrate on the four Matrix nodes and following Merge nodes first. The purpose of Matrix nodes is to introduce custom convolution matrices that have special negative lobes and thus have greater resulting values in pixels that are at the tips of high contrast corners. We need different matrix sets because the corners can be oriented different ways and with four matrices that mirror each other we get all possible situations covered.

Matrix nodes have following values:


As you can see, they are essentially the same values mirrored horizontally and vertically.

EDIT: you get more accurate results with bigger matrix that has even number of rows and columns. Bigger matrix is also not so sensitive to grid rotation. Use something like this:



Merge nodes that follow Matrix nodes are set to max operation and they take the maximum pixel values from all matrices and make up the final convoluted pattern.

Blur, Grade and Invert nodes that follow the merges are meant for making the dots a bit bigger and make them stand out more. Grade node scales and clips pixel values so that we get maximum contrast between dots and background:



Invert node inverts the resulting image so that we get black dots on white background:



This image works fine in SynthEyes and we can calculate our get our lens model. Initial tracker layout:



Solved lens:



If convolution does not give expected result, try blurring the checker image slightly. Blurring can help remove unnecessary detail and convolution still accurately finds the checker pattern corners from blurred image. Also, if image has low contrast, try grading it to increase contrast and remove problems with uneven lighting. 

With extreme distortion this method might not work because it relies on strict convolution based on horizontal and vertical lines. The more rotated the pattern (near corners), the less bright the dots will be!

That's it, hope that this all makes sense and is useful for somebody. If you catch an error or have ideas or comments related to this technique, please write a comment below post or in forum topic linked at the top.


Saturday, December 28, 2013

QtCreator and linking minGW .a libraries

Started with my coding side project again and messed with the linking of .a shared library files. These "archive" files are the same thing as Visual C++ .lib files, but QtCreator does not like them and so they must be manually linked. Lib files can be added through dialog.

First step that I failed to do (really basic mistake :)) is to export the functions in dll in the first place. Otherwise one can link to libraries forever and still get unresolved errors. To export functions or classes in Qt Creator library project, simply add Q_DECL_EXPORT to function or class declaration in header. For example: int Q_DECL_EXPORT mult(int a, int b);

Next thing is to figure out, how to add .a libraries to .pro file so that they link. I found it out with a round trip as I tried to generate .lib based on existing .dll. This is actually really simple and involves a few steps (tips from page http://adrianhenke.wordpress.com/2008/12/05/create-lib-file-from-dll/):
  • open Visual C++ command prompt: Start -> Microsoft Visual Studio 2010 -> Visual Studio Command Promt;
  • type command: dumpbin /exports C:\yourpath\yourlib.dll
  • this dumpbin command actually gave me a sign that my functions are not exported as they were not listed in output
  • copy the names from this section:
ordinal hint RVA      name

1    0 00017770 jcopy_block_row
2    1 00017710 jcopy_sample_rows
3    2 000176C0 jdiv_round_up
4    3 000156D0 jinit_1pass_quantizer
5    4 00016D90 jinit_2pass_quantizer
6    5 00005750 jinit_c_coef_controller
...etc
  • paste names into a text file with .def extension and add EXPORTS as the first line:
EXPORTS
jcopy_block_row
jcopy_sample_rows
jdiv_round_up
jinit_1pass_quantizer
jinit_2pass_quantizer
jinit_c_coef_controller
  • run command: lib /def:C:\mypath\mylib.def /OUT:C:\mypath\mylib.lib
  • copy lib file to include directory and add it using Qt library adding dialog: right click in .pro file and "Add Library...
The added command block can also understand .a files so you don't actually need to create .lib files. It looks like this:

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/include/ \
    -lsimplemaths
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/include/ \
    -lsimplemaths
else:unix: LIBS += -L$$PWD/include/ -lgraphclasses -lsimplemaths
INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD/include

The -l addition in the beginning replaces the "lib" part in library file name, so "libsimplemaths" becomes "-lsimplemaths".

Basically this is it but it took me some hours to find out why my simple dll does not link. Tried VC++ dll's and lib's also but there are other problems with compiler differences and they don't work with minGW.


Tuesday, November 26, 2013

Running Synology DSM on virtual machine

This post will be about running modified Synology Diskstation Manager on a virtual machine and thus emulating a NAS that can be accessed through web and managed like an ordinary Synology device. The modified version of DSM is called XPenology and it can be found at xpenology.org It can take some fiddling to get it to work (took me a few hours) so I better make a post about it before I forget :)

Primary steps involved are:
1. Creating a new virtual machine using Oracle VirtualBox
2. Booting the VM with disk image that comes with XPenology download
3. Accessing virtual diskstation and installing modified DSM on it
4. Everything works... or not

Creating a new virtual machine

First step in creating a virtual NAS is to create a new virtual machine that can run Synology software. Diskstations run on 64-bit Linux OS, so virtual machine must also be set up as a Linux machine. I used Debian 64-bit, but others could also work.

There are two main things to set up for VM and host computer: boot disk image and network adapter settings. VM boot device must be an existing IDE device that points to disk image downloaded from XPenology forums. Network adapter must be first set up un host computer by creating a bridge between Oracle VirtualBox Network and Local Area Connection. Select both of them in the list of networks, right click and select Add Bridge (or something similar). In VM settings, navigate to network settings and select Birdged Adapter as network adapter. Name should be the name of the bridge and under advanced settings, set MAC address to either 00113208D63C or 00223208D63C. First one is suggested in different forums, but it didn't work for me (more on that later).

When network settings and boot image are all set, start the VM. It should boot up and end up showing "Diskstation login:"

Installing modified DSM on VM

Start up Synology Assistant and search the network for Diskstations. If all goes well the VM will show up as DS3612xs device. Right click on it and select "Install". Point to the downloaded modified version of DSM, fill necessary fields and start the install.

To be continued...

Monday, November 4, 2013

Nuke 7 plugin development

Today I started setting up the dev environment for Nuke 7 plugin development. As I bumped on some small obstacles, I thought I'd better make a post about it.

Nuke 7 plugins should be compiled with Visual C++ 2010 and if you have 64-but OS then against 64-bit libraries. The thing that gave me a little headache was the 64-bit environment. Nuke installation contains an example project that you can load and that should ideally build without problems. But problems I got...

First problem was in VC++ with setting additional dependencies. Nuke plugins need header files and .lib static libraries from Nuke program folder that must be manually added. For some reason VC++ did not want to show me the project properties dialog. After some messing around I found out this was because I didn't have x64 environment set up and so VC++ did not understand the project settings.

To set up the x64 stuff Windows x64 SDK must be installed. There came the second problem. Both the web installer and ISO image installer gave strange cryptic errors. After some more messing around I discovered that it was due to a conflict with already installed 2010 redistributables. I uninstalled all 2010 packages and after that the SDK installed without problems.

Now VC++ allowed to change project settings and add additional dependencies. In addition to Nuke libraries and headers, Windows SDK lib folder must also be pointed to in linker settings. It must be the x64 sub-folder because otherwise you get the linker unknown external symbol errors.

With all things set up I was able to successfully compile the example project: