-
M.D.
Am I trying to do the impossible? (3d guru's apply)
http://soap.com.au/chris/rotateTest/v3/
keys to rotate the sphere.
What I'm trying to achieve is convert a 2D array of hexagons wrapped around a sphere.
here's the map:
I believe that this is impossible as spherical coordinates get squished at the poles. Guessing that If this was a cylinder it would work. I'm also guessing that the spacing between hexagons is different on the x/y axis because of this squishing.
Is there any way to resolve this? maybe a hexagons size can be changed to be smaller the closer it is to a pole? I'm not so sure how to go about doing that. Maths aint so good.
thanks for any help you guys can give me
-
texture mapping is quite a strong interest of me (e.g my recent UV-scripts)
unwrapping spheres has always been kind of a paradox as it always comes with side effects see (sphere with cheker map and earth texture)
http://www.unwrap3d.com/tutorial_map.aspx
which are a better example.
but maybe you need a different shape? - from what I saw in the demo maybe something like this would work as well?
based on 2 circles of faces merged together in the 2nd model. Green shows the seams of the UV- map (where your texture stops and could produce a seam depending on your texture, less or not noteable ones are better). At the bottom is the UV- example of that 2nd model with way to much texture space waste. Just to give you more ideas
something else I found, for the math approach (not my turf)
http://tobias.preclik.de/codeblog/?p=9
-
Senior Member
I don't think that doing the hexagons ALL around the sphere is possible...
I'm not too sure at the moment about exactly how the geometry fits together, but you can make an IcoSphere with triangles, or maybe pentagons. Anything with a higher edge count is out of the question.
Or then again, you can texture map that onto a sphere, after (probably should check out that link render posted last) you run some calculations on the texture image to stretch out the 2 ends of it, so it texture maps perfectly, like they have those world maps stretched out at the top and bottom!
P.
WIP-ZOMBIES
I love vegetarians! More meat for the rest of us!
-
M.D.
thanks for the reply's. Render, I don't think I can use that method of shapes, the setup I have now is just a test scenario, imagine if a hexagon could appear anywhere on the sphere.
Basically what I'm doing right now is:
getting a 2D array of id's which represent the hexagons.
loop over the array, convert 2d array indexes to 2d hex coordinates
find the percentage of this coordinate in relation to a map size (px = hexX / (hexW * arrayW), py = hexY / (hexH * arrayH))
find the point on the sphere using this percent and the 2:1 ratio (sx = px * 360, sy = py * 180)
convert this angle to spherical coordinates
create hex polygon at this coordinate.
there is no texturing going on here. Hexagons are individual geometry in 3d space.
so yeah, unless somehow I can do hex to spherical to polar coordinates, or something like that, treating it like a texture map which has been creates for a sphere. Its not going to work.
on thew topic of spherical texturing, does anyone know how to take a flat image (like the one I posted) and move the pixels so the tops and bottoms are expanded and the middle is squished, so that it maps correctly around the sphere?
Thanks for the help.
-
Senior Member
I think euler's formula for polyhedra indicates it can't be done, at least not with a texture that's a regular tiling of hexagons (ie each vertex having valence 3).
For any genus G polyhedron you must have V-E+F=2-2G, where V is the number of vertices, E is the number of edges and F is the number of facets. The sphere (and any polyhedron homeomorphic to a sphere) has genus 0.
But if you consider the regular tiling of hexagons in 2D, if you have F hexagons then you have 6F/2 edges (each hex has 6 edges but we double counted them because each edge is shared among two hexes). Also, the number of vertices is 6*F/3, each hex has 6 vertices and each vertex is shared 3 ways. Plug these numbers into eulers formula:
V-E+F = 2-2G
6F/3-6F/2+F = 2-2G
2F-3F+F = 2-2G
0 = 2-2G
G= 1
So when you tile regular hexagons like that you can only make genus 1 shapes - a torus. You can envision this tiling by taking the texture and wrapping it up into a cylinder, then rolling that cylinder back onto itself. You won't be able to texture or facetize a sphere seamlessly with hexagons unless you have some nodes with valence!=3. (Vertices like that are called extraordinary points in subdivision surfaces - in the infinitesimal limit they have weaker curvature guarantees that the other spots on the surface).
// brain.explode();
Last edited by rachil0; 02-10-2009 at 11:35 PM.
-
M.D.
thankyou rachil I was gonna say the exact same thing
you have made my day.
-
Daag dont have anything productive to add, but im loving what people are making flash do these days, makes me want to bust out a 3d project!
-
I remember some demos from the flash 8 days when bitmapData and normal maps (displacement maps) were introduced showing some examples with a spherical displacement
it was not andre still he has a blog entry and demos as well:
http://blog.andre-michelle.com/2005/...mentmapfilter/
another something I found:
http://justin.everett-church.com/ind...es-on-spheres/
demo & code:
http://makc.coverthesky.com/FlashFX/ffx.php?id=8
in the end I could not find the article anymore (quite scientific but it used displacement and some higher math to do very accurate sphere mapping from a stretched texture in Flash)
-
I think rachilo is right, you can't form a solid using just hexagons without gaps-- i.e., every hexagon touches exactly six others along each face.
You could do it with a mix of pentagons and hexagons, but that would probably cause more problems than it solved (I assume).
-
Pumpkin Carving 2008
I tried this already, and unfortunately for you, working in the 3d perspective makes it impossible. Faking it from a static 2d perspective is completely possible though.
http://board.flashkit.com/board/show...ht=grid+sphere
That probably doesn't help you now but there's some wisdom in that thread there.
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
-
Senior Member
Isn't it a similar problem ?
Maybe it would be possible to map the ball with hexagons if you use fake hexagons (6 sides but not perfectly symetric).
-
M.D.
yep, thats possible, but how do you get the hexagon coordinates like that?
-
n00b
Don´t know if it helps, but try googling for "truncated icosahedron". That´s the nerd-word for a soccer ball.
-
ism
Again, don't know if this helps but this texture maps to a soccer ball using spherical coordinates (i think there might be a bit of a seam though);
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
Senior Member
Only the white sections of a soccer ball are hexagons. The black parts are pentagons.
;-)
-
Senior Member
When I said you could texture map it on the sphere, I of course didn't mean that you would see no seems in it, but if you subdivide the triangles in the sphere enough, then that shouldn't matter too much. And of course, I got reminded by others just now about the Displacement Map Filter. I think that this will be your only alternative, but for rotation you'll have to work with moving the actual texture around in x/y's...
P.
WIP-ZOMBIES
I love vegetarians! More meat for the rest of us!
-
M.D.
well, thanks for all the help and replies. I convinced people that it wasn't possible and now I'm using a flat texture map, with hexagons placed roughly around the equator. With tweaking hex size, amount around the equator, spacing, the results looks good.
can't show you guys anything yet though, stay tuned
thanks again.
-
-
actually the euler characteristic of a sphere (or any surface homeomorphic to S^2) is 2. you are mistaking the euler characteristic of a torus of genus 1 (i.e. X(T) = 2 - 2g = 2-2(1) = 0).
for regular hexagons your counterexample argument still applies but you will arrive at the step 0 = 2. if the hexagons are not regular, the problem is slightly more complicated (find a relationship e and f, then use the given condition to put an upper bound on v in terms of f. This will
give you an upper bound on the euler characteristic, which will gie a contradiction), but it is still impossible to subdivide the surface of a sphere (or any surface homeomorphic to S^2) with 6-gons regular or not.
there are only 5 regular polyhedra, and the proof arises from a basic combinatorial argument. this can be found on google.
Originally Posted by rachil0
I think euler's formula for polyhedra indicates it can't be done, at least not with a texture that's a regular tiling of hexagons (ie each vertex having valence 3).
For any genus G polyhedron you must have V-E+F=2-2G, where V is the number of vertices, E is the number of edges and F is the number of facets. The sphere (and any polyhedron homeomorphic to a sphere) has genus 0.
But if you consider the regular tiling of hexagons in 2D, if you have F hexagons then you have 6F/2 edges (each hex has 6 edges but we double counted them because each edge is shared among two hexes). Also, the number of vertices is 6*F/3, each hex has 6 vertices and each vertex is shared 3 ways. Plug these numbers into eulers formula:
V-E+F = 2-2G
6F/3-6F/2+F = 2-2G
2F-3F+F = 2-2G
0 = 2-2G
G= 1
So when you tile regular hexagons like that you can only make genus 1 shapes - a torus. You can envision this tiling by taking the texture and wrapping it up into a cylinder, then rolling that cylinder back onto itself. You won't be able to texture or facetize a sphere seamlessly with hexagons unless you have some nodes with valence!=3. (Vertices like that are called extraordinary points in subdivision surfaces - in the infinitesimal limit they have weaker curvature guarantees that the other spots on the surface).
// brain.explode();
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
|