Render spherical /stereographical /panoramicimages in löve

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
ddbx
Prole
Posts: 4
Joined: Tue Aug 02, 2011 6:52 pm

Render spherical /stereographical /panoramicimages in löve

Post 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
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Render spherical /stereographical /panoramicimages in lö

Post 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.
ddbx
Prole
Posts: 4
Joined: Tue Aug 02, 2011 6:52 pm

Re: Render spherical /stereographical /panoramicimages in lö

Post 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
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Render spherical /stereographical /panoramicimages in lö

Post 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.
When I write def I mean function.
ddbx
Prole
Posts: 4
Joined: Tue Aug 02, 2011 6:52 pm

Re: Render spherical /stereographical /panoramicimages in lö

Post 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.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Render spherical /stereographical /panoramicimages in lö

Post 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).
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Render spherical /stereographical /panoramicimages in lö

Post by Tesselode »

There's a bunch of weird and cool stuff coming up in 0.8, isn't there?
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Render spherical /stereographical /panoramicimages in lö

Post 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.
Shallow indentations.
ddbx
Prole
Posts: 4
Joined: Tue Aug 02, 2011 6:52 pm

Re: Render spherical /stereographical /panoramicimages in lö

Post 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
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Render spherical /stereographical /panoramicimages in lö

Post 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
panorama.jpg (352.18 KiB) Viewed 4636 times
spherical.PNG
spherical.PNG (1.94 MiB) Viewed 4636 times
Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 1 guest