Archived

This topic is now archived and is closed to further replies.

Algo needed: how to store pixels on a cube

This topic is 6113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Out There ! as the title indicated i am searching for an algorythm that can store pixels on a [EDIT]SPHERE[/EDIT]. and now as you are reading this, i hope you can help me ;-) for example i could use quadrat and project this on my [EDIT]SPHERE[/EDIT]. the problem with this is, that i have a higher resolution at the "poles" and a lower resolution at the "equator" however i am searching for a way, where i have nearly the same resolution overall around the [EDIT]SPHERE[/EDIT]. i could use a "circle" and projekt that circle on my [EDIT]SPHERE[/EDIT], but i'm not sure whether that is the best way... any help/idea is appreciated ! (and i hope i could express myself, so you know what i mean ) ___________________________________________________ THAT was it ??? Edited by - Loradim on March 20, 2001 2:29:19 PM

Share this post


Link to post
Share on other sites
I know this won''t help, but it may help us understand better your question. Why can''t you just use a bitmap-like pixel array for each of the cube''s faces ?

Share this post


Link to post
Share on other sites
now i saw the problem.. i am so stupid.. never write english if you are not born english.. lol.. i didn't meant a cube, but a SPHERE !!! damn, sorry !


allright, here's a pic:



on the left side you see how the surface is stored in the memory. on the right side you see how this is displayed on the screen (a bad pic, i know ;-))

PLEASE NOTE: that one of the colored area's on the left side is not only one single pixel but for example 16x16 pixels... if you look how they are transformed from the left (memory) to the right (screen), you see, those area's in the middle are transformed into a large area on the sphere, while the regions at the top or bottam are transformed into a small area. with this i get different resolutions, and that is the thing i don't want to happen. i would like to have (nearly) the same resolution overall around the sphere. any ideas ?

____________________________________________________________
THAT was it ???


Edited by - Loradim on March 20, 2001 2:23:49 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Just store the data in 6 arrays, like you would for a cube, and distort the data to fit the sphere. There will be distortion, but not nearly as much as 1 array using cylindrical mapping.

Share this post


Link to post
Share on other sites
Found out I dont know to post pictures , so I'll have to use good old ascii. Your sphere's surphace is divided by horizontal circles (like the equator) and vertical ones (meridians). If you cut the sphere along the meridians (like a mellon), you'll get some shapes that are wide near the equator and get narrower till at the top they become a point. Your problem is that you try to approximate these shapes with a rectangle, which, obviously, doesn't get narrow towards the poles. But what geometric shape does ? The triangle. True, if you sliced a plastic ball like a mellon and you put the resulting pieces in a plane, they look like triangles. This approximation gets more exact with the number of meridians.


So, the sphere cut along the meridians (I'll only cut it every other meridian, I'll explain why later) and put on a table would look like this :

+++++^++++++++++^++++++++++^++++++++++^+++++
++++/|\++++++++/|\++++++++/|\++++++++/|\++++
+++/a|b\++++++/c|d\++++++/e|f\++++++/g|h\+++
++/_____\++++/_____\++++/_____\++++/_____\++
+/iii|jjj\++/kkk|lll\++/mmm|nnn\++/ooo|ppp\+
/iiii|jjjj\/kkkk|llll\/mmmm|nnnn\/oooo|pppp--------------------------------------------
\qqqq|rrrr/\ssss|tttt/\uuuu|vvvv/\wwww|xxxx/
+\qqq|rrr/++\sss|ttt/++\uuu|vvv/++\www|xxx/+
++\-----/++++\-----/++++\-----/++++\-----/++
+++\y|z/++++++\1|2/++++++\3|4/++++++\5|6/+++
++++\|/++++++++\|/++++++++\|/++++++++\|/++++
+++++v++++++++++v++++++++++v++++++++++v+++++
You could probably just store this triangle textures in memory. But as it happens the lower triangles fit perfectly betwen the upper triangles.

_________________________________________________
|xxxx/|\qqqq|rrrr/|\ssss|tttt/|\uuuu|vvvv/|\wwww|
|xxx/a|b\qqq|rrr/c|d\sss|ttt/e|f\uuu|vvv/g|h\www|
|__/_____\__|__/_____\_____/_____\_____/_____\ _|
|6/iii|jjj\y|z/kkk|lll\1|2/mmm|nnn\3|4/ooo|ppp\5|
|/iiii|jjjj\|/kkkk|llll\|/mmmm|nnnn\|/oooo|pppp\|
|-----------------------------------------------|


I cut every other meridian so that I can split the "wx56" triangle in two, so that the final texture will be rectangular without holes.

The final texture is half the size of the initial square texture.

Edited by - Diodor on March 20, 2001 7:36:28 PM

Share this post


Link to post
Share on other sites
thank you for your reply''s !

Anonymous Poster: i am sure this might work, but i am afraid this will be a bit to difficult to make it fit into what i am working on. but i''ll keep it in mind, and if my concept won''t work i''ll try yours ;-)

Diodor: this should be easier to include into my code. thx for your work with the ascii-code. now i''ll tell you how you can include picture''s in your posts. took me quite some time to find out, cause i thought it would be somekinda UBB-code.. but it is stupid html instead. *g*

to include a picture, upload it to a server and include this code into your post, but change "[" to "<" and "]" to ">".

[img src="http://your.domain.com/path_to_pic/pic.gif"]

i''ve some vacation days now, so i hope i''ll get a first demo of of my idea running till the weekend is over. if interested, i''ll keep you informed.


____________________________________________________________
THAT was it ???

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Glad I could help. I''ll check the announcement forum for your demo. Oh, and thanks for the image tips. Now I can break the worse pic records.

Share this post


Link to post
Share on other sites