Skip to content

Instantly share code, notes, and snippets.

@herronelou
herronelou / irradiance_map.cpp
Last active July 9, 2019 16:27
WIP irradiance map blinkscript, has pinching issues. Adapted from https://learnopengl.com/PBR/IBL/Diffuse-irradiance
inline float3 uv_to_sphere(const float2 uv, const float2 image_size)
{
float2 st = (uv+float2(0.5f)) / image_size;
float latitude = (st.y - 0.5f) * PI;
float longitude = (st.x - 0.5f) * 2 * PI;
float radiusAtLat = cos(latitude);
float3 normal;
normal.x = radiusAtLat * cos(longitude);
normal.y = sin(latitude);
normal.z = radiusAtLat * sin(longitude);
@jedypod
jedypod / DistortTracks
Last active January 19, 2024 16:42
Distort Tracks Gizmo(Description in Comments, because description does not support markdown?)
set cut_paste_input [stack 0]
push $cut_paste_input
Group {
name DistortTracks
help "<b>Distort Tracks Gizmo</b>\n\n<b>About</b>:\nThis gizmo reformats and/or distorts tracking data based on a uv distortion map input. When you are working with CG elements in your comp that are undistorted and padded resolution, sometimes it is useful to reconcile tracking data from a 3d position through a camera into screen space. This data can then be used to do stuff in 2d: track in lens flares, matchmove roto or splinewarps, etc. The problem is that when this tracking data comes back from our padded undistorted 3d scene into distorted, unpadded resolution comp land, it doesn't line up. \n\n<b>Instructions</b>:\n1. Connect the UV input to a uv distortion map and set the channel that holds it, (for example, a LensDistortion node set to output type Displacement, outputting a UV distortion map into the forward.u and forward.v channels)\n2. Set the padded resolution format and the destination format: Padded resolution is the ov