Page 1 of 1
Render spherical /stereographical /panoramicimages in löve
Posted: Tue Aug 02, 2011 7:20 pm
by ddbx
Hello,
Fist thanks for this tool, i just begin and already am charming by the results of my little tests.
Here is the question:
Can someone point me the direction to make love print panoramic images with this kind of images:
http://en.wikipedia.org/wiki/File:Globe_panorama03.jpg
http://en.wikipedia.org/wiki/File:Stere ... _Paris.jpg
(the images are extracted from here:
http://en.wikipedia.org/wiki/Panorama
http://en.wikipedia.org/wiki/Stereographic_projection)
Does the love API permit distortion of images to render this kind of image adequately (if yes can you point me to it. A search in the web site and the forum did not help me)?
If not maybe another module need to be build? In this case i'm afraid there will have some code to write in C or C++, and need some knowlege in math ... Despite it look far out of my competence, where should I start if one day I decide to building such a module? For example, is there an existing module that can be used as template or extended to draw such an images?
Thanks a lot
ddbx
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Tue Aug 02, 2011 7:41 pm
by TechnoCat
Right now you would have to preprocess it with something like this:
http://www.youtube.com/watch?v=k5vDgVBTTgg
You should be able to do it with 0.8.0's pixel effects (fragment shader) though.
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Tue Aug 02, 2011 7:52 pm
by ddbx
Hi, thanks for your responce, I did not understand your response. My concern is to view the images I show you in my previous message in a love application. It should look like the olds Mysth or Atlantis series of game.
You should be able to do it with 0.8.0's pixel effects (fragment shader) though.
Does this mean that it will be possible to view these images in a future release without touching any C code, and indeed, it is not actualy possible?
cordialy
ddbx
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Tue Aug 02, 2011 8:55 pm
by kikito
I think it would help if you defined a bit more what you understand by "view in LÖVE". There are too many ways to "view" those images in love.
Describe what the screen should show, or better, make a mockup screenshot if you can.
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Tue Aug 02, 2011 9:37 pm
by ddbx
ha. Here is a flash application that produce the effect I would want to see:
http://www.360cities.net/
And google street view:
http://maps.google.com/help/maps/streetview/
Here it is atlantis an adventure game:
http://www.youtube.com/watch?v=JYlzsZcuVkY
In my idea, the player move between multiples environments like these.
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Wed Aug 03, 2011 5:20 am
by Taehl
Ah, hey, I hate to say it, but the images linked to in the original post AREN'T panoramic. Nor are they stereographical. These terms mean different things.
What those two (awesome, by the way) pictures show is a Polar Transform. Look it up in your graphics app, it should have it. Basically, you're transforming your image's coordinates from a cartesian to polar coordinate system (or the other way around, I forget).
EDIT) Yeah, it's a cartesian to polar. You may have to flip your image upside-down first, if your ground is wrapped around the edges of the image instead of the middle, though.
I suppose you could recreate the effect with pixel shaders (have to wait for 0.8.0) or with
ImageData:getPixel and
ImageData:mapPixel (would be trickier, but could plausibly be done right now).
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Wed Aug 03, 2011 6:47 am
by Tesselode
There's a bunch of weird and cool stuff coming up in 0.8, isn't there?
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Wed Aug 03, 2011 8:37 am
by Boolsheet
Taehl wrote:Ah, hey, I hate to say it, but the images linked to in the original post AREN'T panoramic. Nor are they stereographical. These terms mean different things.
Uhm, Globe_panorama03.jpg and Stereographic_projection_of_Paris.jpg are stereographical projected panoramic photos. At least if you go by the definitions from wikipedia.
And yeah, projecting in realtime is something for the PixelEffects in 0.8.0. The source photo doesn't have to be stereographical projected though.
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Wed Aug 03, 2011 6:10 pm
by ddbx
Yes it is stereographical images. I put spheric and panoramic in the subject in case someone have a similar question.
And yeah, projecting in realtime is something for the PixelEffects in 0.8.0. The source photo doesn't have to be stereographical projected though.
Ok i will wait for the 8 to try this.
Thanks to all for your replys
Re: Render spherical /stereographical /panoramicimages in lö
Posted: Fri Aug 05, 2011 12:00 am
by TechnoCat
Most of this is Boolsheet's code:
Cartesian -> polar
Code: Select all
float pi = 3.14159265;
float norm = 0.70710678118654752440084436210485; //0.5^0.5
vec4 effect(vec4 global_color, Image texture, vec2 texture_coords, vec2 pixel_coords)
{
float radius, theta;
vec2 shifted = texture_coords - vec2(0.5, 0.5);
radius = 1 - (sqrt(pow(shifted.x,2) + pow(shifted.y,2)) / norm);
theta = atan(shifted.y, shifted.x);
vec2 pos = vec2(theta/(2*pi)+0.5, radius);
vec4 color = Texel(texture, pos);
return color;
}
- panorama.jpg (352.18 KiB) Viewed 4716 times
- spherical.PNG (1.94 MiB) Viewed 4716 times