Old 18th October 2003, 13:49   #1
Burningwing
Junior Member
 
Join Date: Jul 2003
Location: Sweden
Posts: 17
Question Help 3D ball

im quiet new 2 superscopes but i know the basics of 2D and try 2 learn 3D
now my question is how do i make a 3D ball i did get a circle that is moving but what 2 put in z1???
INT
n=200;r=0.5; mx=0;my=0;mx=0;dst=2;rx=0;ry=0;rz=0;rdx=1;rdy=1;rdz=1;p=3.14159265;p2=2*p;p3=180/p

onbeat
rdx=rand(3)+1;rdy=rand(3)+1;rdz=rand(4)+1;

perframe
fr=fr+0.01;mz=1+sin(fr); rx=rx+rdx;ry=ry+rdy;rz=rz+rdz; xs=sin(rx/p3);ys=sin(ry/p3);zs=sin(rz/p3);xc=cos(rx/p3);yc=cos(ry/p3);zc=cos(rz/p3);

per point

d=0.7;
x1=sin(r)*d;
y1=cos(r)*d;
z1=0;
y2=y1*xc-z1*xs; z2=y1*xs+z1*xc;
x2=z2*ys+x1*yc; z3=z2*yc-x1*ys;
x3=x2*zc-y2*zs; y3=y2*zc+x2*zs;
x4=mx+x3; y4=my+y3; z4=mz+z3;
x=x4/(1+z4/dst);y=y4/(1+z4/dst);



OBS i didet write the code only changed it a bit!!

PLS HELP ME
Burningwing is offline   Reply With Quote
Old 18th October 2003, 15:26   #2
Burningwing
Junior Member
 
Join Date: Jul 2003
Location: Sweden
Posts: 17
iv found 1 way
i=i*p;
x1=sin(i)*sin(i*30)*d;
y1=cos(i)*d;
z1=sin(i)*cos(i*30)*d;
but does it exist any other way 2 make a ball that dont look like that?
Burningwing is offline   Reply With Quote
Old 18th October 2003, 16:56   #3
Deamon
Major Dude
 
Deamon's Avatar
 
Join Date: Nov 2002
Location: Arnhem, the Netherlands
Posts: 927
I always use the way you posted the second time.

.:HyperNation @ winamp:. .:DeviantArt:.
Thermal is now available for download at DeviantArt.
Deamon is offline   Reply With Quote
Old 18th October 2003, 20:21   #4
UIUC85
Senior Member
 
UIUC85's Avatar
 
Join Date: Oct 2003
Posts: 272
well maybe if you wanted to do a geodesic sphere... but the code for that would be a pain... well in comparison to the normal sphere we use. Do you understand why that second bit of code works as a sphere?
UIUC85 is offline   Reply With Quote
Old 18th October 2003, 22:54   #5
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
Is that as in you want to know or checking if he knows?

I don't know what a geodesic sphere is [mind explaining?], but here's another way :
(parallels/*******ns, requires 2 scopes)
(stripped from UCD's Groovy Saturn, Whacko II)
(Try to understand how it works, then customize it to your liking)

Parallels :

n=261;nc=25;nm=.2;sf=1.2

red=cr;green=cr;blue=cr;
cr=1-cv;cg=1-cv;cb=1-cv;
rad=cos(mp*1.57);
py=cos(rp/nc*6.28)*rad;pz=sin(rp/nc*6.28)*rad;px=sin(mp*1.57);
x1=px*cz+py*sz;y1=py*cz-px*sz;
y2=y1*cx+pz*sx;z2=pz*cx-y1*sx;
x3=x1*cy+z2*sy;z3=z2*cy-x1*sy+2.5;
x=if(above(z3,0.1),x3/z3,x);y=if(above(z3,0.1),y2/z3*1.33,y);
rp=if(equal(cv,0),(rp+1)%nc,rp);
mp=if(equal(cv,0),mp,mp+nm);
cv=if(equal(rp,0),1-cv,0);
x=x*sf;y=y*sf;

*******ns :

n=261;nc=50;nm=.2;sf=1.2

rad=1;
px=cos(rp/nc*6.28)*rad;py=sin(rp/nc*6.28)*rad;pz=0;
y0=py*cos(mp*3.14);z0=py*sin(mp*3.14);
x1=px*cz+y0*sz;y1=y0*cz-px*sz;
y2=y1*cx+z0*sx;z2=z0*cx-y1*sx;
x3=x1*cy+z2*sy;z3=z2*cy-x1*sy+2.5;
x=if(above(z3,0.1),x3/z3,x);y=if(above(z3,0.1),y2/z3*1.33,y);
rp=if(equal(cv,0),(rp+1)%nc,rp);
mp=if(equal(cv,0),mp,mp+nm);
cv=if(equal(rp,0),1-cv,0);
x=x*sf;y=y*sf;

--

Optimize by yourself, plug in the missing parts, it's all in the life of a coder.

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 19th October 2003, 04:08   #6
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
That's old code though . Lacks some common optimizations and correct aspect ratio correction (assume 4/3 ratio).

A geodesic sphere is where you start off with one of the platonic solids, and subdivide the faces into triangles. You then project the vertices back onto a unit sphere.
When you start with an icosahedron, you can nearly-even distribution of triangles, because the amount of triangles touching at a vertex is at least 5, at most 6.

For a tetrahedron for example, you'd have vertices where only 3 triangles touch, which is a lot different from 6.

http://www.gardendome.com/spheres.JPG

On the left, an icosahedral geosphere on the right an octahedral geosphere.

Would be lots of handwork to do this in AVS because there's no easy way to automatically generate one (lack of arrays and looping).

UnConeD is offline   Reply With Quote
Old 19th October 2003, 05:06   #7
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
hello. i am atero. i have been on these forums for many moons. it is a pleasure to meet you. through much spiritual meditation and chanting of the verses of the great buddha, i have become a mean bastard, and over time you will grow to loathe me, like the british hate the united states.

on that note, stop typing like a four year old you fucking retard.


welcome to the avs forums.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 19th October 2003, 07:39   #8
uNDefineD
Senior Member
 
uNDefineD's Avatar
 
Join Date: Jan 2002
Location: Melbourne, Australia
Posts: 297
Send a message via ICQ to uNDefineD Send a message via AIM to uNDefineD
Quote:
Originally posted by Atero
on that note, stop typing like a four year old you fucking retard.
Why don't you stop acting like one?

This would be a good time to re-ask the question that you never answered a few months back: why does it bother you?

BTW, am the only one that found it rather ironic that you didn't capitalise any sentences in that post?
uNDefineD is offline   Reply With Quote
Old 19th October 2003, 08:08   #9
UIUC85
Senior Member
 
UIUC85's Avatar
 
Join Date: Oct 2003
Posts: 272
Yeah unconed that's why I mentioned the arrays in the wishlist forums lol. Not a very plausible idea, but it'd be kinda neat just for techie purposes. Nice models too
Nic01, yeah I was asking if he understood why it works.
UIUC85 is offline   Reply With Quote
Old 19th October 2003, 16:55   #10
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
well ndd, i could ask you why do my posts bother you, couldn't i...but that would be mean....

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 19th October 2003, 23:14   #11
uNDefineD
Senior Member
 
uNDefineD's Avatar
 
Join Date: Jan 2002
Location: Melbourne, Australia
Posts: 297
Send a message via ICQ to uNDefineD Send a message via AIM to uNDefineD
Because I'm fucking sick of you hanging shit on newbies just because they don't type in a way you'd prefer. Does that answer your question? Now for the third time: answer mine.
uNDefineD is offline   Reply With Quote
Old 20th October 2003, 09:48   #12
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
x1=sin(i)*sin(i*30)*d;
y1=cos(i)*d;
z1=sin(i)*cos(i*30)*d;

noone is going to care explain why it works?

well:

if you have x1=sin(i*30); z1=cos(i*30) then your scope is making a circle shaped thing on the x/z plane. only the circle is drawn more than once (looksee the *30 instead of *2pi).

then you make y1=cos(i), so that it stretches the scope along the y axis, dispersing it such that most of the circles are at near -1 and 1, and it thins out around 0 on the y axis.

then you times what you have in x1 and z1 by sin(i), that way the circle get smaller and smaller as they approach the start and end of i. (which we have just assigned to -1 and 1 on the y axis.) but they are the original size in the exact middle of i (which is 0 on the y axis)

so now what you have is a spiral shaped thing that is stretched out to form a spiraly circle.. YAAAY!

then you times all the axis by your constant d to resize evenly.

You should also times i by 2pi before all this so that you know exactly what you are coding (eg, using i*30 would then make the circle have 30 spirals exactly.)
sidd is offline   Reply With Quote
Old 20th October 2003, 14:38   #13
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
ndd, you just don't get the point do you...you can't bitch about me bitching about n00bs and their typing habits and say i'm wrong for doing it, cos you're doing the exact same thing.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 20th October 2003, 14:39   #14
Burningwing
Junior Member
 
Join Date: Jul 2003
Location: Sweden
Posts: 17
hmmm did u all forget what my question was stop geting angry in here
Burningwing is offline   Reply With Quote
Old 20th October 2003, 16:42   #15
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Atero/ndd: Mirror mirror on the wall, who's the naggiest bitch of them all?

UnConeD is offline   Reply With Quote
Old 20th October 2003, 18:42   #16
UIUC85
Senior Member
 
UIUC85's Avatar
 
Join Date: Oct 2003
Posts: 272
You guys done posting flames and fairy tale rhymes yet?
UIUC85 is offline   Reply With Quote
Old 21st October 2003, 05:19   #17
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
i was a while ago anyway i think sidd answered your question pretty clearly....

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > AVS > AVS Troubleshooting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump