Nuke LDPK node upgrades to v1.7

Posted 3 January, 2014 Anthony Tan (staring at yet another render. But still loving it for some reason..)

« previous | (at newest)

tags: none

Excited by the new LDPK 1.7 nodes? Me too! Wanting to migrate from the old TDE4/Weta binaries? Ditto. Here, you might as well take my scripts, save yourself some hassle.

If you’re a 3DEqualizer user, you’ve been compiling (or asking your local TA/TD nicely) the Science-D-Visions (SDV) Lens Distortion Plugin Kit (LDPK) and the associated Weta wrapper to get it all into Nuke. It’s been a pretty stable, if slightly annoying, workflow but now with the release of LDPK 1.7 guess what? SDV are shipping precompiled binaries!

Alas, they’re not drop-in replacements, or else I wouldn’t be writing this.

Horrified by the thought of either having to unsupport scripts using the old nodes, fixing things on an adhoc call basis, or having to maintain two diverging codebases, over here at FuryFX I thought I’d work out a migration system, simples, no? (sorta)


  • Update your to point to the new LDPK 1.7 nodes.
  • Copy this pack of TCL scripts into your nuke/plugins directory
  • Update your to stop pointing at the old TDE4 nodes.

(and read on because you probably should care about what its doing)

What’s new in the LDPK?

Briefly, three things:

  1. New lens distortion models
  2. SDV precompiled binaries (finally)
  3. More parameters for each distortion model
  4. Renamed node & parameter names, and a new default for direction. Bah.

The first two aren’t too bad - if you weren’t using the new models before, there’s no migration issue, and my tests show that the new parameters at default don’t materially affect the distortion calculation so you can let them alone.

For the third, you can create a TCL wrapper/interceptor plugin that will fire when you’re using the old nodes and redirect and rename the parameters correctly to the new LDPK 1.7 standard.


The code I have here does that translation with a view to preserving comments and adding a stub noting that this was an auto-migrate - I strongly dislike silent conversions since artists should at least be aware of when something has changed like this. One important gotcha, the default direction has changed, and Nuke scripts don’t store parameter values that are left at default, so the TCL has to be smart enough for that.

# basically, hunt for the direction flag/keyword
# if you find it, we assume you set it so we don't touch
# otherwise, we just flip the defaults.
proc tde4_ldp_classic_3de_mixed {arg} { 
    set distortflag 0
    set labelflag 0
    set newdefault { direction undistort}
    set comment "(auto-migrated from TDE4/Weta node\ntde4_ldp_classic_3de_mixed)"
    foreach {key value} $arg {
        # inline arg translation. 
        # this is just brutal, but triple underscores are pretty rare
        set newkey [regsub -all ___ $key _]

        switch $newkey {
            label {
                set value $value"\n\n"$comment
                set labelflag 1
            direction {
                set distortflag 1
        #puts [list $newkey $value]
        append newargs { } 
        append newargs [list $newkey $value]
    if {$distortflag == 0} {
        append newargs { } 
        append newargs $newdefault
    if {$labelflag == 0} {
        append newargs { } 
        append newargs [list label $comment]

    puts $newargs
    LD_3DE_Classic_LD_Model $newargs

You’ll want to do this for each of the TDE4 nodes, and here’s the translation table between old and new:

old codenew code

At this point, once you’ve run that through your QA, you should be good to disable the old TDE4 nodes. As a script gets reopened, and saved, the incidence of old nodes should steadily disappear and one day, this code will be redundant. At the same time you probably want to be migrating to the new .py script that exports these style nodes in 3DE, but unless you've got it centrally deployed, things like that will take a while to trickle through your artists/trackers, so in the meantime, this should intercept things as they come up.

As usual - if it’s broken, borked, or otherwise not doing what it should, get a hold of me.

Conceptualising a 3x3 (with houdini)
(at newest)
tags: none
  • Just as an aside, the cover image is entitled 'best. track. ever.' and shows what happens when you try use 3DE to make beautiful abstract art.
  • accidentally.