Skip to content

Instantly share code, notes, and snippets.

View lcrs's full-sized avatar
🍅

lwws lcrs

🍅
View GitHub Profile
@lcrs
lcrs / retimestab.py
Last active January 22, 2026 13:52
# Retime a tracked object to better fit a target curve
# Select two Transform nodes: the first with a jerky tracked curve, the
# second with a smooth target curve
# Group effort by Lewis Saunders, Unai Martínez Barredo, Erwan Leroy
# Make a function to calculate the distance between two points
def distance(a, b):
return pow((a[0]-b[0])**2 + (a[1]-b[1])**2, 0.5)
# Find the closest point to p on the line ab
@lcrs
lcrs / track2particles.nk
Created April 25, 2018 15:19
2d track to 3d particle emitter via projection on card
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Tracker4 {
tracks { { 1 31 1 }
{ { 5 1 20 enable e 1 }
{ 3 1 75 name name 1 }
{ 2 1 58 track_x track_x 1 }
{ 2 1 58 track_y track_y 1 }
{ 2 1 63 offset_x offset_x 1 }
@lcrs
lcrs / UVless.py
Last active November 29, 2017 21:55
# Creates perspective projection in a shader without UVs on the geo
# Select the camera to project from, run this, two nodes appear in /mat
# lewis@lewissaunders.com
import hou, math
cam = hou.selectedNodes()[0]
world2cam = cam.worldTransform()
world2camvex = str(world2cam).replace('[', '{').replace(']', '}')
aspect = float(cam.evalParm('resx')) / float(cam.evalParm('resy'));
haperture = cam.evalParm('aperture')
@lcrs
lcrs / hook.py
Created April 19, 2017 22:21
Initial hook.py including right click/copy clip path thing
#!/bin/env python
#******************************************************************************
#
# Filename: hook.py
#
# Copyright (c) 2008 Autodesk Canada Co.
# All rights reserved.
#
# Use of this software is subject to the terms of the Autodesk license
# agreement provided at the time of installation or download, or which
@lcrs
lcrs / crok_snow3d.glsl
Last active October 26, 2015 12:41
Snow rotate-o
// based on https://www.shadertoy.com/view/4tSSzt by FabriceNeyret2
// using the base ray-marcher of Trisomie21: https://www.shadertoy.com/view/4tfGRB#
vec3 adsk_getVertexPosition();
vec3 adsk_getCameraPosition();
vec3 adsk_getLightPosition();
vec3 adsk_getLightDirection();
vec3 adsk_getLightTangent();
vec3 adsk_getLightColour();
vec3 adsk_getDiffuseMapCoord();
@lcrs
lcrs / crok_cam_shaker.glsl
Created December 10, 2014 21:31
crok cam shaker moblur test
uniform sampler2D source;
uniform float adsk_time, zoom, offset, adsk_result_frameratio, rotation;
uniform float Speed, pos_frq, pos_amp_x, pos_amp_y, zoom_amp, zoom_frq, rot_frq, rot_amp;
uniform float adsk_result_w, adsk_result_h;
vec2 resolution = vec2(adsk_result_w, adsk_result_h);
uniform vec2 center;
uniform bool enbl_zoom, enbl_position, enbl_rotation;
@lcrs
lcrs / glasso.glsl
Created November 24, 2014 19:18
glasso
uniform float adsk_time;
uniform float adsk_result_w, adsk_result_h;
uniform sampler2D front, matte;
float get(vec2 p) {
return texture2D(matte, p).r;
}
void main(void)
{
@lcrs
lcrs / noiz.glsl
Created November 9, 2014 17:31
Time varying 1D simplex noise with frequency and bias controls
// Using Ashima's simplex noise
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
vec3 mod289(vec3 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec2 mod289(vec2 x) {
// frameguide
// Shader written by: Kyle Obley (kyle.obley@gmail.com), Miles Essmiller & Ivar Beer
uniform sampler2D Source;
uniform float adsk_result_w, adsk_result_h, adsk_Source_frameratio, adsk_time;
uniform float ratio, let_blend, guide_blend, center_blend, size;
vec2 resolution = vec2(adsk_result_w, adsk_result_h);
float iGlobalTime = adsk_time;
import numpy as np, matplotlib.pyplot as pp, mpl_toolkits.mplot3d as mp
import scipy.interpolate as si, scipy.optimize as so, scipy.spatial.distance as ssd, scipy.integrate
data = (1,2,3,4,5,6,7,8),(1,2.5,4,5.5,6.5,8.5,10,12.5),(1,2.5,4.5,6.5,8,8.5,10,12.5)
p = 6.5,9.5,9
# Fit a spline to the data - s is the amount of smoothing, tck is the parameters of the resulting spline
(tck, uu) = si.splprep(data, s=0)
# Return distance from 3d point p to a point on the spline at spline parameter u