Old 5th April 2002, 05:14   #1
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
Few questions about AVS... (advanced stuffs)

I kinda still have a lot to learn 'bout AVS...
Here are the load of questions

How do you make a whole screen-grid using only 1 SSC?

Another SSC question : How can I make a line SSC, in which somewhere along the SSC, there's a line perpendicular to the first line, but still using the same SSC? (I gonna use this to make a Tetris preset I've planned to make... making a Tetris shapes lens DMs are easy, but using SSC... I can't =( )(I'll also edit line width, so just need the skeleton)

I know it won't help me, but what is the gridsize of Trans/Movement?

How to make a DM Lens that is curved nicely from edge to middle?
To explain :
Like the lens in UnConeD's Second Reality, not like in :

d=if(band(band(above(x,-.5),below(x,.5)),band(above(y,-.5),below(y,.5))),d/2,d);

Answers to the question would be very appreciated =)

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 5th April 2002, 09:01   #2
Jaheckelsafar
Major Dude
 
Join Date: Feb 2002
Location: home
Posts: 1,318
I don't think movement has a grid size, I believe it does all the pixels in the render.

As to the rest, no idea.
Jaheckelsafar is offline   Reply With Quote
Old 5th April 2002, 15:52   #3
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
One at a time :)

Quote:
How do you make a whole screen-grid using only 1 SSC?
The trick here is to throw i out the window... it's inaccurate due to round-off errors. Also remember that you can set n in every frame. So basically we need to make a variable xp (xposition) traverse every value from 0 to w (width), while yp traverses every position from 0 to [i]h[ (height).

Unfortunately, it's best to use w+1 and h+1 for width and height. If you don't, you'll get nasty round-off errors too.

So, in onframe:

PHP Code:
ww=w+1hh+h+1n=ww*hhxp=0yp=0iw=1/wwih=1/hh
iw and ih are the inverted (adjusted) width and height, calculated only once every frame to speed the preset up... multiplication is several times faster than division.

In per point:

PHP Code:
x=xp*iw*2-1y=yp*ih*2-1;

.....

xp=if(above(xp+1,ww),0,xp+1);
yp=if(xp,yp,yp+1); 
First, we transform the variables xp,yp in the range (0..ww, 0..hh) into AVS coordinates (-1..1, -1..1), by dividing by width and height, and multiplying by 2 and subtracting 1.

Then, at the end, we increase xp by one. When it equals the width, we set it back to zero.
yp is increased only when xp is zero. Note that this doesn't happen the first time around (because xp will equal 1 after the first pixel). So you have a pretty grid that fills the full screen... but it's slow as hell. Speed-up tips include skipping every uneven pixel and using lines to get a 'pixel-doubled' grid.
UnConeD is offline   Reply With Quote
Old 5th April 2002, 17:47   #4
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
If you want to make one superscope which consists of multiple disconnected line segments, you'll need to use a render-mode like Additive or Maximum, and simply set the color to black when you don't want a line to be drawn. A good example is my Plankton preset... all the swimming particles are only one SSC, and you can see this by turning off the blendmode change.
UnConeD is offline   Reply With Quote
Old 6th April 2002, 22:28   #5
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
Umm, I think I need to rephrase my Tetris SSC question a bit, this time in form of a different question...

How do you make a "T" using one SSC?
An "l" With horizontally laid "T" on top of it using one SSC?

(In other words, the shpae itself... )

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 6th April 2002, 23:23   #6
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Probably something like this:

code:

1---------->2 -----3<----2 -----3-----
|
|
v
4



Use if's in a 4 point superscope to set the coordinates accordingly each time.
UnConeD is offline   Reply With Quote
Old 7th April 2002, 18:31   #7
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
Hmm, but what Variable?
I tried using If(equal(n,#) , but doesn't work...

Hmm, possibly I'd have to use 2-3 synchronized SSCs...

So, my (probably ) last question :

What is the min/max value of Getosc/Getspec command?

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 8th April 2002, 03:01   #8
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
i'd do something like:

"u=i*n"

-> that way, u contains a number 0, 1, 2, 3... up to 'n'. Then use that in if statements.
UnConeD is offline   Reply With Quote
Old 10th April 2002, 02:34   #9
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
Tried that, didn't work...

BUT...

Try this : (any variable)=n*i-i

That works! (All that problem, and one simple formula...)

I use p for the variable - stands for "point"...

And of course, only the coordinates of the point is the only thing needed to be done, using "i" won't work (remember, when SSC is set on lines, it will automatically draw line from n#1 to n#2 to n#3... but not last n to first n)
The Tetris shapes are rather easy to make once the formula above come into use...

Hmm, now if only I can make a smooth lens, not a lens with the edge a bit too obvious...

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 10th April 2002, 03:48   #10
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
For a good lens... first of all, you need a good view on mathematical functions.

Try the following superscope:

u=i*2-1;
x=u;y=-(u*u);

This will draw a parabola... because the relationship between any variable 'x' and its square 'x*x' is shaped like that. Similary, a linear relationship f(x) = a*x (where a is any real number) is a straight line passing through the origin. Try visualising math functions this way. Fill this in in the superscope: y=-(sin(u)); Now try y=-(sin(u*2)); This has the effect that the graph is 'squished' horizontally, so you see more of it.

What am I getting at? Well... the distortion you want is probably that you're changing a 'd' based on a specific formula. I also suppose that you use something like d=if(below(d, 0.5), ..., ...) to keep the lens small. So what you want now is a function that bulges/enlarges when 'd' is inside your interval, and is nicely linear (i.e. doesn't change d) outside. You also need to make sure that, when d is on the edge of the lens, there is no sudden jump in value.

Here's a good example:

y=-(if(below(abs(u),.5),abs(u)*u*2,u));

If you remove/change the *2, you'll see that the graph is no longer continuous. I also made sure that the function behaves appropriately for negative values, but for 'd' values, which are positive-only, that's not even necessary. Of course, I'm not sure if this will look like a convincing lens, but you should be able to figure out an appropriate formula yourself.

For better plotting of mathematical functions, you need a good math program... but for a quick look, a superscope will do .
UnConeD 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