Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to texturemap a ball?
#11
The problem with a single texturemap is it should be a square: the projection of the sphere in a cylinder. The scale would increase from equator to poles.The pole points would become a full side of the map. If the poles are not shown, as in the Earth demo, this is not a problem. But if the poles move randomly, the formulae to rescale the map would become very complicated...
Antoni
Reply
#12
Funny. I'm also making a game with balls. I gave up on such complicated ball rolling animations. I'm using a trick with 3 ball sprites which kinda emulate rotation when you scroll thru them. It doesn't give a great effect since it's same for any direction but that's better than nothing.
Reply
#13
Well, 3 sprites are really too few.But emulating rotation around 3 axis with sprites would need a zillion of them...
Antoni
Reply
#14
why deal with pole points and all of that? you dont have to rotate the spheremap, just scroll the texture itself. The spheremap never changes except for scaling. I'll make an example in a second.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#15
Toonski: Maybe I'm having a wrong idea about all this.
I'm looking forward for your demo. Remember I don't want the poles to remain quietly at the border of the circle...
Antoni
Reply
#16
i'll use rel's 9-line demo for lack of a better immediate example. but just notice that the lens code is always the same, but it rotates as it moves around the screen, because the texture is changing. just scroll the texture left/right to rotate around the x axis, scroll it up/down to rotate around the y axis, and rotate the texture clockwise/counterclockwise to rotate around the z axis. The only problem i see here is actually scaling it, but you might be able to scale the table coordinates itself in that situation.

Code:
'"The Lens" by Relsoft
'Relsoft.ath.cx
1 SCREEN 13
2 IF xx% = 0 THEN xx% = 3 + INT(RND * 260) ELSE IF xv% = 0 THEN xv% = -1 + INT(RND * 2)
3 IF (xx% <= 1 AND xv% < 0) OR (xx% >= 319 AND xv% > 0) THEN xv% = -xv% ELSE xx% = xx% + xv%
4 yy% = 100 - ABS(SIN(((xx% * 3) * 3.141593 / 180))) * 160
5 FOR yt% = 0 TO 99
6 FOR xt% = 0 TO 99
7 IF (((xt% - 50) * (xt% - 50)) + ((yt% - 50) * (yt% - 50))) < (2500 - 900) THEN PSET (xx% + xt%, yy% + yt%), (((((((20 - SQR(2500 - (((xt% - 50) * (xt% - 50)) + ((yt% - 50) * (yt% - 50)))))) * ((xt% - 50) / SQR(2500 - (((xt% - 50) * (xt% - 50)) + ( _
(yt% - 50) * (yt% - 50))))))) + xt% + xx%) AND 15) OR (((((20 - SQR(2500 - (((xt% - 50) * (xt% - 50)) + ((yt% - 50) * (yt% - 50)))))) * ((yt% - 50) / SQR(2500 - (((xt% - 50) * (xt% - 50)) + ((yt% - 50) * (yt% - 50)))))) + yt% + yy%) AND 15)) + 16  _
ELSE PSET (xx% + xt%, yy% + yt%), 0
8 NEXT xt%, yt%
9 IF INKEY$ = "" THEN 2
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#17
scaling it would reaaaallllly make it slow.

Sqrs arghhhhh!!!!!
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#18
not necessarily. if it was indeed a table it would be a matter of scaling the table. so you'd scale 2 bitmaps and proceed with the table as planned.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#19
Let me try it...
I will do a demo with a "lens" ball and a mesh ball, just to compare...
Antoni
Reply
#20
Can't wait dude can't wait.

BTW, Beckham went to Madrid. LOL
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)