Hi!
I did some experimentation with the OSL for fulldome.
Video:
<span id=“result_box” class=“” lang=“en”><span class=“hps”>
Here’s my script OSL.
#include "stdosl.h"
shader simple(
int inv = 0,
float scalex = 0.91, float scaley = 1.00,
float offsetx = 0, float offsety = -0.011,
float warpx = 0.130, float warpy = 0.100,
float rot = 0.000,
vector Vi = 0,
output vector Vo = 0
){
float x = Vi[0];
float y = Vi[1];
x = x*scalex+(1-scalex)/2+offsetx;
y = y*scaley+(1-scaley)/2+offsety;
x = (0.5-x)*2;
if(sqrt(x*x+y*y)>1) Vo = vector(2,2,2);
else {
float pu = x;
float pv = y;
float pr = sqrt(pu*pu+pv*pv);
float a = atan2(pv,pu);
float b = pr*M_PI;
float py = cos(b);
float pz = sin(b)*sin(a);
float px = sin(b)*cos(a);
float theta = atan2(py,px);
float phi = atan2(pz,sqrt(px*px+py*py));
x = (theta + M_PI)/M_2PI + rot + 0.75;
if(x>1) x=x-1; if(x<0) x=1-x; x=x*(1+warpx)-warpx/2;
y = phi/M_PI_2; y=y*(1+warpy);
if(inv) y=1-y;
if(x>1 | x<0 | y>1 | y<0) Vo = vector(2,2,2);
else Vo = vector(x,y,0);
}
}
topic link:
http://paulbourke.net/dome/faq.html
http://paulbourke.net/miscellaneous/littleplanet/