## Panorama Stereographic projection "Little Planets" in gen!?

Jun 12, 2013 at 6:57am

# Panorama Stereographic projection "Little Planets" in gen!?

Hello

Patching with Gen in this hi level is new to me, i need help.

I like this:

http://creativejs.com/2012/01/little-planet-street-view/

http://www.subblue.com/blog/2010/6/17/little_planets

There is a interactive online website you can check it self, its very funny but you
need a browser with WebGL support -> Firefox.

http://notlion.github.io/streetview-stereographic/

The basic is a 360° sphere panorama picture. ( http://de.wikipedia.org/wiki/Kugelpanorama )

Can someone tell me how i can make this “Little Planets” in gen?

Here is the GLSL shader code from the website(you can find this in the left top, press +):
_________________________________________________________________________
precision mediump float;

uniform sampler2D texture;
uniform float scale, aspect, time;
uniform mat3 transform;

varying vec2 v_texcoord;

#define PI 3.141592653589793

void main(){
vec2 rads = vec2(PI * 2., PI);

vec2 pnt = (v_texcoord – .5) * vec2(scale, scale * aspect);

// Project to Sphere
float x2y2 = pnt.x * pnt.x + pnt.y * pnt.y;
vec3 sphere_pnt = vec3(2. * pnt, x2y2 – 1.) / (x2y2 + 1.);
sphere_pnt *= transform;

// Convert to Spherical Coordinates
float r = length(sphere_pnt);
float lon = atan(sphere_pnt.y, sphere_pnt.x);
float lat = acos(sphere_pnt.z / r);

gl_FragColor = texture2D(texture, vec2(lon, lat) / rads);
}
_________________________________________________________________________

(Sorry if my english not good, i am better in german)

Many thanks for the support and have a nice day

Urs

#252512

You must be logged in to reply to this topic.