Skip to content

Instantly share code, notes, and snippets.

@dbr
dbr / ociolooktransform.nk
Created March 24, 2012 13:04
OCIOLookTransform UI prototype
set cut_paste_input [stack 0]
version 6.3 v5
push $cut_paste_input
Group {
name Group1
knobChanged "\nn = nuke.thisNode()\nas_str = n\['look_as_str'].value()\nn\['look'].setEnabled(not as_str)\nn\['look_str'].setVisible(as_str)\n\nif as_str and n\['look_str'].value() == \"\":\n n\['look_str'].setValue(n\['look'].value())\n"
selected true
xpos 140
ypos -56
addUserKnob {20 User l OCIOLookTransformTest}
#include <stdio.h>
#include <math.h>
int main(){
float r = powf(4.0/9.0, (1.0/2.6));
printf("%.12f\n", r);
}
@dbr
dbr / prefilter.py
Created October 13, 2011 15:15
Python script to prefilter environment maps, computing spherical harmonic lighting coefficients
#!/usr/bin/env python2
"""Python script to prefilter environment maps, computing spherical
harmonic lighting coefficients.
Python port of the prefilter.c code from
http://graphics.stanford.edu/papers/envmap/
"""
import math
@dbr
dbr / nuke_dot_arrange.py
Created October 1, 2011 08:44
Using graphviz's "dot" to arrange a Nuke node graph
"""Test of using graphviz's "dot" layout algorithm to arrange a Nuke node-graph
Example: http://i.imgur.com/f1mK7.png
Left is dot, right is Nuke's builtin nuke.autoplace
"""
import nuke
# http://code.google.com/p/pydot/
import pydot
@dbr
dbr / determine_colour_matrix.py
Created August 28, 2011 13:03
Colour matrix reverse engineer'er
"""PoC code to reverse-engineer an unknown colour-matrix applied to a
set of know pixel values
Moved to:
https://github.com/dbr/colourstuff/blob/master/lib/python/colourstuff/determine_colour_matrix.py
"""
import math
import array
import time
@dbr
dbr / dft.html
Created August 28, 2011 07:21
Slight tweak to HTML DFT demo
<!doctype html>
<!-- Tiny tweak of http://madebyevan.com/dft/ so it does not resample the function on mouse-move
<html><head>
<title>Discrete Fourier Transform Demo - by Evan Wallace</title>
<style type="text/css"><!--
* {
font: 13px 'Segoe UI', sans-serif;
}
@dbr
dbr / dct.py
Created August 26, 2011 10:28
Discreet Fourier Transform in Python
"""Based on Javascript from
http://madebyevan.com/dft/
This may be wrong, but seems to do what I'd expect...
"""
from __future__ import division
import sys
import math
@dbr
dbr / find_camera_expr.nk
Last active August 20, 2018 05:09
An absurd recursive lambda expression to recurse up the DAG, finding a Camera2 node
set cut_paste_input [stack 0]
version 6.2 v3
push $cut_paste_input
Axis2 {
name Axis1
selected true
xpos -107
ypos -135
}
Camera2 {
@dbr
dbr / gist:1139639
Created August 11, 2011 13:25
More sane method of doing Nuke panel UI's
p = nukescripts.panels.PythonPanel()
# Accessible via the knob name (not the UI string \o/)
p.addKnob(nuke.String_Knob("start", "Staaaart value"))
# Or accessible via the knob object
or_this_way = nuke.String_Knob("finish", "Finish value. And it's not used for the UI!")
p.addKnob(or_this_way)
p.showModalDialog()
@dbr
dbr / gist:1113030
Created July 29, 2011 02:44
Projecting env-map into geo, and making animated env-map from this
#! /Applications/Nuke6.2v1-32/NukeX6.2v1.app/../Nuke6.2v1.app/Contents/MacOS/Nuke6.2v1 -nx
version 6.2 v1
define_window_layout_xml {<?xml version="1.0" encoding="UTF-8"?>
<layout version="1.0">
<window x="0" y="22" w="1440" h="874" screen="0">
<splitter orientation="1">
<split size="910"></split>
<splitter orientation="1">
<split size="40"></split>
<dock id="" hideTitles="1" activePageId="Toolbar.1">