Code: Select all
float PI=3.14159265;
float TWEAK_X_ORIGIN=0.25;
float ZOOM=0.4;
//tools
vec3 rotateXY(vec3 p, vec2 angle) {
vec2 c = cos(angle), s = sin(angle);
p = vec3(p.x, c.x*p.y + s.x*p.z, -s.x*p.y + c.x*p.z);
return vec3(c.y*p.x + s.y*p.z, p.y, -s.y*p.x + c.y*p.z);
}
void mainImage( out vec4 fC, in vec2 fX ) {
iResolution.x = iResolution.x * (iResolution.y/iResolution.x);
//place 0,0 in center from -1 to 1 ndc
vec2 uv = fX.xy/iResolution.xy*2.-1.;
// Correct Horizontal Mirroring
uv.x = uv.x*-1.+(PI*TWEAK_X_ORIGIN-1.);
vec2 CAMERA = vec2 (iMouse.x/iResolution.x*2.-1.,iMouse.y/iResolution.y*2.-1.);
CAMERA *= iResolution.xy;
//to spherical
vec3 camDir = normalize(vec3(uv.xy, 1. + (ZOOM*2.0-1.) - (uv.x/PI*uv.x/PI) - (uv.y/PI*uv.y/PI)));
//camRot is angle vec in rad
vec3 camRot = vec3(CAMERA.yx * PI / iResolution.xy, 0.);
//rotate
vec3 rd = (rotateXY(camDir, camRot.xy));
//radial azmuth polar
vec2 RadAzPol = vec2(atan(rd.z, rd.x) + PI, acos(-rd.y)) / vec2(2.0 * PI, PI);
//this is not a radial texture but whatever
fC = texture2D(iChannel0, fract(RadAzPol * vec2(1.0, 1.0)));
}
Hi Sadler, thanks for pointing out this possible solution. would u mind writing a couple of steps on how to get this shader running with an equirectangular image/video in resolume? i tried to load it but would only show a white screen and i cant find where to load the image/videoSadler wrote:Not FFGL but works in ShaderLoader...
Say thanks to artnik over in the MMV forums.Code: Select all
float PI=3.14159265; float TWEAK_X_ORIGIN=0.25; float ZOOM=0.4; //tools vec3 rotateXY(vec3 p, vec2 angle) { vec2 c = cos(angle), s = sin(angle); p = vec3(p.x, c.x*p.y + s.x*p.z, -s.x*p.y + c.x*p.z); return vec3(c.y*p.x + s.y*p.z, p.y, -s.y*p.x + c.y*p.z); } void mainImage( out vec4 fC, in vec2 fX ) { iResolution.x = iResolution.x * (iResolution.y/iResolution.x); //place 0,0 in center from -1 to 1 ndc vec2 uv = fX.xy/iResolution.xy*2.-1.; // Correct Horizontal Mirroring uv.x = uv.x*-1.+(PI*TWEAK_X_ORIGIN-1.); vec2 CAMERA = vec2 (iMouse.x/iResolution.x*2.-1.,iMouse.y/iResolution.y*2.-1.); CAMERA *= iResolution.xy; //to spherical vec3 camDir = normalize(vec3(uv.xy, 1. + (ZOOM*2.0-1.) - (uv.x/PI*uv.x/PI) - (uv.y/PI*uv.y/PI))); //camRot is angle vec in rad vec3 camRot = vec3(CAMERA.yx * PI / iResolution.xy, 0.); //rotate vec3 rd = (rotateXY(camDir, camRot.xy)); //radial azmuth polar vec2 RadAzPol = vec2(atan(rd.z, rd.x) + PI, acos(-rd.y)) / vec2(2.0 * PI, PI); //this is not a radial texture but whatever fC = texture2D(iChannel0, fract(RadAzPol * vec2(1.0, 1.0))); }
https://magicmusicvisuals.com/forums/vi ... ?f=4&t=913
Hi guys, just wondering if this actually has become a reality? =)markbres wrote:sounds great! camera inside the sphere mapped equirectangular panorama video clips.hive8 wrote:I need a little more info to get started on this.
The clips you be loading are equirectangular panorama video clips?
And you want a view placed on that so you can look at a section of that panorama.
Also the panorama will need to be mapped on a sphere.
View movement you want left, right, up, down, zoom in / out?
I hope i got that right, please let me know if something is not right.
Can you give me a demo clip for testing.
possible parameters:
-camera rotate x, y, z (look left-right, look up-down, roll angle)
-camera field of view (degree)
-camera or sphere move x, y, z
-sphere rotate x, y, z
-sphere size/radius
-sphere resolution/detail?
yes you look at a section. camera could also be on the outside of the sphere and look at it.
BlueMD wrote: Hi Sadler, thanks for pointing out this possible solution. would u mind writing a couple of steps on how to get this shader running with an equirectangular image/video in resolume? i tried to load it but would only show a white screen and i cant find where to load the image/video
my project involves projecting 360° videos onto a surround screen mapped with 4 projectors. Thanks!