Skip to content

Instantly share code, notes, and snippets.

@howiemnet
howiemnet / Particle resizer.vex.cpp
Last active Feb 4, 2019
Houdini Particle distance resizer
View Particle resizer.vex.cpp
// NOTE: ignore the .cpp extension on the filename - this is VEX
// but I couldn't find a gist-friendly way to syntax-hilight it
// ¯\_(ツ)_/¯
//
// h's magic adaptive point resizer for optimal
// rendering of tiny points/particles/wires
//
// 1/2/2018 h@howiem.net
// CC-0 - use and abuse
@howiemnet
howiemnet / infinity_blur.js
Last active Jan 7, 2019
Blur objects at infinity depending on camera settings - After Effects expression
View infinity_blur.js
//
// This expression, applied to the blur radius of a Lens blur effect, will calc the right amount of blur
// to apply to objects at infinity (eg star fields) depending on the focus dist / aperture of the current active camera
//
// For safety it maxes out at 100 px (!)
//
try {
focLen = (thisComp.activeCamera.cameraOption.zoom * 102.05) / thisComp.width;
blurDiam = (focLen * thisComp.activeCamera.cameraOption.aperture) / (thisComp.activeCamera.cameraOption.focusDistance - focLen);
Math.min(100,Math.abs(blurDiam)/2)
@howiemnet
howiemnet / Houdini - copy camera animation data to clipboard.py
Created Nov 7, 2018
Houdini to AE camera animation clipboard exporter (now with Zoom! Woo!)
View Houdini - copy camera animation data to clipboard.py
# Houdini to After Effects camera animation exporter
# This version: 7/11/2018, by Howard Matthews - h@howiem.net
# Copyright: CC-0 - use and abuse. Please pass on the knowledge.
# Note: there's no error-checking in this script, but it alters nothing within the Houdini scene, so it'll just
# fail with an error if you try running it without a camera selected. No harm done.
import hou
theNodes = hou.selectedNodes()
@howiemnet
howiemnet / AE_to_Houdini.py
Last active Feb 22, 2019
First attempt at getting AE camera data into Houdini (hacky woo)
View AE_to_Houdini.py
# Ultra quick'n'hacky AE camera animation importer for Houdini.
# Create a new shelf, create a new tool, paste this into the script box.
#
# In AE, select the Orientation and/or Position keyframes, and Ctrl/Cmd-C them to the clipboard
# Open a new text file (Notepad or Textedit) and paste the clipboard contents in. There's your keyframes.
# Save the text file somewhere and amend the filename line below to suit
# In Houdini, create a camera (it's up to you to set the same zoom / aperture as the AE one).
# ... and run this script (well, press the shelf button you stuck this on)
@howiemnet
howiemnet / Hacky_Houdini_to_AfterEffects.py
Created Jul 27, 2017
Houdini to After Effects animation exporter thingy
View Hacky_Houdini_to_AfterEffects.py
# first hacky attempt at getting camera / object animations into AE from Houdini.
# Stick this on a tool button on a shelf. Note the hard-coding below (!)
# A file will be created in your home folder; open it, copy to the clipboard, then go to AE and paste onto the cam/null of your choice
import hou
h = hou.node("/obj/geo1")
filename = "testfile.txt"
startFrame = 0
View Send mo-co position from Blender to server.py
import sys
import bpy
from math import pi, sin, cos, sqrt, atan2, fabs
import socket
rad2deg = 180/3.14159265
UDP_IP = "127.0.0.1"
UDP_PORT = 4950
@howiemnet
howiemnet / Populate.py
Created Mar 7, 2017
Populate! a hacky, project-specific crowd animator
View Populate.py
#
# POPULATE!
#
import bpy
import math
from bpy_extras import object_utils
from random import randint
from math import radians
@howiemnet
howiemnet / Populate.py
Created Mar 7, 2017
Populate! a hacky, project-specific crowd animator
View Populate.py
#
# POPULATE!
#
import bpy
import math
from bpy_extras import object_utils
from random import randint
from math import radians
@howiemnet
howiemnet / SetScreenLayout.py
Created Jan 27, 2017
Blender Screen hotkeys script
View SetScreenLayout.py
import bpy
class SetScreenLayout(bpy.types.Operator):
"""Switches to the screen layout of the given name."""
bl_idname="screen.set_layout"
bl_label="Switch to Screen Layout"
layoutNamme=bpy.props.StringProperty()
def execute(self,context):
bpy.context.window.screen=bpy.data.screens[self.layoutNamme]
return{'FINISHED'}
def invoke(self,context,event):
@howiemnet
howiemnet / gist:b63f759c99475dcb347c6ee727995778
Created Jan 3, 2017
After Effects: expressions for Particular - particles from thrust
View gist:b63f759c99475dcb347c6ee727995778
// apply this to the PoI of a spot light to point it in the direction of its acceleration vector
nextVec = transform.position.valueAtTime(time+0.08)-transform.position.valueAtTime(time);
prevVec = transform.position.valueAtTime(time)-transform.position.valueAtTime(time-0.08);
theVec = prevVec-nextVec;
theVec = theVec * 10;
theVec = theVec + transform.position;
theVec
// apply this to the Particles/sec parameter
prevVel = length(thisComp.layer("TEAL").transform.position.valueAtTime(time+0.04) - thisComp.layer("TEAL").transform.position.valueAtTime(time));
You can’t perform that action at this time.