Old 15th August 2003, 20:25   #121
anubis2003
Forum King
 
anubis2003's Avatar
 
Join Date: Dec 2002
Location: middle of somewhere
Posts: 5,564
Send a message via AIM to anubis2003
nur ein bisschen spricht deutsch. Ich kann es sehr wenig sprechen.
anubis2003 is offline   Reply With Quote
Old 15th August 2003, 20:54   #122
kPlanet
Junior Member
 
Join Date: Aug 2003
Location: Ger
Posts: 6
Send a message via ICQ to kPlanet
oh sorry... i didn´t know that, i also can´t speak english so well..
kPlanet is offline   Reply With Quote
Old 21st August 2003, 01:56   #123
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
Incidentally, which would be quicker for calculating pi:
"acos(-1)"
or
"6167950454/1963319607" ?

Raz is offline   Reply With Quote
Old 21st August 2003, 07:15   #124
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
well, that depends.

are you idiot enough to be calculating it on a regular basis in any given preset?

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 21st August 2003, 09:19   #125
Jaak
Major Dude
 
Jaak's Avatar
 
Join Date: Jan 2003
Location: Estonia.
Posts: 851
Pi is calculated just once... i only hope that you do calculate it in init?
fastet way: pi=3.141592654...

Phi = (1+sqrt(5))/2
Jaak is offline   Reply With Quote
Old 21st August 2003, 10:51   #126
Deamon
Major Dude
 
Deamon's Avatar
 
Join Date: Nov 2002
Location: Arnhem, the Netherlands
Posts: 927
though acos(-1) is more accurate.

.:HyperNation @ winamp:. .:DeviantArt:.
Thermal is now available for download at DeviantArt.
Deamon is offline   Reply With Quote
Old 22nd August 2003, 08:06   #127
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Not necessarily, acos(-1) would return say about 6 decimal places (dont know exaclt), but you can always use a calculator and obtain that value and write pi=3.14159265.. instead of pi=acos(-1)

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 22nd August 2003, 12:12   #128
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Yeah and it wouldn't matter one bit :P. For drawing a (-1,1) circle in a 320x320 window:

r=i*pi*2;
x=cos(r);y=sin(r);

1 pixel is 2/320 units = 0.00625

So you only need a precision of 0.003125 (half due to rounding errors) on cos and sin to guarantee a correct result.

Error-propagation theory says something like:

relative error of f(x) = (error of x)*(df(x)/dx)

Because dcos(x)/dx = -sin(x), abs(df(x)/dx) is at most equal to 1. So the relative error of cos(x) will never exceed the relative error on x.
It means that you need at most a relative error of 0.003125 for 100% accuracy in AVS.

So something like 3.1416 should make no difference from anything more accurate, for drawing circles at least. If you're doing more complicated calculations of course, more accuracy is probably needed.

UnConeD is offline   Reply With Quote
Old 22nd August 2003, 20:07   #129
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
Well if more accuracy is needed then would acos(-1) or 6167950454/1963319607 be the quickest? I know it doesn't matter much at all but i might as well have the quickest method of doing so.

Raz is offline   Reply With Quote
Old 22nd August 2003, 20:57   #130
mikm
Major Dude
 
mikm's Avatar
 
Join Date: May 2001
Location: somewhere else
Posts: 1,253
I don't see what speed has to do with it, if you put it into init, it will only calculate once, so speed won't matter.

powered by C₂H₅OH
mikm is offline   Reply With Quote
Old 22nd August 2003, 21:01   #131
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
The division should be fastest since acos contains divisions.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 23rd August 2003, 03:34   #132
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
cmon.. unless avs is a big dum dum, acos(-1) would have to be recognised by the prog. Seeing as acos requires pi anyway.
But then.. after the tidbits that steve uncovered, i wouldnt be suprised if its not.
sidd is offline   Reply With Quote
Old 24th August 2003, 07:48   #133
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
Is there any way to mimick the "rand" function but so it can be syncronised between scopes? I've tried a few different test ways and can't seem to come up with anything.

edit: i only need it so it's the quivalent of "rand(3)" but be able to syncronise.

Raz is offline   Reply With Quote
Old 24th August 2003, 16:11   #134
anubis2003
Forum King
 
anubis2003's Avatar
 
Join Date: Dec 2002
Location: middle of somewhere
Posts: 5,564
Send a message via AIM to anubis2003
Use a pseudo-random number generator. UnConeD's particle engine presets use these.
anubis2003 is offline   Reply With Quote
Old 24th August 2003, 16:42   #135
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Or use something based on getosc.

These days I use asin(sin(...)) where ... is a sum of getoscs. If you multiply the ... by a large number, you get a somewhat equal spread (if you don't need that, you can drop the asin too).

UnConeD is offline   Reply With Quote
Old 25th August 2003, 00:03   #136
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
Actually, i just need a syncronisable version of the rand(2) that would work in UnConeDs tweak of my changing tunnel. I've tried and it doesn't seem to work with it.

Raz is offline   Reply With Quote
Old 25th August 2003, 01:06   #137
anubis2003
Forum King
 
anubis2003's Avatar
 
Join Date: Dec 2002
Location: middle of somewhere
Posts: 5,564
Send a message via AIM to anubis2003
You'll have to apply some translations to it to get it to the range 0-2, and then you'll have to round it.
anubis2003 is offline   Reply With Quote
Old 25th August 2003, 02:49   #138
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
All that time messing with random number generators and the answer was right under my nose. The code had unecessary variables in it that were easily replicated. Without the rand function used.

Raz is offline   Reply With Quote
Old 26th August 2003, 08:21   #139
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
synched rand(2) would be something like.

no=abs((getosc(something)+getosc(something))*bignumber)%3;

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 26th August 2003, 11:03   #140
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Why 2 getosc functions?

[edit]
Since it's rand(2) it's clear you want 0&1, so just rnd=above(getosc,0) will do, since getosc can be both negative or positive. It will be either 0 or 1

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 26th August 2003, 11:59   #141
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
Good point tug.. and shreyas.. you method is rand(3) (prolly a typo).. rand(3) is either 0, 1 or 2 just like n%3. % is definately useful for this sort of thing in the general case though. (getosc(something)*bignumber)%n is probably the easiest way to generate a synchable rand(n). Sometimes a method like rnd=(largeprime*rnd+smallerprime)%n is more useful... like if you want to generate the same sequence of psuedorandom numbers, for example to create a starfield scope. You can use this per point and start with the same rnd every frame. Sometimes I use this method on beat except the rnd inside the statement is replaced with a var that increments every frame... this tends to give a pretty rectangular distribution.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 26th August 2003, 23:03   #142
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
Amazing how my mind comes up with all this complex crap and then when it comes to one of the simplest things it just comes out a blank.

Raz is offline   Reply With Quote
Old 27th August 2003, 05:22   #143
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
tug, shreyas

you're both idiots.


use %2 not %3.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 27th August 2003, 05:53   #144
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Like Jheriko didn't cover that part up already

fucking stupid... asswanker idiot... always groaning about shit...

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 27th August 2003, 07:53   #145
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
...well that was stupid of me...opened this up early afternoon and forgot about it...then came back...>_O

...anyway...

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 5th September 2003, 05:58   #146
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Why?
1%3=1
2%3=2
3%3=0!
4%3=1
5%3=2
6%3=0!
I think I am right.

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 6th September 2003, 00:26   #147
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
OOlrighty.. nice way of thnking about it is like this.

n%x = returns the reamainder in real terms. Or, if you prefer, its like "n minus the next lowest mulitple of x, including 0, or the current n if it is a multiple of x."

Eg.
x%1 = 0... as 1 divides perfectly into any integer.
1%2 = 1... it divides 0 times, with a remainder of 1.
45%13 = 6... 13 goes into 45, 3 times (39), with a remainder of 6.

using any form of x%a (such as x%3 in your example) will cycle between 0 and a-1, including all the integers in between (0,1,2,0,1,2,0...). The reason is easy to understand, just follow this.

0%3 = 0... it divides 0 times, and there is no remainder.
1%3 = 1... it divides 0 times, and there is a remainder of 1.
2%3 = 2... it divides 0 times, and there is a remainder of 2.
3%3 = 0... it divides 1 time, and there is no remainder.
...
40%3 = 1... it divides 13 times, and there is a remainder of 1.
41%3 = 2... it divides 13 times, and there is a remainder of 2.


make sense?

Last edited by sidd; 6th September 2003 at 00:55.
sidd is offline   Reply With Quote
Old 6th September 2003, 01:06   #148
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
sidd forgot to mention that % only returns...sensible results for positive numbers on both sides, and integers on the left side.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 16th September 2003, 15:23   #149
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
And how might i go about making avs spew a zero, then onbeat switch to 1, then onbeat switch to 2, then onbeat switch to 1 again, then onbeat to zero, etc etc. Tried for a while again, no luck.

Raz is offline   Reply With Quote
Old 16th September 2003, 22:44   #150
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
init:
add=1; btc=0;

on beat:
add=if(equal(btc,2),-1,if(equal(btc,0),1,add));
btc=btc+add;
sidd is offline   Reply With Quote
Old 17th September 2003, 14:20   #151
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
I love this forum. Many thanks sidd.

Raz is offline   Reply With Quote
Old 3rd October 2003, 08:50   #152
shabaviz55
Banned
 
shabaviz55's Avatar
 
Join Date: Mar 2002
Location: Arak, Iran
Posts: 639
Send a message via Yahoo to shabaviz55
value = value * (1-speed) + target * speed;

or

value = value + (target - value) * speed
shabaviz55 is offline   Reply With Quote
Old 3rd October 2003, 17:39   #153
gaekwad2
Foorum King
 
gaekwad2's Avatar
 
Join Date: Jul 2003
Location: bar2000
Posts: 11,360
page1
It's not answered there, though.
Is that what you wanted to say?
Then why don't you say it?
Say : There's a question on page1 that hasn't been answered.
Else it'll look like you've been randomly cutting&pasting again.
gaekwad2 is offline   Reply With Quote
Old 4th October 2003, 00:27   #154
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
im more confused than normal..
sidd is offline   Reply With Quote
Old 4th October 2003, 03:34   #155
S-uper_T-oast
Forum King
 
S-uper_T-oast's Avatar
 
Join Date: May 2003
Location: Fnord?!
Posts: 2,657
/me agrees with sidhartha
For anyone who doesn't understand ths sign(var) function, it returns 1 when var>0 and -1 when var<0 and returns 0 when var=0.
sign(.3)=1;sign(1000)=1;
sign(-.4)=-1;sign(-103)=-1;
sign(0)=0;
I am sure this was mentioned somewere else, but I just finally figured that all out for myself.
S-uper_T-oast is offline   Reply With Quote
Old 4th October 2003, 21:54   #156
Deamon
Major Dude
 
Deamon's Avatar
 
Join Date: Nov 2002
Location: Arnhem, the Netherlands
Posts: 927
thx, didn't knew that.

.:HyperNation @ winamp:. .:DeviantArt:.
Thermal is now available for download at DeviantArt.
Deamon is offline   Reply With Quote
Old 16th October 2003, 08:32   #157
gaekwad2
Foorum King
 
gaekwad2's Avatar
 
Join Date: Jul 2003
Location: bar2000
Posts: 11,360
A few people asked for per pixel code in Color Modifier, this can be done easily by
putting a Buffer Save before Cmod (save&replace) and a "no movement just blend" DM with that buffer as input after it.
gaekwad2 is offline   Reply With Quote
Old 18th October 2003, 10:42   #158
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
I found an interesting trick with a texer...

Make a greyscale picture that looks like a cloud (I stole a quake3 sky texture and faded out the edges) then make a 3d ssc with an 'n' value of about 10-20, colour it how you like, use the (masked) cloud texture as a texer and tada, easy cool looking fog.

Looks impressive over raytraced stuff if you sync the ssc.
PAK-9 is offline   Reply With Quote
Old 19th October 2003, 02:24   #159
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
s-t: actually, no it doesn't. it tries really hard but it never works. i used to have a lot of trouble with it cos for some reason it didn't always return the right numbers. i recently realized (thanks to the help of regwatch) that it returns slightly less than 1 or -1, so this sort of thing happens:
equal(sign(1)*10,10)==0
i don't know exactly how to make it work perfectly, but i do know that if you use abs(x)/x it returns the sign of x correctly.

"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, 10:09   #160
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
thanks atero..
thats really useful
perhaps you should suggest this to justin while developments are underway.

That abs(x)/x will probably come in handy at some stage.. tho i cant think of what for at the moment.
sidd is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Visualizations > AVS

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 On
HTML code is Off

Forum Jump