Archive: Tips & Tricks 2 -- Beginners and Intermediate Only


24th April 2003 14:57 UTC

Tips & Tricks 2 -- Beginners and Intermediate Only
After watching the Tips & Tricks topic started by Tuggummi, I thought it was very useful for the more advanced AVS'ers here, but that NONE of the starters or lower-leveled AVS'ers would get anything of it. I read it, and understood the first 3 or 4 posts, and then everything became very hard.

Therefor this topic. It is (as well as the other Tips & Tricks topic) to share ideas and effects. I justified why I started a new one, and I hope that UnConed and Tuggummi etc. can keep the level low, and don't start posting their great and cool codes, because the newbies (like me) can't understand them anyway.

I hope you all understand why I posted this, and that some good (but easy ideas) come up :) .

Greets,

Deamon


24th April 2003 14:58 UTC

So here we go,

In Superscopes, use "getosc(i,0,0)" instead of V, keeps the speed up a bit. I'm not quite confident if it is exactly the same, but I haven't noticed any differences yet.


24th April 2003 15:00 UTC

Dynamic movement:

d=d/(y*2.2+3)*2

Makes an easy surface. Rotation can be added under this line, movement is easiest in x and y coords in another dynamic movement above it.


24th April 2003 15:06 UTC

The if(...) explained in Visual Basic style:

if....then....else

if(condition,then,else)

condition = the condition you want to "if". This requires two variables, compared with the words above, below and equal.

then = if the condition is met, execute this piece of coding.

else = if the condition is not met, execute this piece of coding.

example:

t=if(above(t,10),1,t)+0.05;

explanation

if t get's bigger than 10, set t to 1, else stay t. After this check 0.05 is added to t.


PS.

My excuses for not using edit, I only noticed it now :P .


24th April 2003 16:47 UTC

I will show you how to make a moving particle, one of the main components of early presets through a superscope because i'm sick of seeing moving particles in noob presets. There are lots of ways to do this in superscope but this is one of the easiest ways:
First lets draw the actual spiral so that it just sits there in the center of the screen (red text just to explain)
Superscope:
Init:
n=800; pi=acos(-1); ("n=" sets the number of points the scope will draw. "pi" is just setting a variable, this can be anything you want as long as it starts with a letter. "acos=(-1)" this calculates pi in avs so i have set a variable to calculate pi. When i insert this into the x or y part of the scope the variable will add pi to it)

On Beat:

Per Frame:

Pixel:
x=cos(i*pi*30)*i*0.1;
y=sin(i*pi*30)*i*0.1;
(the scope is calculated in the x and y tags only. You can put any variables calculated anywhere else in the scope in and they will become part of the equation if they have been done correctly. cos simply means the cosine of what is in the brackets directly in front of it. sin is the sine of the ........ i'm not entirely sure what i does but it draws lines now i * 3.14159... (pi has been set as a variable earlier in the scope and the scope reads it) *30 which means 30 *pi) again times by i makes the spiral. the ammount you times pi by calculates the density of the spiral. This means how many times does it go around before you get to the middle. The * 0.1 simply makes the entire thing 0.1 times the size it was before on whichever axis you times it by

There is a moving particle type dot in the middle of the screen now. Now movements. This involves setting more variables and uses of other avs tags. Now just movements on the x axis:

Frame:
n=800; pi=acos(-1);

OnBeat:
rx1=rand(50)/50; (rx1 is again simply setting a variable. "rand" is an avs term, it simply means takes a random number from whatever is in the brackets to one. In this case, 50. "/50" divides the entire thing by 50, meaning the random between 0 and 50 is now between 0 and 1 but is split 50 ways.

Per Frame:
ax=ax*0.9+rx1*0.1; ax=ax simply means that ax= whatever ax was before plus whatever you continue in the equation. It's times by 0.9 meaning 9 out of 10 of the previous number generator then added the random number from on beat then made 1 out of 10 again.

Per Point:
x=cos(i*pi*30)*i*0.1-0.8+ax;
y=sin(i*pi*30)*i*0.1-0.8+ay;
this is simply what it was before except the x axis has the moving number generator added so the dot moves around to the number. add it to the y axis and take it off the x and the dot will move up and down instead of side to side. Use it on both however since it using the same random number generator it will move one dimensionally diagonally though. The easy solution is make another random generator. This simply means to copy the old one and change the variable names:

Frame:
n=800; pi=acos(-1);
OnBeat:
rx1=rand(50)/50; ry1=rand(50)/50;
Per Frame:
ax=ax*0.9+rx1*0.1; ay=ay*0.9+ry1*0.1;
Per Point:
x=cos(i*pi*30)*i*0.1-0.8+ax;
y=sin(i*pi*30)*i*0.1-0.8+ay;

This is just the same except there is a different random number generator moving the dot on the y axis which makes the dot zoom around to the beat. This means you can mess around with the movement of the scope and make your own random number generators and make it move however you want. Nifty aint it.

Another way to do it is just to make a textered dot. This means using the texer APE from UnConeD's whacko 6 (I think). This is simply the same movement method but you just draw a simple dot that zooms around and an image masks the dot. eg:

Frame:
n=1; this only needs one dot drawn because it is just a dot
OnBeat:
rx1=rand(50)/50; ry1=rand(50)/50;
Per Frame:
ax=ax*0.9+rx1*0.1; ay=ay*0.9+ry1*0.1;
Per Point:
x=0-0.8+ax;
y=0-0.8+ay;
the 0 just signifies where the dot is placed at first and the + shows by how much the dot should move

I hope that helps you a little and shows you that scopes aren't that hard and i hope it cleared up some things.


24th April 2003 16:49 UTC

I do not want another sticky!! :);)

Remember the 'if' part is if condition does not equal zero then execute.

if(mybeat,123,321)

if mybeat <>0 then 123 else 321

it is quick then using the above etc and many newbis wil find it a quick step to learn.

FOr a more detailed explaination of the command I am sure there is a decent AVS resource that someone has done or else (Back to milkdrop) http://www.nullsoft.com/free/milkdro...horing.html#3f is ok although that version is still missing some. & doesn't work and atan2 exp etc are missing.


25th April 2003 01:37 UTC

This is definitely a beginner trick that belongs here... it's been published before:

When coding your own equations, you can leave comments to make it easier for yourself to remember what stuff does.

To place a comment in code, you can use any high-ascii character (like £, ù, µ, ©, __...) to open the comment, and end it with a semi-colon [;]
To type a high-ascii character (if you have none on your keyboard), hold ALT and then type 0 followed by a number from 128 to 255 on the numerical keypad.

E.g.:

x=cos(r)*d;y=sin(r)*d; £ This is a circle;


28th April 2003 10:01 UTC

A common mistake about how the rand() function works is that it gives you values from 1-N(N=defined rand value, i.e. rand(10)) randomly.

When it works a bit differently and some might say it's not logical.

So here is an example:

On beat:
rnd=rand(20)

This piece of code gives you not random values from 1 to 20, but instead 0 to 19, this is important when you need really specific values like multiplying a scope length for example. If you indeed want values from 1 to 20 you only need to write it like this:

rnd=1+rand(20)

The rand function still gives you values from 0 to 19, but it now always adds +1 to the whatever the result of the rand function is.

Makes sense?

Here is a superscope example:

Init
n=100

On beat
rnd=(5+rand(16))*0.1

Per Pixel
x=i*rnd-rnd*0.5 ;
y=v*0.3

Now we have a horizontal scope that vibrates on the y axis and randomly changes it's lengt on the x axis.

How it works?
First we have in the init section "n=100" , this just means how many points in the line there is so we will ignore that (it can be pretty much anything you want)

Then we have the rnd value in the on beat section. "Rnd" first sets 5 as the minimal value and the adds (+) randomly values from 0 to 15 into it (rand(16)). Then we just multiply the outcome with 0.1 so we get values from 0.5 to 2.0 (0.5,0.6,0.7...) randomly each beat.

Then we have the actual scope code which i have used to describe & show what it really does.

x=i*rnd-rnd

Where i*rnd first draws a line with the i function and defines the length with the rnd function. Then the -rnd*0.5 part just align's it to the center of the screen as the scope changes it size the center also changes so we need to use the rnd value also to align it to the center, we multiply it by 0.5 (same as dividing it with 2) and minus it.

y=v*0.3

Just makes it vibrate in the y axis (vertical vibration) , we multiply it by 0.3 to tone it down a bit.



And there it is, this should pretty much explain how the rand function really works.


28th April 2003 10:54 UTC

Originally posted by Deamon
So here we go,

In Superscopes, use "getosc(i,0,0)" instead of V, keeps the speed up a bit. I'm not quite confident if it is exactly the same, but I haven't noticed any differences yet.
well, getosc and the value of v are for totally different.
in short
v=getosc(i,0,0) is equivalent to v when put in per pixel

28th April 2003 19:51 UTC

no it's not. getosc(i,0,0) and getspec(i*something,0,0)*2-1 *approximate* v in ssc, i think it has some odd roundoff errors...or something :igor:


29th April 2003 09:08 UTC

easy movement to try out (looks like tunnel effect):

d=sin(d);
r=r+0.05;

This was my first homemade movement ;)


29th April 2003 09:24 UTC

Zooming & Rotating
How to use zooming and rotating in the movement with D & R (polar coords)

Well you zoom in D by multiplying D with a value of your choice

like this
d=d*0.75

This zooms the current screen closer (inwards) by 1/4 (0.75 out of 1 is 3/4)

another example
d=d*2

This zooms the current screen out_wards. It's pretty simple, basicly it doubles the distance :) NOTE: Using wrap will result in a pattern of the screen, but the distance still stays the same.


To rotate, you add values to the R value

like this
r=r+0.1

This will slightly rotate the picture counterclock-wise, using - instead of + will result in rotating the screen in clock-wise direction. It's as simple as that :) Use higher values instead of 0.1 to rotate more. You should also now that rotating the screen with a value that is 2*pi will result that the image will rotate 360 degrees :)




Now you have a go :up:



[edit]
It seems the word o-u-t-w-a-r is forbidden, what the hell is that all about?
[/edit]


29th April 2003 10:56 UTC

spiral static movement:

r=r+sin(d* no of swirles * pi * 2)*intensity


29th April 2003 19:59 UTC

actually, that movement is:
r=r+sin(d*swirls)*intensity
you don't have to get the 2pi in there at all. you can apply it to d as well:
d=d+sin(r*swirls)*intensity

when combining them, if you just use the two formulas together:
r=r+sin(d*rswirls)*rintensity;
d=d+sin(r*dswirls)*dintensity;
d is shifted using the already shifted r value. to fix this, save r before you shift it:
r1=r;
r=r+sin(d*rswirls)*rintensity;
d=d+sin(r1*dswirls)*dintensity;
it's a small fix, but it works. another fix is to zoom c instead of increment it:
r1=r;
r=r+sin(d*rswirls)*rintensity;
d=d*(sin(r1*dswirls)*dintensity+1);
this makes it so that the swirls aren't so stretched.


1st May 2003 22:10 UTC

using if(above(....)...) is handy in d to alter d movements outside a ring instead of the whole view.

d=if(above(d,0.2),sin(x*x+y*y),d) creates a sort of ugly bubble on the preset.

Of course "below" works as well.


2nd May 2003 10:48 UTC

well, no the correct one is:

r=r+sin(d*pi*no of swirles)*intensity.

well, you need to ,multiply by pi to get the desired number of swirles


2nd May 2003 22:11 UTC

instead of using x and y in superscopes you can easily add the var zoom this way:

x1= ;
y1= ;
zoom= ;

x=(x1/(zoom+1));
y=(y1/(zoom+1));

x and y coordinates should be put in x1 and y1 now. The higher zoom is th further away the scope.

example:

r=i*pi*2; (pi=acos(-1) in init, presumably standard)
x1=sin(r);
y1=cos(r);
zoom=sin(t); (t=t-0.05 in frame, standard)
x=(x1/(zoom+1));
y=(y1/(zoom+1));


3rd May 2003 10:57 UTC

I have searched the forums, (and googled) for some explanation of 3D AVS'ing and rotation matrices, but I don't quite get it, could somebody please give a small explanation (preferably with example) on how to make 3D AVS'es?

Thanks on advance


4th May 2003 05:03 UTC

shreyas: still wrong. you don't need pi at all, and there's no way to guarantee that you get the correct number of swirls, so it's all subjective anyway. it doesn't really even matter in the long run, unless you want to get the center points of the swirls to sync them with a scope, which you can do with some simple trigonometry.


4th May 2003 08:58 UTC

3D AVS is reatively easy.

Give each point an x,y,z value. Make x = xval/zval and y = yval/zval.


4th May 2003 23:11 UTC

note that the camera is put in the exact center, which means if z is between -1 and 1, the camera will be looking at points behind itself (which is a bad thing). be sure to shift z forward before you apply the x=xp/zp; y=yp/zp; transformation.


5th May 2003 09:20 UTC

True, forgot that. It's usually best not to have things go behind the camera; it can cause all kinds of funky lines. If a point goes behind the camera, the x and y values will be negative of what they are infront. You can set the colour to black a bit before the camera to avoid funky lines, but that won't work if your points are too far apart. Any colour changes affect only lines comming out of a point, not going in.


5th May 2003 09:33 UTC

Tip - if you are a newbie and you want to start coding DON`T use movements with polar coordinates(d,r) and rectangular coordinates(x,y)ther.Learn to use rectangular first then polar then combine them.Trying to combine then not knowing what you are doing can provide some nasty effects...


5th May 2003 10:32 UTC

the best wasy will be to add 1 or some number closer to it to avoid those lines(might even end up hanging or chrashing AVS)


6th May 2003 11:19 UTC

Yep, I had AVS crashing once, and it is damn hard to get it back as well, cause it loads the last loaded prest everytime...horrible.

but x/z and y/z only causes zooming, right? (like my previous post)


6th May 2003 16:23 UTC

Yeah, but if each point has a different z value...


7th May 2003 13:53 UTC

how do you accomplish that?


7th May 2003 16:14 UTC

Some kind of formula based on i, many if statements, or rotation around the x or y axes. There's a number of different ways.


8th May 2003 07:42 UTC

try to make up a simple on point z-val changing (maybe z=sin(i*asin(1)*4+t) and then change t per fram to give it a dynamic feeling. This should do it. If you got the main idea of how it is done, go further into it and try out more.


8th May 2003 14:11 UTC

and with z=sin(i*asin(1)*4+t) I use x=x/z and y=y/z? (btw. what does the code exactly mean? I can copy it, but then I wouldn't fully understand what I'm doing.)


8th May 2003 14:47 UTC

Yeah you use x=x/z;y=y/z; or something similar
Asin(1) equals pi what is 3.14159 and is a constant.
since basic arguments for sin function are from 0 to 2*pi and i goes from 0 to 1 statement i*pi*4 makes 2 sine waves and t variable(have something like t=t+0.05 in the frame section) moves the waves


10th May 2003 17:52 UTC

ok thank you very much


11th May 2003 10:28 UTC

what is a rotation matrix?


11th May 2003 16:31 UTC

Here's a handy-dandy site http://mathworld.wolfram.com/RotationMatrix.html
To boils down to


x=cos(th)*x1+sin(th)*y1;
y=-sin(th)*xi+cos(th)*y1;

still, check the sight out. You might learn something.

12th May 2003 10:43 UTC

I checked the site, and it explained a only very few things to me. My english is way too bad for it :P. Could you please clear those formulas a bit for me?

x=cos(th)*x1+sin(th)*y1;
y=-sin(th)*xi+cos(th)*y1;


12th May 2003 14:49 UTC

x1 and y1 are your initial x and y values
th is the angle of rotation in radians (2*pi = one full rotation)
x and y are your rotated x and y values

I can't explain anymore than that because I only half get it myself.


12th May 2003 17:42 UTC

ok thanks, now it makes complete sense to me :). Now I'd like to know how to add the z axis. so there is a way to add a z value just like x1, and y1. Any suggestions?

PS.

thank you very much for all the patience and explanation for me, I really appreciate all the effort.


13th May 2003 04:23 UTC

You only rotate around 2 axes at a time. x-y, y-z, z-x.


13th May 2003 10:29 UTC

i searched the sites a lot for rotation matrix but i got the same things, so these sites only explain the concepts, you need a good teacher to master it or experiance
btw.

x degrees = x * pi / 180 radians


13th May 2003 21:43 UTC

yes, but DON'T bother converting between degrees and radians, as el-vis does in his engine.

and you rotate around 1 axis at a time, the two axes used in the rotation matrix are the ones that define the plane perpendicular to that axis. so this rotation:
x=x1*sin(theta)+y1*cos(theta); y=x1*cos(theta)-y1*sin(theta);
rotates around the z axis, but *inside* the x/y plane perpendicular to the z axis.


14th May 2003 08:34 UTC

oops, mixed up the concepts. :(


15th May 2003 09:05 UTC

I'm loosing it... :( I understood the part that you always rotate along two axes. I know how to rotate along x-y (though I only know that with polar coords), but I don't know how to rotate along x-z and y-z.


15th May 2003 10:42 UTC

read ateros primer.. its in his sig.

ATERO! post in this thread so they can find your sig!


15th May 2003 16:58 UTC

i have. several times.

way to pay attention :rolleyes:


15th May 2003 17:41 UTC

just take the rotation matrix and apply it to other planes.


16th May 2003 05:28 UTC

lol.. anyway. you wont get it unless you understand the basic trig of it. so read atero's primer. And visit ucd's thread called AVS FAQ or somehting, it has useful links..


17th May 2003 16:29 UTC

ooooh... nice :). I'm going to study this one for sure.


20th May 2003 09:16 UTC

ok I watched it, and I got most of it, though this piece of code is not quite clear to me:


x2=x1*sin(zt)-y1*cos(zt);
y2=x1*cos(zt)+y1*sin(zt);
x3=x2*sin(yt)-z1*cos(yt);
z2=x2*cos(yt)+z1*sin(yt);
y3=y2*sin(xt)-z2*cos(xt);
z3=y2*cos(xt)+z2*sin(xt);


I mean, I see it is neccesary, but I couldn't make it up my self. Could anybody please explain it a bit?

20th May 2003 16:49 UTC

well it's all there in the primer, but it is admittedly crap and the next version - which will come out sometime this century - will be clearer. for now, just search the forums, there's a couple threads on this...
the long and short of it is, those are rotation matrices and you can find the formula for them anywhere. they involve a coordinate on two axes (e.g. x2/y2) and a rotation angle in the third (zt). the derivation of this matrix is quite a bit trickier, but i hope to get that into the tutorial as well.


21st May 2003 11:33 UTC

/me bowes to Atero, your Primer is great :)

[edit]
Me is googling a lot for Rotation Matrices, and finding a lot as well, though does anybody know the Dutch word for Rotation Matrices? It would be a lot easier for me to understand if it was in Dutch. Thx.
[/edit]


21st May 2003 20:10 UTC

ok I get the x2 and y2 part, somebody willing to explain z2, x3, y3 and z3?

and why is there an xt, yt and zt, and not just one var ( for example zt)? Does it matter a lot when you change it?


22nd May 2003 07:25 UTC

Each new set of coordinates must have a different name otherwise the first line would modify a value needed in the second line of the rotation matrix. x3,y3, and z3 could just have easilt been x1,y1, and z1. It's just easier not to get mixed up if they are x3, y3, and z3.

xt, yt, and zt are how much the shape is rotated per axis. If they are all the same varible the shape would only ever rotate in one direction unless it was recalculated between each rotation matrix. It saves a lot of clock cycles to have a different variable for each and only calculate them once per frame.


22nd May 2003 16:09 UTC

why are they all different? can't it be 3 times the same code line? I assume they all do the same operations, so why make it look difficult?


22nd May 2003 17:14 UTC

They do all do the same operation, but they do it with different values.


22nd May 2003 21:00 UTC

Also, it makes it much easier to understand and tweak the code that way. You could theoretically save a bunch of variables like this:
a=x; x=x*sin(zt)-y*cos(zt); y=a*cos(zt)+y*sin(zt);
a=x; x=x*sin(yt)-z*cos(yt); z=a*cos(yt)+z*sin(yt);
a=y; y=y*sin(xt)-z*cos(xt); z=a*cos(xt)+z*sin(xt);
but it's rather confusing and hard to tweak or fix. Also, say (hypothetically) you wanted to rotate an object by two different angles upon the X-axis. You couldn't do that with this setup, however if you were to take the original:
x2=x1*sin(zt)-y1*cos(zt); y2=x1*cos(zt)+y1*sin(zt);
x3=x2*sin(yt)-z1*cos(yt); z2=x2*cos(yt)+z1*sin(yt);
y3a=y2*sin(xta)-z2*cos(xta); z3a=y2*cos(xta)+z2*sin(xta);
y3b=y2*sin(xtb)-z2*cos(xtb); z3b=y2*cos(xtb)+z2*sin(xtb);
y3/z3a and y3/z3b would be the same object but rotated in different ways. Dunno what use this particular trick would be, but it sort of goes to show what you can do with this system....


25th May 2003 21:31 UTC

Ok, I'm definately a noob. I have very little previous programming knowledge, and I know very little about AVS. (Wow pretty colors, and, oh look this setting changes things) However I'm determined to figure out and learn how to make my own AVS. So where can I find all the info I need to get started? I think that would be the best tip of all.


26th May 2003 01:45 UTC

Take a look at this


26th May 2003 04:32 UTC

haha.. shit raz, you fooled me with that one


26th May 2003 17:06 UTC

lol @ raz.

Ok I think I understand the code from the Primer, now what's next in learning scopes?


27th May 2003 01:26 UTC

Well there is always the FAQ....:hang:


27th May 2003 01:28 UTC

hmm... well, if you understand the concepts of the scope, the next thing you need is an idea for a preset.
Once you have your idea, think about the ways to go about it in your head, and then wreak havok on your machine.

its a good idea to save text files or presets that have the basic structure for things that you dont need to recode every time you use them, eg. your 3d Engine for scopes, variouse DMs, a synched 3d DM and SSC, the RGB2HSL code ;) and whatever else you use often.


27th May 2003 15:27 UTC

k :)


28th May 2003 17:34 UTC

OK
:igor: :igor: ... Duhh... Sorry but i only understood like the first couple posts... I took two superscopes and glued em together and added color and i think it looks cool but not ... ya know, good.
Clear every frame to see the superscopes only.

Oh yeah, I'm assuming everyone has the color map APE. :)


29th May 2003 02:52 UTC

Two words to WH Code Red: Do More. Using an effect list, more effects, and your code will make better presets.

A little off the subject, but where do you find color map files? I can only use the black and white one.


29th May 2003 03:56 UTC

there are no color map files that come with color map.

You have to create new maps using the color-slider bar and then save them if you wish.

The save/load option is just for construction purposes. So that you dont have to make the same map more than once if you need it more than once. You dont need to get the colormap files to view a preset that has used it.


30th May 2003 08:55 UTC

Also to WH Code Red, pretty nice for a first scope. One tip, you could make 'em look a lot nicer when they move more, for example rotation. Figure out the coding for it yourself first, if that doesn't work, just reply here :)

EDIT:

Your shape changing scope will never work, cause you made the vars xr, and yr, and those don't exist :p

code for on beat: (just an example)

n=10; rx1=getosc(0,0,0); ry1=getosc(0,0,0);


1st June 2003 10:49 UTC

the easiest way (though not the best) is to close in the scopes a little to the center, and then add a dynamic movement:



for pixel:

d=d*0.75;
r=r+rt;

for per frame:

rt=rt+rts;

for on beat:

rts=getosc(0,0,0)*0.15

1st June 2003 21:20 UTC

Originally posted by Deamon
... you made the vars xr, and yr, and those don't exist
...They do if you want them to.... :weird:

3rd June 2003 22:08 UTC

?


4th June 2003 03:20 UTC

"Just wish for it... deep inside, you must burn for those things.. then, and only then, will they truely come to be."
-- Sean Connery on AVS variables


4th June 2003 10:41 UTC

lol. Now that was good, now let's cut the crap again and start posting some tips & tricks again :)

Nice movement: (works nice on a single SSC line or just the render/simple)


d=d+sin(r*30)/50;
r=r+sin(d*5)/50;


changing the numbers will really change the effect, try it out a bit. :)

4th June 2003 16:45 UTC

done and discussed that one already.


7th June 2003 05:17 UTC

A very useful tip
Atero showed me a great tip for making ssc more Dynamic than using the rand() function. He told me to the 'getosc( , , )' function. That way the ssc moves to the beat, almost completely randomized, and that scope now has sychronized movement with another scope that contains the same 'getosc( , ,)'. It's a usefull tip, it made my Presets more interesting than just things rotating in the same patteren.

This is the preset that Atero showed me how to make it more Dynamic, you can probably guess wich one has the 'getosc( , , )'


7th June 2003 09:20 UTC

I already knew that :). It indeed is a good tip, for the randomness is taken from the osciloscope data, it indeed looks fairly random, and it's great to synchronise multiple scopes or DM's.


8th June 2003 22:19 UTC

Thanks to everyone who helped me understand 3D scoping, I owe you guys :)


9th June 2003 09:42 UTC

I got another question (oh boy, here we go again :p). What exactly is Point to Point scoping, and how does it work?


9th June 2003 19:03 UTC

It's when you do a scope point by point or group of points by group of points.

There are 3 ways to do it, but for the sake of the community, let's use the more practical (and most compatible) one.

FRAME : p=0
POINT : p=p+1

This numbers the points such that the first point has the value of 1, the second 2, and so on.
How to use it?
x=if(equal(p,n),blah,blah1)
n is the pointnumber, blah can be anything, blah1 can also be anything - most likely to be a nested IF though.
And yes, I did say groups of points - use above/below/bor/band with it.
This way, making a wireframe is much less of a pain in the ass... But of course, it doesn't end there.
Presets with point-to-point-ing (and group-by-group-ing) :

Atero : Hypercube/Supercube (And presets that use the hypercube...), Cubism (Artist-like)**, Brownie*
UnConeD : Whacko IV Intro*, Anemone, Circuit City, Neon Coaster*
Nic01 : Your Typical Oscilloscope**, Dot Warpin'**, Randomly Walking*, Intro Pack 6*
fsk : Magnarings*

*i-based instead of p. Read on...
**Group-by-group, not quite p, but yeah, it's p. Tell me if you want more explanation...

Now, if you want to save a variable, you can use the i technique. Probably faster (can someone try?), but a little harder.
For this one, you directly use the i-value for the assigning. This makes this technique more suitable for n-numbers that can divide easily into 1... No, wait, n-1.
Why? Point #1 is counted as 0 in i, not 1/n. So for a 5-point SSC, you can easily use if(equal(i,0/0.25/0.5/0.75/1),blah,blah) - increments of 1/4, not 1/5. If you use increments of 1/5, it won't work...

Happy point-to-point-ing...


9th June 2003 19:47 UTC

Umm...as far as I can tell all of the ones you marked with asterisks are not point-by-point. And a much more practical way to do point-by-point scoping, since (once again, according to UnConeD) if(a,b,c) calculates b and c regardless of a, is this:
x=p1x*equal(p,1)+p2x*equal(p,2)...
It's a much better alternative, if simply for ease of reading and fixing.


9th June 2003 22:15 UTC

Ok, I'm going to give it a shot, now let's see how it works out ;). So if I'm right, you can draw pretty complicated figures with only one scope? Sweet... :)


9th June 2003 22:25 UTC

ok first question. The scopes first point always starts at coords (0,0,0) ?

[edit]
I think I see the solution: am I right when I say that N has to be equal to the number of P you use, or else he draws a line from (0,0,0) to the last point assigned by p?
[/edit]


10th June 2003 01:40 UTC

yes. if p doesn't equal any number that you've assigned it to then you're multiplying everything by 0.

and if you know how to use the edit button...why did you double post like that... :weird:


10th June 2003 02:28 UTC

Atero:

if(a,b,c) calculates b and c regardless of a, is this:
x=p1x*equal(p,1)+p2x*equal(p,2)...
Not really sure about this. A multiplication is a much bigger hit than an addition. The only thing that might even things out is that this way, you avoid jumps (depending on how equal() is implemented) which means no instruction-cache clear required. But I'm not really sure how it works on a P4/Athlon these days, they resemble a standard Pentium about as much as a Formula1 racer resembles the first car.

10th June 2003 06:12 UTC

well, ehm, since when is an if statement a smaller hit than a multiplication? and since when was the if(...,if(...,if(...))) structure using lots of additions?


10th June 2003 09:23 UTC

Till now Atero's method works just fine :)


10th June 2003 22:45 UTC

pwnt.

i've been meaning to ask, does avs automatically use bitshifting in the case of division/multiplication by powers of two?

and i know unconed's going to say "omfg omfg the code and the cpu are in seperate hemispheres of the grand universe and it really doesn't matter in the long run because you can't run in outer space" or something like that...
<edit> hmm...sounds like a smash mouth song, or something like that...


<edit2> Just remembered - I was working on my infamous comcrack with 32 megs of ram, and was testing to see if using Clear Every Frame was at all a speedup (since theoretically it would relenquish the memory used to save the image for other purposes). It turns out it's exactly the opposite. I turned on Clear Every Frame in Main and it dragged my preset by about 8 fps.
The moral of the story: Remember to check whether you need Clear Every Frame on when optimizing presets.


29th June 2003 11:23 UTC

Sorry for reviving this topic again, though I found it better to post here than to start a new topic. I was wondering if 3D DM bases are much different than the scopes (at least the technical part). For I now have a very nice SSC 3D base thanks to you guys, and now I was thinking about making a DM 3D base as well. I don't come much further than a surface, which I learned by plucking the most simple code for it written by Tuggummi:


d=d/(y*2.2+3)


Can anyone please explain me some basics? Thanks in advance.

29th June 2003 11:43 UTC

search.

the.

(friggin.)

forums.



and it's a sticky, how are you reviving it? :rolleyes:


29th June 2003 11:49 UTC

This is a sticky? Lol, not over here.


29th June 2003 21:23 UTC

Umm...err...uhh...WELL UR COMPOOTER MUST BE l4m3Z0r!!11


...

anyway, imo the threads should be merged.../me pokes rova


30th June 2003 04:38 UTC

wow. great topic
OK down to business. I still don't entirely understand what exactly the variable "i" is in SCCs. I know it has something to do with lines but my knowledge stops there. this is probably some Trig thing Im gonna have to learn when school starts right? well... its making my head explode bye bye


30th June 2003 04:45 UTC

It isn't sticky Atero. It probably should be, and the other tips and tricks is, but this one is not.

As to the meaning of i, look in the website thread. Annibus wrote a nice varible tutorial and posted it there. Tgere's also atreo's primer, and countless other stuff listed in the sticky FAQ.


2nd July 2003 22:43 UTC

In short:

i is a constant number for every pixel from 0 to 1. For everyone n there is an i. For example:when you set n=5 in init, i will be 0 0.25 0.5 0.75 and 1. This way, you won't have to type coords for every point but you can make one formula for the shape you want.

Example:

a circle requires a lot of point to really look like a circle and not some shape with a shitload of corners which has the look of a circle. You wouldn't want to type all those damn coords for it (undoable job anyways), so you use i. You set n to 500, which means there are 500 point calculated on your nice circle:

x=sin(i*tpi);
y=cos(i*tpi);

tpi is two times pi ( tpi=acos(-1)*2 ). the sin and cos together with tpi calculate the points on the circle.

My english isn't good enough to explain it as good as in my native language (dutch) to you, but I hope it helped. At least to make you see it aint nothing difficult to use, and doesn't require any more math than the really basics which are required to write scopes.

Good luck on SSC's,

Deamon

[edit]
maybe good to put some good version of this on webbie?
[/edit]


7th July 2003 17:59 UTC

Don't use additive blend. Use 50/50 blend + a fast brightness. It's the same thing in about 90% of the causes, but faster.


7th July 2003 20:30 UTC

runar, you're on crack. the calculation for (50/50 blend)*2 is ((a+b)*0.5)*2, whereas additive is simply a+b. that method not only reduces color depth by 50% but it also nicks about 0.3 fps on my comp (went from ~28.4 to ~28.1 using tuggummi's golden age preset as a benchmark)


7th July 2003 22:34 UTC

Heh. You can post as much mathematical nerd crap you want.
However, I do not see how you claim that the attached preset doesn't prove me right.


7th July 2003 22:37 UTC

Here we go.. I hope you have WinRAR.


7th July 2003 22:46 UTC

Press http://forums.winamp.com/images/edit.gif in the future.

Effect list two was twice as fast (64 opposed to 32), so, you just proved yourself wrong.

Additive is obviously faster than 50/50 + Fast Brite. As Atero said, you are just cancelling out the *.5 and *2.

[edit]
I think that you forgot to disable the first effect list before enabling the second one.
[/edit]


7th July 2003 22:55 UTC

Right, I give up, my computer must be seriously fucked, because here, effect list 1 is, as I stated, 25 FPS faster (55 contra 30).
I am indeed sorry, I see that I wet my pants.

And the Edit-function doesn't allow attachments


7th July 2003 22:57 UTC

you are forgiven :p


7th July 2003 23:14 UTC

Thank you!