Skip to content

Instantly share code, notes, and snippets.

@mattebb
Last active August 29, 2015 14:17
Show Gist options
  • Save mattebb/cfec15c859cf83bd3f4f to your computer and use it in GitHub Desktop.
Save mattebb/cfec15c859cf83bd3f4f to your computer and use it in GitHub Desktop.
Mantra stereo pano camera lens shader (wip)
float theta = -$PI * x;
float phi = $PI * 0.5 * y;
float sin_theta = sin(theta);
float cos_theta = cos(theta);
float sin_phi = sin(phi);
float cos_phi = cos(phi);
i.z = sin_theta * cos_phi;
i.y = sin_phi;
i.x = cos_theta * cos_phi;
if (eye == 0) {
p.z = -0.5 * ipd * cos_theta * cos_phi;
p.x = -0.5 * ipd * sin_theta * cos_phi;
} else {
p.z = 0.5 * ipd * cos_theta * cos_phi;
p.x = 0.5 * ipd * sin_theta * cos_phi;
}