Winamp & Shoutcast Forums > AVS Tips&Tricks in AVS
 User Name Remember Me? Password

 Thread Tools Search this Thread Display Modes
 15th August 2003, 21:25 #121 anubis2003 Forum King     Join Date: Dec 2002 Location: middle of somewhere Posts: 5,564 nur ein bisschen spricht deutsch. Ich kann es sehr wenig sprechen. [Over The Monkey] | [My DeviantArt] | [Seti] | [Atmo Digital Design Forums]
 15th August 2003, 21:54 #122 kPlanet Junior Member   Join Date: Aug 2003 Location: Ger Posts: 6 oh sorry... i didn´t know that, i also can´t speak english so well..
 21st August 2003, 02:56 #123 Raz Forum King     Join Date: Dec 2002 Location: Manchester Posts: 6,470 Incidentally, which would be quicker for calculating pi: "acos(-1)" or "6167950454/1963319607" ?
 21st August 2003, 08:15 #124 dirkdeftly Forum King     Join Date: Jun 2001 Location: Cydonia, Mars Posts: 2,651 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
 21st August 2003, 10:19 #125 Jaak Major Dude     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
 21st August 2003, 11:51 #126 Deamon Major Dude     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.
 22nd August 2003, 09:06 #127 shreyas_potnis Major Dude     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
 22nd August 2003, 13:12 #128 UnConeD Whacked Moderator     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.
 22nd August 2003, 21:07 #129 Raz Forum King     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.
 22nd August 2003, 21:57 #130 mikm Major Dude     Join Date: May 2001 Location: somewhere else Posts: 1,255 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
 22nd August 2003, 22:01 #131 jheriko Forum King     Join Date: Aug 2002 Location: a twist in the fabric of space Posts: 2,150 The division should be fastest since acos contains divisions. -- Jheriko 'Everything around us can be represented and understood through numbers'
 23rd August 2003, 04:34 #132 sidd Major Dude     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.
 24th August 2003, 08:48 #133 Raz Forum King     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.
 24th August 2003, 17:11 #134 anubis2003 Forum King     Join Date: Dec 2002 Location: middle of somewhere Posts: 5,564 Use a pseudo-random number generator. UnConeD's particle engine presets use these. [Over The Monkey] | [My DeviantArt] | [Seti] | [Atmo Digital Design Forums]
 24th August 2003, 17:42 #135 UnConeD Whacked Moderator     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).
 25th August 2003, 01:03 #136 Raz Forum King     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.
 25th August 2003, 02:06 #137 anubis2003 Forum King     Join Date: Dec 2002 Location: middle of somewhere Posts: 5,564 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. [Over The Monkey] | [My DeviantArt] | [Seti] | [Atmo Digital Design Forums]
 25th August 2003, 03:49 #138 Raz Forum King     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.
 26th August 2003, 09:21 #139 shreyas_potnis Major Dude     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
 26th August 2003, 12:03 #140 Tuggummi Bin King     Join Date: Mar 2001 Location: Finland Posts: 2,173 Why 2 getosc functions?  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...
 26th August 2003, 12:59 #141 jheriko Forum King     Join Date: Aug 2002 Location: a twist in the fabric of space Posts: 2,150 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'
 27th August 2003, 00:03 #142 Raz Forum King     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.
 27th August 2003, 06:22 #143 dirkdeftly Forum King     Join Date: Jun 2001 Location: Cydonia, Mars Posts: 2,651 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
 27th August 2003, 06:53 #144 Tuggummi Bin King     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...
 27th August 2003, 08:53 #145 dirkdeftly Forum King     Join Date: Jun 2001 Location: Cydonia, Mars Posts: 2,651 ...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
 5th September 2003, 06:58 #146 shreyas_potnis Major Dude     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
 6th September 2003, 01:26 #147 sidd Major Dude     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 01:55.
 6th September 2003, 02:06 #148 dirkdeftly Forum King     Join Date: Jun 2001 Location: Cydonia, Mars Posts: 2,651 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
 16th September 2003, 16:23 #149 Raz Forum King     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.
 16th September 2003, 23:44 #150 sidd Major Dude     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;
 17th September 2003, 15:20 #151 Raz Forum King     Join Date: Dec 2002 Location: Manchester Posts: 6,470 I love this forum. Many thanks sidd.
 3rd October 2003, 09:50 #152 shabaviz55 Banned     Join Date: Mar 2002 Location: Arak, Iran Posts: 639 value = value * (1-speed) + target * speed; or value = value + (target - value) * speed
 3rd October 2003, 18:39 #153 gaekwad2 Foorum King     Join Date: Jul 2003 Location: bar2000 Posts: 11,410 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.
 4th October 2003, 01:27 #154 sidd Major Dude     Join Date: May 2003 Location: Australia Posts: 1,353 im more confused than normal..
 4th October 2003, 04:34 #155 S-uper_T-oast Forum King     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.
 4th October 2003, 22:54 #156 Deamon Major Dude     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.
 16th October 2003, 09:32 #157 gaekwad2 Foorum King     Join Date: Jul 2003 Location: bar2000 Posts: 11,410 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.
 18th October 2003, 11:42 #158 PAK-9 Major Dude     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.
 19th October 2003, 03:24 #159 dirkdeftly Forum King     Join Date: Jun 2001 Location: Cydonia, Mars Posts: 2,651 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
 20th October 2003, 11:09 #160 sidd Major Dude     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.
 Winamp & Shoutcast Forums > AVS Tips&Tricks in AVS
 User Name Remember Me? Password

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Tech Support Greatest Hits Winamp     Winamp Technical Support     Winamp Discussion     Winamp Wishlist     Winamp Bug Reports     Winamp for Android     Winamp Site Design Shoutcast     Shoutcast Technical Support     Shoutcast Discussions     Shoutcast For Business & Monetization     Shoutcast Site Design International Connection     International Connection     Русскоязычный форум (Russian)     Français: de l'aide pour les francophones (French)     Winamp Deutsch (German) Community Center     General Discussions     Breaking News     Music O'Rama     Games Center     Movies and Television     The Bitchlist Skinning and Design     Skinning Tips and Tricks     Classic Skins     Modern Skins     Arts and Design Developer Center     Winamp Development     NSIS Discussion         NSIS Translations Visualizations     AVS         AVS Presets         AVS Wishlist         AVS Troubleshooting     MilkDrop         MilkDrop Presets         MilkDrop Development         MilkDrop Feature Requests         MilkDrop Troubleshooting Forum

 -- Deutsch -- English (US) -- Polish -- Russian Winamp.com - Help - Archive - Top