
1stFinger x 2ndFinger = Result
The order in the equation has to match the spatial order in the picture. 1st Finger comes first when reading equation left to right.
Maybe the most boring blog ever... but it's *my* most boring blog ever.
collection void RIB {
state closed
ribattribute string "shade:transmissionhitmode" {
label "shadeTransmissionHitMode"
default "primitive"
subtype selector
range { "primitive" "primitive"
"shader" "shader"
}
}
}

Breifly (see diagram also):
float S = 1;
point P = transform("world", P);
point E = transform("world", E);
vector I = vtransform("world", I);
if ( ycomp(I) < 0 ) // I.e. point being shaded is closer to ground than the camera
{
// S is some scale value we need to solve to scale I upto;
// I' = P'-E
// ycomp(P') we know is always zero
// therefore we can solve the scale for ycomp and use it to scale I (similar triangles)
// P' = E + I*S;
// so;
// ycomp(E) + ( ycomp(I) * S ) = 0;
S = ( -ycomp(E) / ycomp(I) );
I = vtransform("world", "current", I*S);
// Voila, our new fake (clamped) depth is;
depth = min( length(I), 65535 );
}
else
{
// E.g. plane is upside down, etc.
// Just Set depth to Max ( 65535, which is the largest value our EXR's can store )
depth = 65535;
}
Attribute "grouping" "string membership" ["noRflOccl"]string $ws = `workspace -q -rd`;
     vector refract( vector I, N; float eta )
     vector faceforward( vector N, I )     type clamp( type a, min, max )     type mix( type x, y; float alpha )
     type smoothstep( type min, max, value )