Page 1 of 1
distort image for cylindrical projection on sphere...
Posted: 2012-05-18T13:52:10-07:00
by owntheweb
Hello,
I work as part of the Space Foundation and we're getting a really cool new educational tool: Science on a Sphere (SOS):
Image Credit: NASA / GSFC: NASA gave a special Science On a Sphere (SOS)® demonstration to HM Elizabeth II, Queen of England and her husband, HRH Prince Phillip, the Duke of Edinburgh, and other members of the Royal Family on Tuesday, May 8, 2007.
Cool!! Now I'm attempting to create some homemade SOS starter content of my own because it's just that cool. The required image format is an Equatorial Cylindrical Equidistant projection (ECE) that looks like this:
Note the square I added. When projected on a sphere, it appears bloated like this (rendered in Blender for brainstorming purposes):
This bloated graphic look is something I've noticed with a lot of other SOS content creations out there. As a picky artist, I want my square to have the illusion of being a square on a sphere, kind of like this (not perfect, but makes me happy):
I was able to achieve this look in Photoshop by pinching the square graphic a bit like this:
Any thoughts on how to make some ImageMagick magic happen to distort graphics and apply to an ECE image? So far I'm guessing that I need to stretch the X axis more closer to the poles (but not Y axis). There's also the challenge of distorting graphics closer to the edge of the projection (e.g. some looping/tiling needed).
Here are a couple images to play with:
map:
http://farm6.staticflickr.com/5072/7223 ... 1b33_b.jpg
"square square square square" square (a little different from above):
http://farm8.staticflickr.com/7232/7223 ... bffc_m.jpg
Thanks for your brainstorming in advance.
Re: distort image for cylindrical projection on sphere...
Posted: 2012-05-18T13:59:00-07:00
by fmw42
You can distort the square by using -distort barrel to make it pinch inward (either or both in x or y). Then compose the square onto the map. Then use one of my scripts (linked below or from my web site below), spherize (or the slower but more flexible bubblewarp) or fisheye to warp the composite onto a sphere. I don't know, however, whether that will map your stuff onto the sphere in exactly the way you want as IM does not have proper cartographic projection mapping (yet). If you have your own mapping software, then just warp the square and composite it over the map.
see
http://www.imagemagick.org/Usage/distorts/#barrel
http://www.fmwconcepts.com/imagemagick/ ... /index.php
http://www.fmwconcepts.com/imagemagick/ ... /index.php
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/layers/#convert
Re: distort image for cylindrical projection on sphere...
Posted: 2012-05-18T19:37:43-07:00
by owntheweb
Nice!
Thanks for the super fast and super helpful reply. I'll definitely take a look at the barrel distortion first and that should cover what I need. It also sparked some additional fun ideas to try with multiple images on the same map (e.g. logo visible from multiple sides, video playing in multiple spots around the globe for better audience visibility).
If I get something pretty going, I'll be sure to post the results.
Re: distort image for cylindrical projection on sphere...
Posted: 2012-05-18T19:47:47-07:00
by fmw42
Actually, you could use my bubblewarp or defisheye scripts and "despherize" it so that when put back on the sphere it will look rectangular. But those will be rather slow compared to -distort barrel.
Re: distort image for cylindrical projection on sphere...
Posted: 2012-05-19T07:46:47-07:00
by owntheweb
Quality output comes with time.
I'm not too concerned about the speed of rendering. I'll be sure to experiment with the options you suggested. Today I'm re-familiarizing myself with ImageMagick in general, getting some script helpers built and a new virtual sphere set up on my Mac.
Random thought: It would be awesome to make some pole cap graphics. I remember seeing these in 360 panoramas when iPix was big. Perhaps this would be a good separate discussion some other time after more basic endeavors...
Re: distort image for cylindrical projection on sphere...
Posted: 2012-05-19T16:53:23-07:00
by owntheweb
Above: same texture seen at different angles
For the moment I think I am reliving the efforts of other sphere content designers who wanted to place a square image (photo, logo or video) on a sphere. It's interesting because the sphere is 3D, but the projection itself is "flat" in a sense, messing with my design coordination. I can't cut holes through the sphere and let people see out the other side like one can in a virtual 3D environment.
When looking at the first image directly, the pinched/barreled box looks square. From a side perspective though the barrel effect is magnified. The good news is that the curve seems pretty consistent. For presentation purposes though I would guess that the box needs to be a touch smaller for better viewing at multiple angles. Also, the "square" looks more like a rectangle now. I guess if I was placing a rectangular video, I would need to stretch the Y axis a bit.
fmw42,
The challenge I see with using bubblewarp or defisheye is that the graphics I create don't start in a sphere or an cylindrical projection. I'm designing them first in Photoshop or exporting still frames from video, then trying to make the graphics blend in nicely with an interesting ECE format. Generally I would have a starter ECE graphic (like the Earth map for example), then attempt to add labels and graphics on top of that. Of course, I'll be making disco balls and death stars too, but that's a different topic.
I almost wonder if I should be applying graphics onto the inside of a sphere in Blender, a 3D modeling program, then try to render an ECE graphic from there somehow. At least for some items like pole cap graphics and interesting lines. I can see text labels, photos and video still using barrel.
Am I still off somehow on the bubblewarp or defisheye part? Thanks again for your continued feedback. At the very least you have helped get the creative juice extraction process going so far.
Re: distort image for cylindrical projection on sphere...
Posted: 2012-05-19T17:31:36-07:00
by fmw42
Am I still off somehow on the bubblewarp or defisheye part? Thanks again for your continued feedback. At the very least you have helped get the creative juice extraction process going so far.
I don't know. What I thought you could do was an inverse of the sphere projection, so that when you did your sphere projection it would straighten out. I have not tried to experiment with that, though. For bubblewarp, it would the sin projection, not the asin projection. The defisheye would be the equivalent but includes the perspective aspect of the image. The bubblewarp assumes the image is orthgraphic.
What you have from the barrel distortion looks good to me.
Re: distort image for cylindrical projection on sphere...
Posted: 2012-05-21T06:50:47-07:00
by owntheweb
Thanks a ton for the excellent feedback.
I think I have what I need for quick graphics added to ECE images. On a side note, I'm also getting into rendering ECE images from Blender and panorama stitching software, great for working more at the source of it all. Using ImageMagick's barrel effect still seems like the best option for adding on video frames and other quick graphics to be presented.
Best regards,
Chris