Old 3rd December 2002, 18:49   #41
VisualAgnosia
Senior Member
 
VisualAgnosia's Avatar
 
Join Date: Nov 2002
Location: Australia
Posts: 190
Cant say I actually expected that !
VisualAgnosia is offline   Reply With Quote
Old 3rd December 2002, 19:13   #42
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Atero: if you don't have anything constructive to add to someone's question, shut up please.

VisualAgnosia: the superscope is just a drawing tool... you give it (x,y) coordinates on the screen with a color if you wish.

So if you want to plot a graph of a function z=f(x,y), you'll first need to write code that traverses a grid of points in 2D rectangle, then calculates the z value for that point and then transforms the point with perspective.

The best way to do this is not to use the 'i' counter in the superscope, but make your own counters. For example, this draws a simple 20x20 grid:


init:
n=400;

per frame:
t=t-.05;px=0;py=0;ct=cos(t);st=sin(t);

per point:
gx=(px/19)*2-1; gy=(py/19)*2-1;
gz=-exp(-(sqr(gx)+sqr(gy))*4)*3+1.6;
x1=gx*ct-gy*st;y1=gx*st+gy*ct;
x=x1/(y1+3);y=gz/(y1+3);
px=if(below(px,19),px+1,0);
py=if(equal(px,0),py+1,py);
red=if(equal(px,1),0,1);green=red;blue=red;


There's a lot going on here, so I'll dissect it:

First, we have 400 points on our grid, so we set n to 400.
We'll be rotating the grid around, and we'll use 't' as the angle, which is decreased every frame by 0.05 radians. We also calculate the cosine and sine of the angle in the frame routine so we don't have to calculate it again every point, for speed reasons.
We'll be traversing a 20x20 grid, and we'll store the current grid point in (px,py). px and py will take on the values 0-19 (20 points), first x then y. We start at (0,0).

Per point, we transform (px,py) (between (0,0) and (19,19)) into (gx,gy) a point between (-1,-1) and (1,1). This is done by dividing by 19, multiplying by 2 and subtracting 1 (this piece can be done faster if we merge everything into one multiplication + add/sub, but this is easier to understand):
code:

/19 *2 -1
0..19 -> 0..1 -> 0..2 -> -1..1



Next, we calculate 'gz' based on gx and gy. I use exp(-(sqr(gx)+sqr(gy))) which is an exponential 'hump' the shape of the normal gaussian distribution. We multiply it by 3 and add 1.6 to make it fit in the AVS window.

Next we rotate (gx,gy) by t radians, so that we get the point (x1,y1). We now use x1 as the x-coordinate, gz as the y-coordinate (z points up) and y1 as the depth coordinate (y points into the screen). We transform it into perspective by dividing (x,y) by z (plus a camera offset of 3).

Now all we need to do is make sure (px,py) traverse the values 0-19. First, we check per point if px is smaller than 19: if so, we add 1. If px equals 19, we reset it back to zero. If px equals zero, we increase py by 1.
This has the effect of traversion one row on the grid, and when we reach the end, we go to the next row and start over.
code:

0 1 2 3 4 5 18 19
. . . . . . ..... . . |
. . . . . . ..... . . |
----------> \|/
v



And finally there's a little extra: AVS draws the superscope as one chain of line segments. This means that there will be a connecting line between the different rows, which is not what we want. So, we set the color to black for that certain line segment, and white for all the rest: if you use additive or maximum blending, the black lines won't show up.

Tadaa... you now have a rotating plot.
You could duplicate the scope and reverse the meaning of gx and gy in the second copy, that way you get a grid of lines. Make sure you reload the preset to synchronize the two scopes... (result is attached)

So you see if you want to plot a graph, you have to do *everything* yourself.
Attached Files
File Type: zip plot.zip (395 Bytes, 873 views)

UnConeD is offline   Reply With Quote
Old 3rd December 2002, 19:45   #43
VisualAgnosia
Senior Member
 
VisualAgnosia's Avatar
 
Join Date: Nov 2002
Location: Australia
Posts: 190
Awsome

Well I didn't expect that either ...

Thats quite a conecise explantation, Totaly get it..mind you I'm gonna print it out and study it like I have with 10 or so other wicked posts I've found. I'm getting a bit of a progression thing happening... from a couple days ago I'm getting more and more things undercontrol... still a long way to go. As it goes it's just a matter of sticking with it and "Dreaming new ideas"

A bit of props for AVS

--- Studing maths.. which I find interesting usually.. To use something with a straight away effect on visuals in such a dynamic flow of colour and music... Somehow's effected the time I spend studying by three fold --- weird???

Thanks for the effort again UnConeD.
you've helped yet ANOTHER potential AVSer bridge another gap


A note to other neewuubies like me have a look the load example superscopes, the code in there will give some indication as to the layout of the code. B4 you wrote this last post UnConeD I was resorting to the 3D layout they had going on in there.

Peace

VIsAG
VisualAgnosia is offline   Reply With Quote
Old 13th March 2003, 07:20   #44
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Tips and Tricks 2

Tuggummi started the first one, but that was long ago. I am sure there will be many new tricks (and Tips).
Just post them here,
Here's one:

when the amount of ssc's is quite large then cramp all of these into one.:
eg:

code:
init:
n=1000;a1=1/(499-1);vrem=n/10;pi=acos(-1);tpi=acos(-1)*2
point:
cp=bnot(cp);cn=cn+1;i1=i1+a1;colc=bnot(equal(cn,501));
trans=above(cn,500);v1=if(bnot(cn%vrem),v,v1+abs(v/10));
d=if(cp,1+v1*0.2,.98);th=t+i1*tpi; outx=sin(th)*d*r;outy=cos(th)*d*r;
inx=bnot(cp)*sin(th)*.3;iny=bnot(cp)*cos(th)*.3;
x=if(trans,outx,inx)+ox;y=if(trans,outy,iny)+oy;
red=colc;green=colc*.5;blue=0;
frame:
fr=fr+.01;t=t+ti*.1;ti=ti*.8;r=.4;cn=0;i1=0;ox=sin(fr)/2;oy=cos(fr)/2
beat:
ti=1;r=.5;hu=rand(618)*.01;fr=fr+sin(t*hu)



the trick is to draw everything in one ssc and then blacken out the point connecting the two objects.
then use a maximum or addictive blend to hide the trick

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 14th March 2003, 07:06   #45
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Quote:
Originally posted by Nic01
Shreyas : How about posting that code and explaining the code step by step?

On the other hand, colormaps can be used to replace a few colorclips. As long as the colors are not too close together, you can just use 2 of the same color and use a bounding box to make sure you get the right color.
I have done that thing to improve the speed, colourmaps and clips do the opposite!
i have already explained a bit of the code,but here's a detailed one.

set cn=cn+1 in point, this will increase value of cn every point, an ideal way to count the number of the point.

then use custom i values,
this is what i figured out:
incrementation value of i is inversely proportional to (n-1).
so, if n=10; then
after every point : i=i+1/(n-1);
i.e i=i+1/9;
i.e i=i+0.111111111111111111111111111111111.
so if you draw a circle using i1 instead of i when cn is less than 10 and then draw some other object when cn>10, then blacken out the point joining the two objects, you get two separate objects.

I hope you understood atleast some part of this, because I find it hard to explain things, especially complicated ones. if you cant figure out what this means, then maybe i will write an essay on this topic, after thinking hard and selecting my words

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 14th March 2003, 12:39   #46
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
long essay

This one is all about the 2 in 1 scopes, I wrote all this when I was offline in notepad and then posted it here:
the previous two explainations just explained the concept, now here's the explaination of the actual code:

-----------
Lets just consider the pixel part first because the beat and frame part is just for the movement of the scope.
here's the code for the ssc:

some variables required at initin fact, all the variables in the actual init are required )

n=1000;a1=1/(499-1);vrem=n/10;pi=acos(-1);tpi=acos(-1)*2;
(I will explain their use later on)

reset values per frame :
cn=0;i1=0;

pixel part:
cp=bnot(cp);
cn=cn+1;
i1=i1+a1;
colc=bnot(equal(cn,501));
trans=above(cn,500);
v1=if(bnot(cn%vrem),v,v1+abs(v/10));
d=if(cp,1+v1*0.2,.98);
th=t+i1*tpi;
outx=sin(th)*d;
outy=cos(th)*d;
inx=bnot(cp)*sin(th)*.3;
iny=bnot(cp)*cos(th)*.3;
x=if(trans,outx,inx)+ox;y=if(trans,outy,iny)+oy;
red=colc;green=colc*.5;blue=0;

explaination:
1) value of cp swaps beetween 1 and 0 every point. this is basically used to make solid scopes.
eg:- when we multiply x and y with cp, and when
a) cp=1, then x=x and y=y
b) if cp=0 then x=0 and y=0.
So, after every alternate point, the co-ordinates of the next point are (0,0). so, when we render the scope as lines, the entire part is filled with lines and we get a solid scope (provided the no of pts (n) is quite high)

2) cn:- this is the number of the point drawn. it is reseted to 0 every frame.

3) i1:- Custom i value. i1 is incremented by a1 every point.
value of a1 is 1/(499-1). ie. 488. ie.0.0208333...

4) colc:- used for hiding the point which connects the two objects.
colc=bnot(equal(cn,501));
So, when cn=501, bnot(equal(cn,501)) will return 0 else it will retun 1
cn is the number of the point. bu assigning rgb values to colc, the values for the 501th point will be 0 and for the other points will be 1.

5) trans:- no connection with its name and its values. I too dont remember why I used such a variable name.
trans=above(cn,500); this will return 1 if cn is above 500, else it will return 0. (use explained later).

6) v1: Custom v value.
v1=if(bnot(cn%vrem),v,v1+abs(v/10));
if cn is divided by vrem(n/10 i.e 1000/10 i.e 100)
and the remainder is zero ( vrem is a factor of cn) then return v else return v1+abs(v/10);
In short v1 is used for the waves created in the outer circle. whenever vrem is a factor of cn, then value of v1 will jump to v ( i.e after every 100 point value of v1 will be v), else it will be v1+abs(v/10), the will create the normal waves.

7) d is distance for the outer circle. this will swap beetween .98 and 1+v1*.2 as cp swaps beetween 1 and 0.
d=if(cp,1+v1*0.2,.98);

8) th:- angle ( usually r ) th = t+i1*tpi;
we have used cutom i value, so at the start i1=0 and at the end it is roughly 2. this is because we want to draw basically 2 circles.

9) outx=sin(th)*d;
outy=cos(th)*d;
the outer circle. conversion of polar coords into rectangular coords.

10) inx=bnot(cp)*sin(th)*.3;
iny=bnot(cp)*cos(th)*.3;
the inner circle (d=.3). value swaps beetween 0 and sin(th)*.3 or cos(th)*.3 for the solid fill effect.

11) x=if(trans,outx,inx)+ox;
y=if(trans,outy,iny)+oy;
trans:
trans=above(cn,500);
so, if cn<500 draws the outer circle, else draw the inner circle.

12) red=colc;green=colc*.5;blue=0;
colc:
colc=bnot(equal(cn,501));
if cn=501, then red=0; green=0;blue=0;
if cn!=501 then red=1; green=.5;blue=0.
this is for the orange colour.

finally, i did it. hope you understand this, I havent explained the movment part because it is all normal and basic stuff.

this is the preset I used the scope in:
found in my first pack.

btw. good way to increase posts

http://home.iitb.ac*****~shreyaspotnis

Last edited by shreyas_potnis; 14th March 2003 at 12:58.
shreyas_potnis is offline   Reply With Quote
Old 25th March 2003, 07:53   #47
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
rovastar did a good job here, merged the two threads, Thanks.
edit: What about converting this thread into a sticky? can we do that?

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 25th March 2003, 11:26   #48
anubis2003
Forum King
 
anubis2003's Avatar
 
Join Date: Dec 2002
Location: middle of somewhere
Posts: 5,564
Send a message via AIM to anubis2003
I was about to tell you to use the edit button until I realized that these posts have some time separating them. Yay for Rovastar, someone listened to my request!
anubis2003 is offline   Reply With Quote
Old 26th March 2003, 06:59   #49
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
me too sent a private message to him!
and what about the sticky?

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 26th March 2003, 19:56   #50
Jaak
Major Dude
 
Jaak's Avatar
 
Join Date: Jan 2003
Location: Estonia.
Posts: 851
good idea i must say, i like it!

Phi = (1+sqrt(5))/2
Jaak is offline   Reply With Quote
Old 28th March 2003, 20:49   #51
anubis2003
Forum King
 
anubis2003's Avatar
 
Join Date: Dec 2002
Location: middle of somewhere
Posts: 5,564
Send a message via AIM to anubis2003
Good, it's stickied now. Here's a tip for AVS n00bs: Don't submit your packs to winamp.com without first posting them here. We will give you a lot of constructive criticism and you can then fix your presets to make them even better. And beware the Atero.
anubis2003 is offline   Reply With Quote
Old 29th March 2003, 17:29   #52
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
Actually, it's more like check the forums for your question, doublecheck, triplecheck, quadruplecheck, and pentuple check for it before posting a new topic about your question or face the wrath of Atero (And the rest of the regulars dogpiling on you)

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 30th March 2003, 15:59   #53
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
*NOT CHECKED FOR REPEATED ENTRIES*

Custom inversion :

White SSC in an effect list, XOR output. Any other white surface will do.

AVS Lingo :

SSC - Superscope
DM - Dynamic Movement
DDM - Dynamic Distance Modifier
DS - Dynamic Shift
MP - Moving Particles
Convo Filter (Or just plain convo) - Convolution Filter
Fast Brite - Fast Brightness
(There are more, figure out yourself)

Chroming :
Chroming is changing the spectrum from 0...255 into 0..255...0 where 128 is now 255 - So it filters out anything too white.
It can be done in several ways :
-Effect list - Fast brite - Replace input, SubBlend2 output, another fast brite outside.
-Buffer save, clear screen, 3 effect lists. One colormap for each list, additive blend for each list (except for the top). Each taking different color, with buffer restore on top of them. Change the white into the corresponding colors, drag them to middle. Add a black in the end. (SLOW, too much work, just saying it)
-List (Replace input, max output) with invert in it, then an invert (outside the list) and a fast brite.
-Jheriko's multi filter. Fastest.

Rotation Delay :

(Copied directly from fsk's guide. For the preset in action, go to fsk.deviantart.com, galleries, and then "Zvezda")

rotation dellay


init:
effect=25

on beat:
g=getosc(0,0,0)/15

per fr.:

rz1=rz1+g; srz1=sin(rz1)/10; rz2=rz2+srz1;
--------------------------------------------------------------
usualy you just use the rz1 but in this case you have to put it thru another sin to make the changes in the rotation soft (dunno how to put it otherwise - remeber the first tentacle I sent you, it didn't have tis and it kinnda jumped on beat)

per point:

x1=i*1.6-.8;
y1=0;

dst=sqrt(x1*x1+y1*y1);
-----------------------------------
The distance from center

rz=rz2-srz1*dst*effect;
----------------------------------
this is the effect part

srz1 is the current change in rotation, so if you aplly les (-) rotation to the points further away from the center (*dst) you get the desired effect .

cz=cos(rz);
sz=sin(rz);
----------------
this needs to be in the per point.

x=x1*cz+y1*sz;
y=y1*cz-x1*sz

That is it . For 3D aplly to all three axes and use a 3D distance

--

Shape Engines :

Use point-by-point assigning (p=p+1 in pixel, p=0 in frame, and assign coordinates). Put in p%(points used in the shape) in place of the p in equal(p,n).
Use p1=if(equal(p%(points used in the shape),1),p1+1,p1) in pixel and p1=0 in frame to assign numbers for the shape.

--

Fix aspect ratio before posting your pack, or UnConeD will be angry at you.

Don't do the normal getosc syncing, or Atero will be angry at you.
Heck, he'll be angry at you anyways - The standard greeting.

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 30th March 2003, 23:55   #54
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
There is another way of syncing other than with getoscs or getspecs?
please explaino.

Also..
There are some *hidden* coding paramerters for sscs and dms etc.
exp(x) returnes the 'e' (the exponential constant) to the power of x.
atan2(a,b) i really have no idea.
and (for the true n00b)
alpha=0..1 -alpha sets the level of alpha blending in a dm if the blend setting is activated. this is done per point, so that mixtures/grandients of input and output can be created. can also be used to add fog and/or cover 'uglyedge' syndrome for 3d scopes. But i wont get into that. If you can ray-trace, then i think you can work this out for yourself.

also pi=acos(-1);
cheers to whoever enlightened us on this one. (methinks steven)

thats all i can think of for now..

Oh Yeah.. With SSC. Never restrict yourself to creating shapes strictly from x/y= some form of 'i'.
This is a very restrictive mothod in some cases.

eg.
init-- t=0; s=0; n=64

perframe-- t=0; s=0
perpoint-- s=if(equal(t,8),s+1,s);
t=if(equal(t,8),0,t+1);
x=s/8; y=t/8

this should creat a 8x8 dot grid, but i cant test it on this comp so correkt me if im wrong.
use colour coding to blacken the bits where lines cross over screen.
AVS Axer is offline   Reply With Quote
Old 31st March 2003, 01:02   #55
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
AVS Axer :

Exp(x) and atan2(a,b) are already known, alpha is well known, pi is already a basic knowledge.

Oh, and your code is wrong (I didn't test, so not 100% sure).
1. T is never 8, so there is never any increase of t or s, so the counter won't work.
2. The x will just draw across the screen, so the correction should be x=s/8-t+1;

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 31st March 2003, 03:14   #56
NemoOrange
Senior Member
 
NemoOrange's Avatar
 
Join Date: Jan 2003
Location: Philadelphia, USA
Posts: 135
Send a message via AIM to NemoOrange
Heaven forbid that any newbie actually looks at this thread, cause if they do they will be completely overwhelmed.

My best advice is to not go into Whacko AVS or El-vis's stuff & try to pick apart how the hell those codes work. First go in, & try some very simple codes. Then check out other presets with very simple codes and see how they work. I think most of my stuff is pretty easy, I don't use too many varibles & other crap. (shameless self promotion).

All in all, start out small & build from there.
NemoOrange is offline   Reply With Quote
Old 31st March 2003, 09:15   #57
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
hey nic01.. i didnt mean they arnt well known.. they just explained in the program. so newbs may not know about them
AVS Axer is offline   Reply With Quote
Old 31st March 2003, 09:18   #58
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
n00b mus be quie happ wih all his suff

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 31st March 2003, 13:41   #59
Magic.X
Major Dude
 
Magic.X's Avatar
 
Join Date: Feb 2002
Location: Leipzig / Germany
Posts: 859
Quote:
Originally posted by NemoOrange
Heaven forbid that any newbie actually looks at this thread, cause if they do they will be completely overwhelmed.
This wasnt meant to be a newbie startup thread but a knowledge topic for advanced AVSers (correct me if i got something wrong)


-=[The Ultimate VJ-Tool for AVS]=-

Hotlist 2.3 developement thread (old)
Magic.X is offline   Reply With Quote
Old 1st April 2003, 18:08   #60
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
This isn't supposed to help anyone in particular, just anything that may be useful to anyone goes in here.

Raz is offline   Reply With Quote
Old 2nd April 2003, 21:30   #61
mikm
Major Dude
 
mikm's Avatar
 
Join Date: May 2001
Location: somewhere else
Posts: 1,253
Quote:
Originally posted by Raz_001
This isn't supposed to help anyone in particular, just anything that may be useful to anyone goes in here.
yeah...I see it as an FAQ for regulars and a good knowledge base of code.

powered by C₂H₅OH
mikm is offline   Reply With Quote
Old 4th April 2003, 06:15   #62
NemoOrange
Senior Member
 
NemoOrange's Avatar
 
Join Date: Jan 2003
Location: Philadelphia, USA
Posts: 135
Send a message via AIM to NemoOrange
you know what, I may not be a regular here at the forums, but I've been AVSing for 2 years now, & I'm just baffled by all those equations & whatnot.

when I think 'tips & tricks" i don't think multi-line formulas for some complicated effect.

alright, enough bitching.
NemoOrange is offline   Reply With Quote
Old 4th April 2003, 12:08   #63
anubis2003
Forum King
 
anubis2003's Avatar
 
Join Date: Dec 2002
Location: middle of somewhere
Posts: 5,564
Send a message via AIM to anubis2003
So then make your own tips and tricks for aesthetics. I would, but I'm not that good at aesthetics.
anubis2003 is offline   Reply With Quote
Old 6th April 2003, 17:54   #64
NemoOrange
Senior Member
 
NemoOrange's Avatar
 
Join Date: Jan 2003
Location: Philadelphia, USA
Posts: 135
Send a message via AIM to NemoOrange
here I am with my foot in my mouth. I'm looking for some code that would treat a DynMove kinda like a basic sprite (if that makes sense, I'm no good with programming talk). All I want this DM to do is move around in a 3-D environment: move up & down, left & right, near & far. I tried looking here, but nothign really popped out. Does anyone have a uncomplicated way of doing this?
NemoOrange is offline   Reply With Quote
Old 7th April 2003, 00:57   #65
mikm
Major Dude
 
mikm's Avatar
 
Join Date: May 2001
Location: somewhere else
Posts: 1,253
hmm...I didn't know there were more than one flavors of Sprite


So you want to move the AVS around and zoom in and out?

That's very easy:

frame:
Rectangular coordiantes on
code:

xm=(insert x movement code here);
ym=(insert x movement code here);
zm=(insert x movement code here);
zoom=1/z;

pixel:
x=(x+xm)*zoom;
y=(y+ym)*zoom;



of course, this will not handle rotation...if you want that, there was a post a while back.

If you want to move a single object around against a static background, then you need to synchronize SSCs.

This can be achieved by using a pseudorandom number generator.

(search the forums for synchronzing superscopes, there will be a much better explanation than I can do here).

powered by C₂H₅OH
mikm is offline   Reply With Quote
Old 7th April 2003, 01:02   #66
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,149
Send a message via ICQ to jheriko
Well. As long as your sprite has a black border we can do this one fine with some cheaty psuedo 3D code. Here is a simple dm that I quickly wrote to demonstrate this.

Per Frame:

dz=sin(t)+1.2;
dx=cos(t);
dy=sin(2*t);
t=t+0.01;
z=1/(dz*0.5);

Per Point:

x=(x+dx)*z;
y=(y+dy)*z;

This works fine z for co-ordinates strictly greater than zero. Here dx, dy and dz represent the displacement of the sprite in the varying axes. A gridsize should be set for this, preferably large since it has to shrink the sprite sometimes. Set wrap to 'off' and we are done. If you want to draw the sprite over a background then simply chuck it in an effect list and use additive blending.

Unless you want your sprite to rotate in 3D too then this should be enough.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 8th April 2003, 11:12   #67
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Conversion of polar co-ords. into rectangular ones and vice-versa:

to convert polar co-ords. into rectangular ones, use:

x=sin(r)*d
y=cos(r)*d

to convert rectangular co-ords. into polar ones, use:

d=sqrt(sqr(x)+sqr(y))
r=atan2(x,y)

I hope I am right, correct me if I am not.

I can explain, how d=sqrt(sqr(x)+sqr(y)) works.
code:

So, here's the deal:

suppose x=.8 and y=.6, then the position of point point would be:


y-axis
^
|
|P Q
|.6- - - - - - -.(.8,.6)
| |
| |
|S |R
x-axis <- - - - - - - - - - - - - - - - >
|(0,0) .8
|
|
|
|
|
|

(this is an approximate figure)
PQRS is the quadrilaeral formed.
Now, we have to find l(SQ) or d(S,Q)
I will solve this as we solve our geomtery problems,
as this will give you a more clear idea.

Given:
1) line x is perpendicaular to line y.
2) d(S,R)=.8 , d(P,S)=.6
3) seg PQ is perpendicular to line y & seg RQ is perpendicular to line x.

to find: d(S,Q) i.e length of seg SQ.
Construction: Draw seg SQ ( I could'nt draw it here ) .
Sol'n:
Statement |Reason
1) In, quad. PQRS, |
m<S=m<P=m<Q=m<R=90 degrees |statement 1 & 3 of Given.
|
2) quad. PQRS is a rectangle. |Statement 1) and def'n of a rectangle.
|
3) seg PS is congreuent to seg QR |statement 2) and opposite sides of a
| rectangle are congruent.
|
4) In triangle SQR, |given statement 2) and statement 3)
seg SR = .8 and seg QR = .6 |
|
5) In triangle SQR, |

SQ^2 = SR^2 + SQ^2 |Pythagorus theorem.
<=> SQ = sqrt ( SR^2 + SQ^2 )
<=> SQ = sqrt ( .8^2 + .6^2 )
<=> SQ = sqrt ( .64 + .36 )
= sqrt ( 1.00 )
= 1
therefore SQ = 1

here, SQ = d
so sqr ( d ) = sqr ( SR ) + sqr ( RQ )
= sqr ( X ) + sqr ( Y ) ( not the lines, but the position of the point )
<=> d = sqrt ( sqr ( X ) + sqr ( Y )

It would be nice if someone explained how r=atan2(x,y) works.



NOte: my first experiment without smiley's *I smile*

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 8th April 2003, 20:34   #68
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 just tried making that way too difficult.
first off:
x=d*cos(r)
y=d*sin(r)

you can get this merely by looking at the triangle. R is the angle and d is the hypotenuse(sp). Simple trig tells you that
cos(r)=x/d
sin(r)=y/d

so those two equations are easy to derive.
then, using pythagorean theorem
d^2=x^2+y^2
Also simple.
and then
tan(r)=y/x
simple again.
anubis2003 is offline   Reply With Quote
Old 15th April 2003, 04:58   #69
Jaheckelsafar
Major Dude
 
Join Date: Feb 2002
Location: home
Posts: 1,318
Going up 2 posts here...

The grid size in a DM won't affect quality unless you're trying to bend the picture. Full pic zooming and rotation will only be slowed down by a larger grid size.

That and I like to reduce the movement speed when zoomed out. To do so, multiply the move values by the inverse of you zoom.

Now enough out of me.

Stoke me a clipper. I'll be back for Christmas.

- Arnold Rimmer
Red Dwarf
Jaheckelsafar is offline   Reply With Quote
Old 24th April 2003, 20:04   #70
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
A couple tricks I'm playing around with...

The classic "floating squares" effect:
EL (ignore, every other pixel)
.Invert
[Optional: EL (ignore, evey other line)
.Invert]
Rotozoomer
can be enhanced with random coloring of the squares using this method:
Invert
Grain
EL (ignore, multiply)
.EL (ignore, every other pixel)
..Invert
.[Optional: EL (ignore, evey other line)
..Invert]
Colormap
Rotozoomer

Also, I've discovered a sort hack to make a cycling color palette using Colormap. It's rather cumbersome and it's not perfect, but here's how it works:
Custom BPM - invert
Custom BPM - skip x beats
Color map
The color map must have several rotating positions of a cyclic palette, and be set to "Onbeat cycle". A nice sort of hue shifter can be created this way.
It'd be rather neat if we could actually wheedle a real cycler out of ucd, with dynamic cycle position 'n' stuff....

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 26th April 2003, 11:05   #71
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
great, would be better if you would post the AVS file

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 28th April 2003, 05:47   #72
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
somone asked how atan2 works:

in case you didnt already know.. asin, acos and atan are the inverse functions of sin cos and tan.

dont be confused however and think that asin(sin(x)), will neccessarily return x. Thnk of a circle and acknowledge that no matter how many times you got around the circle, sin(x) will always be the same at the same point of the circle. Now imagine that x is more than 2*pi (the circumference), this is just like going around a circle more than once, so all the values will be the same.

The trouble with asin, acos and atan is that they do not even return the right values of x all the way around a circle!! Dont get me wrong, they have their uses. Consider sin(x) again, this finction will return 0 in two different positions while 0>x>2pi. one at 0 and one at pi. Now you can see that asin(sin(x)) will definatly not return the right values of x, because sin(x) has a pattern, but x does not.

In reality, asin(sin(x)) will return x for only the first quadrant,
After that x is reset to 0 at the start of every new quadrant. And with these rules.
First quadrant: Asin(sin(x)) = x
second quadrant:Asin(sin(x)) = 2pi-x
third quadrant: Asin(sin(x)) = -x
fourth quadrant:Asin(sin(x)) = -2pi+x

Look at a unit circle or play around in avs and youll get how this works. Try this in a superscope:
y=atan(tan(i*acos(-1)*2))/5;
x=i/5
and try replacing atan and tan with asin and sin. etc.

To counter this, atan2 was invented.. pretty much you input two coordinates of a point (x,y) and it does something similar to atan(x/y) but it acknowledges that they are coodinates of the same point and works it out in some clever way that i dont yet know.

So, atan2(x,y) returns the angle of the point x,y in radians from center (0,0).
If you look at alot of code however, people in avs have tended to use atan2(x,-y). This is because the y axis in avs is fliped. In trig we start from the bottom and goto top. I dont know why..

It is also convention to start from the right at -1 and got anti clockwise around the circle.. (first quadrant is at top left). So i dont know why we arnt using atan2(-x,-y) but i wont argue because fsk and unconed use the other way, and they seem to know their shit.

Correct me on anyof this please.. cause i could have easily have got confused. Oh, and if someone knew exactly how the function is calculated, it would be most helpful.

Last edited by AVS Axer; 28th April 2003 at 06:28.
AVS Axer is offline   Reply With Quote
Old 28th April 2003, 09:38   #73
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
XOR blending mode was also asked about somewhere..

Sadly itsnot as simple as you would hope.

Xor is computed at the binary level.
So, each pixel has the compondents r,g,b (depending on how old your comp is ho ho.)
And each r,g, or b, can be described as a binary digit. (or bit)
(0000,0000).

ok.. lets lets just look at one channel, say r. and just one pixel.
we have A=0010,1010, B=0101,0111

dont wory about what those colours are, or even what those numbers are, i dont know either.

For this demo, A is the old image, B is the blending image.

A XOR B means the same as (A OR B)NOT(A AND B)
in binary logic, 0 is false, 1 is true.

so it will return "TRUE"(1) if a OR b are 1, but "FALSE"(0) if a AND b are both 1, and 0 if neither a OR b are 1.

so:
a-----=(00111010)
b-----=(01010111)
aXORb-=(01101101)

you see now?

This is applied to all colour chanels and the same to every pixel.

Notice some things..

*if image A and B are the same, the whole screen would be black,

*two completely different solid colours (different in all r,g and b), the whole screen would be white.

*any identicle pixels would be shaded black

Last edited by AVS Axer; 28th April 2003 at 10:00.
AVS Axer is offline   Reply With Quote
Old 28th April 2003, 10:14   #74
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
some friend of mine told that XOR is used in encryption.
e.g
if x XOR y = z
then y XOR z = x
( thats what he told me)

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 28th April 2003, 10:41   #75
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
Well, xor is not just graphics, it is a logic operator just like AND, NOR, OR etc. It can be used in anything.
But i think your friend got that encryption idea wrong, i have also heard of it beign used for this, and i simply assumed that it uses the same binary xor method as mentioned above.
AVS Axer is offline   Reply With Quote
Old 28th April 2003, 14:42   #76
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
Well, as it often happens, i was wrong..
i looked at the idea more carefully and youre friend was right shreyas.
One of the outcomes of the xor operation is that it can be inverted easily.
yes,
if x XOR y = z
then y XOR z = x

so you can decrypt z(the encryption) to get x(the original) so long as you have y (which acts as a sort of mask).

This applied to avs.

if you were to XOR blend imageA with imageB, you would get imageC
you could then XOR blend image B with imageC and you would get youre original imageA back!!! wowee...
i didnt know that untill shreyas pointed it out.. very clever, but not very useful...
AVS Axer is offline   Reply With Quote
Old 28th April 2003, 15:09   #77
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
About atan2... you got one detail wrong. In a mathematical coordinate system, the angle for (x,y) with regard to the positive x axis is atan(y/x), not atan(x/y).

By the way, you can imagine atan2 to be the same as this, except that atan2 can also handle the cases where x and/or y is 0:

alpha=atan(y/x)+below(x,0)*acos(-1);

UnConeD is offline   Reply With Quote
Old 28th April 2003, 15:40   #78
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
Friendly edit:
By the way, you can imagine atan... (not atan2)
AVS Axer is offline   Reply With Quote
Old 30th April 2003, 00:46   #79
mikm
Major Dude
 
mikm's Avatar
 
Join Date: May 2001
Location: somewhere else
Posts: 1,253
Transparencies

do your 'background stuff'
add a replace buffersave to #1

do the 'over stuff'
replace buffersave to #2
multiply --> infinite square
invert

effect list (ignore/multiply)
..buffer restore (replace) #1
[end effect list]
buffer restore (max) #2

(there might be a better way, this is what I have found to work)

powered by C₂H₅OH
mikm is offline   Reply With Quote
Old 1st May 2003, 13:14   #80
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
switches:

---------------
binary: sw=1-sw
---------------
'sw' will switch from 1 to 0 every time the code is run. Because it is binary, you can use simple maths to get ANY two numbers from this switch:
sw2=sw*(difference between desired numbers)+(lowest desired number)

Superscope example (use dots, not lines):
sw=1-sw;
y=getosc(i,0,0)*0.2+(sw-0.5)*0.5;
x=2*i-1;

-------------------------------------
Other Switches: t=t+1; sw=t%ns;
Where ns is the number of switches.)
---------------------------------------
sw will progress through 0 to ns and then loop.

Superscope example:
t=t+1;
sw=(t%7);
v=getspec(sw/7+i/7,0,0);
x=v*0.2+((sw*0.2)-0.6)*1.5;
y=2*i-1;
AVS Axer 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