Convert sphere geometry to bitmap

Software: Away3D 4.x

HankTurbo, Newbie
Posted: 06 July 2012 04:33 AM   Total Posts: 11

Hiya,

In code I generate a bunch of circles an a sphere. The circles overlap, and I want them to be alpha’d. That means that when they overlap the alpha value on the overlapped area eventually dont have an alpha.

Would anyone have a solution to this?

I tried the Merge class, but that doesnt actually join the geometry.

How about “flattening” the sphere, creating a bitmap and apply it as a material? Is this possible?

Any other solutions?

   

Richard Olsson, Administrator
Posted: 11 July 2012 07:36 AM   Total Posts: 1192   [ # 1 ]

I’m sorry but I don’t understand entirely what it is that you want to achieve. Can you make some sketches or screen grabs or in any other visual way describe what kind of visual output you’re after?

   

HankTurbo, Newbie
Posted: 23 July 2012 02:00 AM   Total Posts: 11   [ # 2 ]

Hi,

Thanks for the reply. The concept is a little hard to explain, but I do have a very crude example that you can have a look at. It is based on one of the tutorials for creating the earth here on away3D. In addition I’m loading in an external earth object and placed some marker around the earth. This markers have little circles (yellow in colour) drawn around them, when you click the marker the circle expands.

What I want is for the circles to join seamlessly, but with an alpha channel. As it is now when they overlap they are treated as two geometry objects and therefore laid on top of each other, creating a denser alpha.

http://filer.hyperinteraktiv.no/clients/mogul/earth3D/main.html

PS. There are no nice preloaders or anything to let you visualise when I’m done loading the objects in, so please be a little patient. The earth will load in first (sphere with a bitmap + clouds), then the a “styled” 3D earth object (in green) and with markers.

   

Richard Olsson, Administrator
Posted: 23 July 2012 07:49 AM   Total Posts: 1192   [ # 3 ]

Now I understand.

Do you need to be able to create markers “on the fly”, i.e. based on user interaction more than once per second or so?

I think that the best solution would be to have another sphere “on top” of the earth sphere and have a fully transparent material on it, and then draw these circles to it’s texture. That way, when you draw two circles on top of each other, they won’t visually overlap like this.

It’s not entirely simple though, because of the way a sphere is UV unwrapped, so you will have to employ some math to draw the circles to your texture bitmap with proper scaling. At the equator they should be essentially 1:1, but towards the north/south poles they should be “infinitely” wide.

Note that this means that if you want to be able to draw a circle really close to a pole that will probably not work very well without full projection math (where you convert a 3D spherical projection to equirectangular.) If you don’t need to get too close to the poles, that’s probably not necessary though.

   

HankTurbo, Newbie
Posted: 24 July 2012 04:14 AM   Total Posts: 11   [ # 4 ]

Thanks mate

Yes, the circles have to expand on the fly, but probably not very often (every minute or so).

Drawing a texture seems like a good idea, rather then generating geometry as I am doing now. At the moment I don’t know if there will be restrictions on positions close to the poles or not. It probably would be good for me to try both approaches.

Could you point me in the right directions for any resources on the actual maths of drawing circles on the texure, both the “easy” and the “equirectangular” way?

Thanks heaps for your help, its much appreciated!

   

Richard Olsson, Administrator
Posted: 24 July 2012 09:05 AM   Total Posts: 1192   [ # 5 ]

Regardless of how thorough you want to be you have to relate to the fact that the sphere uses equirectangular mapping. Look at the Wikipedia article, and there is even an image there that shows how perfect circles should look when equirectangularly mapped.

http://en.wikipedia.org/wiki/Equirectangular

Just scaling them along the X axis is not entirely correct, but might be good enough for your purposes.

   

HankTurbo, Newbie
Posted: 24 July 2012 10:53 PM   Total Posts: 11   [ # 6 ]

Thanks mate, I will give it a crack.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X