|
-
Pumpkin Carving 2008
Stretching a grid around a sphere...
Was just curious if someone could point in a direction where I could find some info on stretching a basic grid around a sphere in 3D. I was thinking something like this:

I have considered a Displacement map filter but it wasn't what I was after because I want to place things in random cells on the sphere and keep track of them. Any ideas, or maybe a different approach?
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
M.D.
why wouldn't a displacement map work?
if you apply the effect you can still change cell graphics and keep track of them, the effect moves pixels not objects.
if you don't use displacment, I'd say your in for triangles, UV mapping, bitmap drawing all that stuff.
-
Pumpkin Carving 2008
And this would still work if I was planning to rotate said sphere? I've got a theory that might work, but I'd still have to mock some sort of 3d to make it look right.
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
a square area with a grid on it when looped horizontally and vertically becomes a torus, and you cant massage that into a sphere.
geometrically speaking, you can't map a square grid onto a sphere like that without a lot of distortion.
if you have to use a square grid, you can put the distortion at the poles like latitude and longitude.
another way is using cube mapping, sort of like a rubiks cube that has been inflated, but you will have 8 points of strong distortion, or start with another shape instead of a cube to tessellate with less distortion.

http://www.evilbastard.org/slight/tesselation.gif
whatever way you do it, assuming youre matching it up with a 2d array, you're going to have seams and stuff to deal with.
can you be more specific what you want to do with the sphere?
-
Pumpkin Carving 2008
The grid won't be distorted, only the one face. If I look again at the image at the top, I would say there almost isn't a pole. The face of the sphere will not move. The image distorted will shift instead to give the appeal of a rotating sphere, kind of like a side view of the earth spinning (assuming no tilt of the axis, just perfectly straight). Also the sphere would be restricted to either pure vertical or horizontal movement at any one time; not both. Hope that clears it up.
PS: Made a little picture: Say I wanted to wrap this to the sphere, but the tanks could still move:

Obviously the tanks would be moving on the flat square bitmap, but projected on the sphere as though on the sides.
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
M.D.
a square area with a grid on it when looped horizontally and vertically becomes a torus, and you cant massage that into a sphere.
http://lab.andre-michelle.com/earth
that uses a flat bitmap and scrolls it horizontally, looks ok to me.
-
ʞ33ƃ
 Originally Posted by mr_malee
From the comments on that page there was this link with some explanation.
http://makc.coverthesky.com/FlashFX/ffx.php?id=8
and here
http://blog.andre-michelle.com/2005/...mentmapfilter/
-
That method will not allow you to scroll vertically, it is more or less a distorted cylinder, as in the middle sphere of the 3 example spheres above.
If I understand correctly what you want to do, you will have to make the world look like a sphere but behave like a torus.
On a torus you can keep heading "north" forever, looping from top to bottom on the square texture bitmap, whereas on a real sphere it doesnt work that way at all, however you map it, at some point you'd have to change your orientation on the 2d image to loop around the 3d projection.
Assuming you'll want it to loop in both directions, and you're OK with it not behaving like a sphere, what you want is better described as a grid on a flat plane viewed top down through an extreme fisheye lens.
You can still do it with a displacement map I guess, it is just that your map texture should be at least double the height and double the width of the visible area (because it can loop either way) meaning you'll only see 1/4 of it at any time even though it will appear like you are seeing 1/2.
-
Senior Member
 Originally Posted by mr_malee
a square area with a grid on it when looped horizontally and vertically becomes a torus, and you cant massage that into a sphere.
http://lab.andre-michelle.com/earth
that uses a flat bitmap and scrolls it horizontally, looks ok to me.
Actually the globe is a perfect example of what he is talking about. A 2D map of the earth surface (like a mercator projection) looks totally different when it's projected onto a sphere. Think how large Antarctica and Greenland look on the 2D map and how small they appear on the real globe - because they are both crowded near a singularity (pole) of the mapping function.
The globe looks ok in this case, because the original texture is already super distorted to compensate.
As for the OP, I think the best solution is the distorted cube mesh - you could define a square texture for each of the 6 deformed faces and then subdivide it in texture space to get a a tiny patch of texture mapped out to each tiny patch of sphere surface. Each patch can be filled using beginBitmapFill on two triangular regions and it should look pretty good.
-
Pumpkin Carving 2008
Thanks to everyone for the very wordy posts. I appreciate the enthusiasm. :P
Wouldn't it kill the player to loop through 100+ segments on the face of the sphere and do a beginBitmapFill for each one? I'm beginning to believe that the simplest way to convert the 2d plane around the visible side of the sphere would be to use a DisplacementMapFilter to create the side of the "sphere" and then simply scroll the bitmap underneath.
Also, someone mentioned looping. I was thinking of just creating a bitmap containing 4 of my current 2d plane in a square, and then doing basic boundary tests. Obviously the array looping would be a bit different (though I'd rather work with arrays than bitmapData ).
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
Zombie Coder
Geez those Andre Michelle demo's are fab. He's without a doubt the best Flash coder I've encountered so far.
-
M.D.
ok I understand now thanks.
I found this anyway - http://oos.moxiecode.com/flash8/displacement_ball2.html
is that kinda what you're after IP?
-
Pumpkin Carving 2008
More or less. The "sphere" wouldn't rotate though, it would be stationary and appear to "rotate" to specified point on the flat bitmap, creating the illusion of a spinning globe or something along those lines.
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
FK founder & general loiterer
I would go papervision... then you can even put little tanks on top!
-
Senior Member
The " sphere" wouldn't rotate though, it would be stationary and appear to "rotate" to specified point on the flat bitmap, creating the illusion of a spinning globe or something along those lines.
you still can do it with displacement then: http://makc.coverthesky.com/FlashFX/ffx.php?id=9
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|