PDA

View Full Version : 3d sphere

Phaze1987
7th February 2003, 20:30
Hey :)
I have searched the forums and i came up with several presets containing code to make a sphere...None of them was too great so i was wondering if you can tell me the simplest way to make one :) I`ve seen movements that create a sphere from a simple scope and scopes recreating the effect but i didnt like it.You need pi in the ecuation right ?

anubis2003
7th February 2003, 21:00
The easiest way to create a sphere is to create a spiral on the xz plane, but have the y variable change from -r to r. This will create the sphere that looks like a coil that starts small at the top, gets big in the middle, and gets small again at the bottom.

UnConeD
7th February 2003, 22:47
If you make a spiral like that, you should have an equal spread across the surface, not have the y var increase linearly.

dirkdeftly
7th February 2003, 22:48
parameterization for a sphere:
x=sin(theta)*sin(phi);
y=cos(theta)*sin(phi);
z=cos(phi);
where theta and phi are angles. this gives you a point on the sphere, gravitating towards two poles...anyone know of any way to make a randomly-generated point sphere that doesn't do this?

Zevensoft
8th February 2003, 23:11
Create a 3D box of points, then normalize each one to the radius required.

Phaze1987
9th February 2003, 20:31
Thanks for your ideas...Im working on a scope right now to make a 3d sphere that moves...I believe it will replace a dm with success :) Now another small question : is theta recognised by AVS ? i saw a preset with theta and it had no value in init or anywhere else...

anubis2003
9th February 2003, 20:43
No its not recognized by avs. Are you sure it wasn't used in x=... or y=...? Variables don't have to be initialized - they default to zero.

Phaze1987
9th February 2003, 20:46
It was in x=... I`ll try to look it up in my preset library hehe.Except x,y,d,r and all that crap are there some other variables avs have incorporated ?

anubis2003
9th February 2003, 20:47
Search the forums. This has been adressed. Probably somewhere in the FAQ. Also, look below the per pixel box. It tells you all of the variables there.

Phaze1987
9th February 2003, 20:53
I have that forum thread with variables saved :) I meant unknown variables as in easter eggs or hidden in the code...like pi(i hope avs would contain it...writing pi=acos(-1) everytime is boring).

anubis2003
9th February 2003, 21:27
No, there are no easter egg variables in AVS. They didn't document a couple of functions, though. atan2(x,y) and another one(can't remember what it is). These have also been mentioned in the forums. Use the search feature.

dirkdeftly
10th February 2003, 01:03
the other one is:
exp(var)::e^var
as in the inverse of:
log(var)::ln var

anubis2003
10th February 2003, 01:06
Thanks Atero. I'd forgotten that one as I never use it(or log for that matter).

Zevensoft
10th February 2003, 05:05
Something that is stupidly missing though is a Base X log of Y function. They should implement a Log2(x,y) that should be is the same as: Log Y / Log X

UnConeD
10th February 2003, 07:58
Zevensoft, there's no point in that really, because your CPU calculates it exactly the same way. An x86 cpu can only take base-2 logarithms.

Any other logarithm is calculated as log2(y) / log2(x).

Phaze1987
11th February 2003, 10:39
Thanks for your tips...Im working on a superscope trying to recreate a sphere :) I want to make a big big one change into dots and make it move.I`ve seen it several times and its amazing how it goes :) Btw...does AVS have any easter eggs at all ?

anubis2003
11th February 2003, 11:34
No, just two functions that aren't documented - atan2(x,y) and exp(x).

WHCode RED
14th February 2003, 16:03
I dont know who made this, but it was on my comp... maybe it could help?

Phaze1987
16th February 2003, 19:47
Thanks for the file but i already have it :) Im trying to figure it out and i dont understand why the creator used such big numbers when i modified the preset and it work with smaller numbers too...

anubis2003
16th February 2003, 20:39
He used bigger numbers to create a better random number generator.

WHCode RED
16th February 2003, 21:22
Now that i think about it.. I think it was made by UnConeD but im not 100% sure.. actually i'm not sure at all, but I get this feeling it was.

I'm not saying im physcic or anything..

Jaheckelsafar
17th February 2003, 04:19
Yeah, that was UnConed.