- AVS
- where can i find some simple super scope examples?circles and lines simple.
Archive: where can i find some simple super scope examples?circles and lines simple.
stayin_stoned
24th April 2002 07:17 UTC
where can i find some simple super scope examples?circles and lines simple.
im pretty new to avs so any help is appreciated. I dont under stand the super scope very well yet and i learn best by looking at an example, but most examples i find are to complex for me to understand yet.if anyone could provide a few simple examples it would help alot. i have made a few unique but weak ass presets if you want to see them, email me at skater348@attbi.com.
Jaheckelsafar
24th April 2002 09:49 UTC
Okay, quick superscope.
init:
n=200;
per pixel :
x=2*i-1;
y=v
That makes a horizontal line that reflects what the spectrum data (I think) looks like.
i = point on scope, ranges from 0 to 1
v = value for any given point, ranges from -1 to 1
x = x :)
y = y :)
After that, it's just messing 'till you come up with something nice.
---------------
Zip your presets up and post them in the sub forum. Get critiqued and recieve suggestions.
NoSage
27th April 2002 05:16 UTC
circle:
Init:
n=50
per point:
x=cos(i*6.283);
y=sin(i*6.283)
this renders a circle with a midpoint of (0,0) and a radius of 1. To scale it down, mutliply the x and y by a decimal...
x=cos(i*6.283)*.5;
y=sin(i*6.283)*.5
then you can change the midpoint by simply adding or subtracting...
x=cos(i*6.283)*.5+.15;
y=sin(i*6.283)*.5-.5
:winamp:
Nic01
27th April 2002 18:32 UTC
Another circle :
Init : n=500;pi=acos(-1)
Point :
x=sin(i*pi*2);
y=cos(i*pi*2)
This makes a circle which touches the edges of the screen.
You can add dividing sign at the end of the appropriate line and also put in an appropriate number to make the circle smaller.
To change location, simply use + or - sign.
Note the "n" value - it is the number of points - you might want to change it into smaller number while the SSC still resembles a circle.
How to put a dynamically moving SSC, with the diameter of 1/5 of the screen :
PerFrame : t=t+0.1;
Perpoint :
x=sin(i*pi*2)/5+sin(t);
y=cos(i*pi*2)/5+cos(t);
Now the SSC moves in circular pattern.
How to make solid circle, w/o movement (1/5 size, like the moving one) :
Init : pi=acos(-1);n=w*pi/5
PerPoint :
x=sin(i*pi*2)/5*s;
y=sin(i*pi*2)/5*s;
s=bnot(s);
There! You have a solid circle (Though slows down AVS quite nicely...)
You might want to add misc/rendermode to set the line width, in case it isn't solid.
You can also do *(s+getosc(0,0.1,0)) in each line instead of *s for a little funky thing =)
Good luck in yar SSC making career! (And especially good luck for AVS making career)
Artists that I'd recommend to ask for about SSC :
Nixa - In his/her :p preset named "Lots of Spirals" (Or something like that) It looks somewhat basic-ish. But if you dig in the preset, you'll realize that all six spirals are drawn using only 1 SSC.
I hadn't tried to decode the SSC - Quite dense of a code in it =)
But then, I think I can make one using a different way...
El-Vis - Need I say more? He made a ton of 3d SSCs!
UnConeD - This one don't need an explanation, either. If you do, download his 4th pack, and try the preset "All Neon-Like".
Everything in that preset are SSCs (Except for the needed buffer safe...).
Even the STARS are SSC! (Synchronicity is essential, ya know - creates realism)
The various AVS artist on the board - They're helpful, trust me =)
Me! - :p
Just PM one of us, and we'll help :D
NoSage
27th April 2002 19:42 UTC
Also to make a perfect circle, not oval, I divide x and y by (w*s) and (h*s) where as s invertedly equals the size of the render and w is the width and h is the height.
Init:
n=400; s=.015
Per point:
x=(cos(i*6.28)/(w*s));
y=(sin(i*6.28)/(h*s))
now the shape will stay circular even though the avs box could be rectangular, the only thing is division is slower than muliplication.
so use this
Init:
n=400; s=.015; xa=1/(w*s); ya=1/(h*s);
Per point:
x=(cos(i*6.28)*xa);
y=(sin(i*6.28)*ya);
ok I'm going to sleep, dont know if any of this actually does something, but mess with it.
UnConeD
28th April 2002 01:12 UTC
To correct the aspect ratio, you only need to multiply either x and y by w/h or h/w... saves one multiplication :). Might be useful when you need to squeeze out every frame per second you can get.
Nic01
28th April 2002 16:16 UTC
A tip for both you and NoSage :
In the init, type "pi=acos(-1)"
This way, you can save your mind from remembering those numbers - You can replace 6.28(It's actually longer than that) with pi*2...
____
You can make Solid SSC by either using "s=bnot(s)" or linewidth, but the "s=bnot(s)" conforms to any form of SSC... It slows down AVS more tho...
UnConeD
28th April 2002 18:20 UTC
Here's a better explanation of the solid superscope principle... Nic01 got the main trick across, but failed to explain the whole idea:
A Superscope can only draw lines or dots. So, to draw a solid shape, you need to draw a lot of lines that overlap just enough. The reason you can use something like s=bnot(s), is because it performs a binary 'not' operation. This means 'true' becomes 'false', and 'false' becomes 'true', so the variable s alternates for every point.
Knowing that, you can write a superscope that draws a regular line, and add a shift to the 'y' coordinate based on 's'. For example:
x=i*2-1;
y=if(s,.5,-.5);
s=bnot(s);
Now you have a solid rectangle (given that 'n' and/or line width is high enough).
Another thing that I just thought of, is that AVS draws vertical and horizontal lines much faster than sloped ones. If you look at the above code for low 'n' values (n < 100), you can see that the result consists of sloped lines.
If you replace the code with this, half of them become vertical, and it should provide a minor speedup. Not sure exactly how much, but anything is something :). Though optimizing more complex SSC's to draw like this should be *quite* a difficult task.
onframe: x=-1;
onpoint:
xx=i*2-1;
x=if(s,xx,x);
y=if(s,.5,-.5);
s=bnot(s);
stayin_stoned
29th April 2002 08:44 UTC
thanks,you guys were lots of help
I post what came of yuor help in the avs presets forum, check em out! and thanks again, the winamp community is great.
NoSage
30th April 2002 18:11 UTC
Actually nic01, i try to stay away from acos(-1) because it equals 3.14159265... which is alot more numbers for avs to calculate than 3.1415 and unless the render needs to be extremely accurate, i think it can speed it up a tad.
As for the booleans there is only 'and' 'or' 'not'. what about the four others 'nor' 'nand' 'xor' 'xnor'. and the power of them.
nor= 0011 nand= 0011 xor= 0011 xnor= 0011
0101 0101 0101 0101
---- ---- ---- ----
1000 1110 0110 1001
to learn more click here
good day my freinds...
NoSage
30th April 2002 18:13 UTC
ahhhh glitch, oh well, go to site.
UnConeD
2nd May 2002 21:13 UTC
Nosage: sorry but your theory about 3.14 being faster than 3.1415... is not right, AVS uses the same floating point type for all its data (not sure if it's 32-bit or 64-bit types). And a CPU multiplies (1.5 * 2.5) just as fast as (1.3543411111 * 2.659533).
And of course, a CPU uses binary, so a fraction is made by summing negative powers of 2 (.5, .25, .125, .0625, ...), just like we use negative powers of 10 (.1, .01, .001, ...).
Just like we can't write 1/3th in decimal (the digits go on and on), other straight-forward fractions can't be represented by a finite number of digits in binary.
Fractions are weird. For example: 0.9999999999... = 1
x = .999999...
10x = 9.99999...
10x = 9 + x
10x - x = 9
9x = 9
x = 1
:) :D
As far as the boolean operations go, you can construct nand and nor routines by using a combination of AND/OR/NOT, as the article says :).
NoSage
3rd May 2002 13:59 UTC
just wondering, then why would division be slower?
Jaheckelsafar
3rd May 2002 16:12 UTC
It's got to do with the number of conversions required to covert it to addition and subtraction (which is all a computer can do really). Multiplication is easy (c=c+a b times), division is significantly more complicated, and I don't feel like digging through my math notes to find it. (heck, I don't feel like fiding my notes)