Old 18th November 2002, 17:36   #1
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Tips&Tricks in AVS

As i have made avs for 2 years now, i really don't know much about how to do things differently.

Confused?
Read more.

As Advanced Visualization Studio is a highly customizable visualization plugin/component there are usually many ways to do simple things. And when it comes to coding your own superscopes and dynamic movements there are several different ways to make things, like in the dynamic movement using rectangular coordinates rather than polar coordinates to create the exactly same effect.

Sometimes if you do things differently you may gain some priviledges, like better frame rates or the benefits of using a different coordinate system. Also when you use the built-in functions differently you may get faster&better results than doing the same thing with different effects.


EXAMPLE
Creating a rotoblitter effect in movement with both polar- & rectangular coordinates.


Polar
r=r+0.1

BENEFITS:
Simple, easy and a fast way.


Rectangular
x=x+y*0.1 ;
y=y-x*0.1

BENEFITS:
You can shift it around the screen which can't be done in polar coordinates.


These helpful speed up tricks and better quality tips are scattered all over the forum, so what im asking here is to collect all those helpful notes into a single forum post, this post.

So feel free to post your ideas and comments how something that is frequently used can be done faster&better, this is all for the common good and will surely help us all as we are always searching a alternative way to make presets.

And please remember that, althought the most tips consider coding there is still many different ways to use the built-in effects differently and still get the same effect. If you have discovered a clever way of using example: Trans / Water , you can post it here so it will help other avs artists as well.

Hope you all understanded the point of this post and hope that you all contribute as much as you can

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 19th November 2002, 04:11   #2
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
Rotoblitter in polar:
r=r+spin;
d=d*(zoom+1);

Rotoblitter in rectangular:
x1=x; zoom2=zoom+1;
x=x*zoom2+y*spin;
y=y*zoom2+x1*spin;

Just a bit of a fix by your friendly local anal retentive AVSer...

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 19th November 2002, 04:28   #3
Jaheckelsafar
Major Dude
 
Join Date: Feb 2002
Location: home
Posts: 1,318
2 ways of shifting values, not sure which is executed faster:

value = value * (1-speed) + target * speed;

or

value = value + (taget - value) * speed;

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

- Arnold Rimmer
Red Dwarf
Jaheckelsafar is offline   Reply With Quote
Old 19th November 2002, 06:45   #4
Zevensoft
Major Dude
 
Zevensoft's Avatar
 
Join Date: Apr 2002
Location: Ballarat, Australia
Posts: 529
No order targeting:
value = target

First order targeting:
value = (value + target * speed) / (speed + 1)

Linear Interpolation:
value = value1 * position + value2 * (1-position)

Bilinear Interpolation:
value12 = value1 * posx + value2 * (1-posx)
value34 = value3 * posx + value4 * (1-posx)
value = value12 * posy + value34 * (1-posy)

Trilinear Interpolation:
value12 = value1 * posx + value2 * (1-posx)
value34 = value3 * posx + value4 * (1-posx)
value56 = value5 * posx + value6 * (1-posx)
value78 = value7 * posx + value8 * (1-posx)
value1234 = value12 * posy + value34 * (1-posy)
value5678 = value56 * posy + value78 * (1-posy)
value = value1234 * posz + value5678 * (1-posz)

1 | 2 | 3 | 4 | 3W | 4WW
Zevensoft is offline   Reply With Quote
Old 20th November 2002, 01:18   #5
mikm
Major Dude
 
mikm's Avatar
 
Join Date: May 2001
Location: somewhere else
Posts: 1,255
Two questions...

First order targeting is increasing a value by increments (speed), until it reaches target, right?

What is (bi/tri)linear interpolation?

powered by C₂H₅OH
mikm is offline   Reply With Quote
Old 20th November 2002, 02:54   #6
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Bilinear is interpolation linearly in 2D... like zooming on a picture, but instead of blocky pixels you get a blurry, smooth texture.

Trilinear is interpolation linearly in 3D. It's commonly used to interpolate bilinearly between textures and linearly between an MIP-maps on a 3D card.

UnConeD is offline   Reply With Quote
Old 20th November 2002, 08:06   #7
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
What i would like to know is: What is the fastest way to create a fullscreen gradient? I have used this method:

1 single ssc line

INIT: n=2
PER POINT: x=i*2-1 ; y=1

1 movement with rect coords (bilinear filtering on)
y=y-0.0x

It could also be done by using a gradient line and then using a movement with x=0.

Which way is faster? Or is there even a faster way to do it?

Thanks

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 20th November 2002, 09:05   #8
uNDefineD
Senior Member
 
uNDefineD's Avatar
 
Join Date: Jan 2002
Location: Melbourne, Australia
Posts: 297
Send a message via ICQ to uNDefineD Send a message via AIM to uNDefineD
Tug: in his HiRes pack that came with J7, jheriko used a vertical line, and a static movement with r=0. Looks awesome.
uNDefineD is offline   Reply With Quote
Old 20th November 2002, 09:35   #9
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
uNDefineD, it creates a conical gradient, right?

Different gradients:

Linear:


1 SuperScope

Init:
n=100 (the more numpoints the more accurate gradient)

Per Point:
x=i*2-1 ;
y=0 ;
col=i ;
blue=col ; red=col ; green=col


1 Movement

Rect Coords ON

Bilinear Filtering ON/OFF (not absolutly necessary, it looks ok even without it)

Code:
y=0



Radial:


1 SuperScope

Same as in Linear


1 Movement

Rect Coords ON

Bilinear Filtering ON

Code:
y=0 ;
x=d



Im not sure how the conical gradient is done, but i guess it's just using the r=0 movement and then using a color code in a superscope like col=sin(i*pi). I don't have avs right now so i can't check did i get those other two right, so ill edit this post tomorrow (at 8:XXam gmt +2).

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 20th November 2002, 10:48   #10
Zevensoft
Major Dude
 
Zevensoft's Avatar
 
Join Date: Apr 2002
Location: Ballarat, Australia
Posts: 529


Look in my 3rd pack (desert sunset) to see how to do fullscreen gradients in 1 scope.

1 | 2 | 3 | 4 | 3W | 4WW
Zevensoft is offline   Reply With Quote
Old 20th November 2002, 12:06   #11
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Well yes you can use just one superscope, but to fill the entire screen with just one superscope requires a big numpoint number and the bigger the resolution the more numpoints and more slower it is. With the scope and the movement technique the numpoint number always stays the same and still the whole screen gets filled with the gradient.

There for the movement and ssc technique is a lot faster than using one BIG ssc.

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 20th November 2002, 18:00   #12
nixa
Senior Member
 
Join Date: Jul 2002
Posts: 149
the fastest way I know to make a gradient is:
scope:

n=w*detail; < whith deatil going from 2/w to 1 >

x=x*2-1;y=0;
red=blabla;green=blablabla;green=blabla;

movement:

x=0;
nixa is offline   Reply With Quote
Old 21st November 2002, 00:42   #13
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
GRADIENTS :

Note : "v" stands for variable (Replace with something), and it will be number-tagged. Red/green/blue is to be coded yourself.

Vertical, Horizontal, and Radial gradients already mentioned. Remember, you can always use another D/M to morph the gradient into one desired.

Fullscreen Gradients :

Horizontal gradient (Colors cycling left-right) :

x=-1+i*2;
v1=bnot(v1) OR v1=1-v1
y=v1*2-1;

Vertical : Exchange x and y.

Polar : You'll need dot-grid and colorcode it... Too slow.

-You can combine Hor. and Ver. Gradients to make combinations. Experiment with render modes.

Cheap fullscreen combo gradient :

Use 2 lines, perpendicular, use a good linewidth (30-50 should do it), then use a movement to fill the screen. (Technique from several of UnConeD's presets) (Is it copyrighted? )

Dot-Grid :

http://forums.winamp.com/showthread....threadid=83695 - But I'll post the code here for convenience. The one here have edited variables to signify the new variables.

FRAME :

v1=w+1; v2=h+1; n=v1*v2; v3=0; v4=0; v5=1/ww; v6=1/hh;

POINT :

x=v3*v5*2-1; y=v4*v6*2-1;

v3=if(above(v3+1,v1),0,v3+1);
v4=if(v3,v4,v4+1);

--

But of course, that will be goddamn slow. You can always reduce the amount of points and manipulate the size to conform with the screen.
In colorcoding, use x and y, i won't work well. Additional tips are in the original page.

Examples : El-Vis - I Cannot Dance, Carry Me Home, Lucy In The Sky With Diamonds, and some others.

It's quite slow, but is the most versatile, providing you use the right effects. You can also use convolution filter to make the pixels bigger and make a pixel-doubled effect.

--

All I can think for now... I think there are more ways...

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 21st November 2002, 06:18   #14
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
DOH! I thought the edit time was 3 days (i don't remember where i heard that but it was somewhere around these forums, oh well...)

Ok Here we go again!

Gradients



Linear

Ssc

Init:
n=255

Per Point:
x=i*2-1 ;
y=0 ;
col=i ;
red=col ; green=col ; blue=col

Movement

Bilinear Filtering OFF
Rect Coords ON

Code:
y=0



Radial

Ssc

Same as in Linear

Movement

Bilinear Filtering OFF
Rect Coords ON

Code:
y=0 ;
x=-d*1.5+0.5



Rectangular

Ssc

Init:
n=255 ; pi=acos(-1)

Per Point:
x=i*2-1 ;
y=0 ;
col=sin(i*pi) ;
red=col ; green=col ; blue=col

2 Movements

1st
Bilinear Filtering OFF
Rect Coords ON

Code:
y=0


2nd
Bilinear Filtering OFF
Rect Coords ON

Code:
x=-if(above(y*y,x*x),y*y,x*x)*1.75+0.75 ;



Conical

Ssc

Same as in Rectangular


2 Movements

1st
Bilinear Filtering OFF
Rect Coords ON

Code:
y=0


2nd
Bilinear Filtering ON
Rect Coords OFF

Code:
r=((r-1.25)*1.25)*0.35 ;
d=r



This time i actually made them, so they now work right. If you have trouble understanding code, or are just lazy download these example presets i made. Includes all the 4 gradients and a "real" preset i made in about 10 minutes that uses a "Dynamic-Gradient-Utone"
Attached Files
File Type: zip gradients.zip (1.9 KB, 1194 views)

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 21st November 2002, 21:32   #15
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
Here are some code tips for you.

Optimise everything. Higher FPS makes your presets a lot nicer. Here are some examples:


3D transformation

x=x1/z1;
y=y1/z1;

can be made faster by using:

z1=1/z1;
x=x1*z1;
y=y1*z1;

using trig in conjunction with a timer can be made faster too:

on beat:

drx=0.2*getosc(0.2,0.2,0);

per frame:

rx=rx+drx;crx=cos(rx);

per pixel:

x=crx;
y=0;

Using this sort of thing a lot can make your code faster.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 22nd November 2002, 00:36   #16
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
3D transformation is:
Xp=Xc/Zc;
Yp=Yc/Zc;
where Xc (x-coordinate) and Yc are any numbers, positive or negative, and Zc is positive.
For a 3D object centered at the origin (0,0,0), use this formula:
Xp=Xc/(Zc+sqrt(mD));
Yp=Yc/(Zc+sqrt(mD));
where mD (maximum distance) is the largest distance from the origin to a point on the object.

Rotation around any point, line, plane, solid, etc:
Ar=Ac*sin(theta)+Bc*cos(theta);
Br=Ac*cos(theta)-Bc*sin(theta);
where A and B are the axes defining the plane perpendicular to the axial point/line/plane/solid etc. To find the perpendicular plane, simply use the 2 axes you do not use to define the axial object.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 22nd November 2002, 14:48   #17
nixa
Senior Member
 
Join Date: Jul 2002
Posts: 149
Quote:
Rotation around any point, line, plane, solid, etc:
Ar=Ac*sin(theta)+Bc*cos(theta);
Br=Ac*cos(theta)-Bc*sin(theta);
where A and B are the axes defining the plane perpendicular to the
axial point/line/plane/solid etc. To find the perpendicular plane,
simply use the 2 axes you do not use to define the axial object.


Another way to do this(slower way) is:
d=sqrt(Ac*Ac+Bc*Bc);r=atan2(Ac,Bc)+theta;
Ar=sin(r)*d;Br=cos(r)*d;
nixa is offline   Reply With Quote
Old 22nd November 2002, 17:29   #18
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
It's a whole lot slower, and it's much easier on AVS to use the rotation matrix

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 25th November 2002, 00:23   #19
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
That and you can optimise the rotation matrix if your not using it for a parameterisation or something else where the rotations change for every point.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 26th November 2002, 08:06   #20
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
I have a kind of a problem, I have used a static background/texture for a movement with bunch of effects. I have made it by putting all the effects inside a effectlist with ignore/replace and on beat active 1 frame. Then i have used a custom bpm set to 30bpm and put both of them inside another effect list with ignore/replace. It now takes about 1-3 seconds to start, but the fps is much higher since it doesn't have to render the texture all the time. This solution works fine, but what im asking is: Is there a even better way doing this? If you use avs effects to create a static background is there a way to only "render" it once? Or how i activate it right at the begin of a song?

Hope you understand

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 26th November 2002, 10:08   #21
nixa
Senior Member
 
Join Date: Jul 2002
Posts: 149
Tuggummi: I think there isnt any better way. I had the same problem some time ago and only thing I learned is how limited effect custom bmp is. Atero posted something at the whishlist about a user defined custom bmp so we can only wait for the next avs.
nixa is offline   Reply With Quote
Old 26th November 2002, 17:45   #22
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
You could just use Custom BPM and set it to skip as many beats as possible, then set First Skip to 1.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 26th November 2002, 22:39   #23
mikm
Major Dude
 
mikm's Avatar
 
Join Date: May 2001
Location: somewhere else
Posts: 1,255
3D SSC

Here is a wonderful guide to AVS written by El-vis that was posted a while ago. It gives code to create a superscope in 3D, rotate in along and move it along the x, y, and z axis (what's the spelling for the plural of axis?)
Attached Files
File Type: txt 3d-scope.txt (3.7 KB, 1154 views)

powered by C₂H₅OH
mikm is offline   Reply With Quote
Old 26th November 2002, 23:45   #24
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
I think it's 'axes'.

UnConeD is offline   Reply With Quote
Old 27th November 2002, 02:42   #25
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
A better 3D code system:

init: zs=sqrt(... *)

frame:
rx=rx+drx; ry=ry+dry; rz=rz+drz; cx=cos(x); sx=sin(x); cy=cos(y); sy=sin(y); cz=cos(z); sz=sin(z);

pixel:
... *
x2=x1*sz+y1*cz; y2=x1*cz-y1*sz;
x3=x2*sy+z1*cy; z2=x2*cy-z1*sy;
y3=y2*sx+z2*cx; z3=1/(y2*cx-z2*sx+zs);
x=x3*z3; y=y3*z3;

* This should be the maximum distance from the center to a point on your scope, multiplied by 2. For a unit sphere, use the radius of the sphere multiplied by 2.

** x1, y1, and z1 are the coordinates for your shape, and should be put here.

rx, ry, and rz are the angles of rotation around the x, y, and z axes, respectively. These angles are in radians (one radian = 180/pi degrees)
A good place to define these values is in the beat section of the scope, e.g.:
rx=rand(100)/1000-0.05; ry=rand(100)/1000-0.05; rz=rand(100)/1000-0.05;

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 27th November 2002, 08:53   #26
blazer1504
Senior Member
 
blazer1504's Avatar
 
Join Date: Dec 2001
Location: .fi
Posts: 155
Don't kill me for this, but you're just pathetic. You're stressing your head dozens of priceless minutes. And for what ?! For saving about 0.0001 fps with using a different method !?
Don't get me wrong. I'm sure that these tips comes in handy for n00bs and if there's alot to be optimized, but these tips.... It's like thinking how could you put the wires to your electric toothbrush from car, so that you could recharge the battery with it, so it wouldn't see in electric bill...
blazer1504 is offline   Reply With Quote
Old 27th November 2002, 09:41   #27
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Dear Degnic...

1) Are you talking to everyone who has replied to this forum or to one person and if, who?

2) The faster the presets run the more enjoyable they are, besides it's more than just 0.<insert ridiculous large ammount of zeros>1 frames, example the gradients work a lot faster when you use different methods. And the static texture for a 3D movement or likes saves up huge ammount of fps if it is only rendered once per N beats. I made a preset with the static texture and the framerate difference between render-per-N-beat and render-all-the-time is incredibly huge, on my 266mhz pentium it was about 8 fps.

3) Everything & Anything can & should be optimized. Or do you draw a static single colored ssc line with 800 numpoints when just 2 will do?

4) Last, but not least, this thread was about people sharing their ways of doing things. Someone have might used some method for months/years never knowing that it could be done better&faster.

If you don't like people giving you helpful advice, buzz off. But by the looks, you are the one who should seriously learn how to do things faster.

Have a nice day.

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 27th November 2002, 15:23   #28
Jaheckelsafar
Major Dude
 
Join Date: Feb 2002
Location: home
Posts: 1,318
I've done #3.

It almost got out, then Unconed saw it and I fived it.

It sped up the preset a lot.

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

- Arnold Rimmer
Red Dwarf
Jaheckelsafar is offline   Reply With Quote
Old 27th November 2002, 19:25   #29
nixa
Senior Member
 
Join Date: Jul 2002
Posts: 149
This is a trick that can save more than 100% fps.
When you need more sinchronised scopes shaped the same you can make a counter and copy this scope to several locations.
Example:

init:
n=500

frame:
t=t-0.05;u=0;

point:
u=u+1;u1=u%5;
d=i/5;r=t+i*3.14159*4;x=cos(r)*d;y=sin(r)*d+(u1+0.5)/5*2-1;

This will create 1 spiral scope and place it at u1/5*2-1 locations, u is a counter and equals the value of a point, u1 equals:
0 for u being 5,10,15,20,...
1 for u being 6,11,16,21,...
2 for u being 7,12,...
3 for u being 8,13,...
4 for u being 9,14,...

For a more complex use of this see the attachment. The preset calculates the whole 3D rotation thing, music responce and scope shape only once for all of the cn(6) columns.

Sorry for the shity explenation but i find it hard to express myself in english.
Attached Files
File Type: zip temple of avs.zip (1.3 KB, 1100 views)
nixa is offline   Reply With Quote
Old 27th November 2002, 19:29   #30
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
My (and most everyone who doesn't depend on El-Vis's engine) 3D code is several FPS faster than El-Vis's, and it's a whole lot more user friendly. Also, for those who didn't know: using zs=sqrt(maxdistance) projects the object so it is always inside the window. To find the maximum distance from the center of any object to a point on the object, use this method: For any variables (e.g. i and v), assume they are as high as they can go (e.g. i=1, v=1). Then simplify all your calculations. For example:
(tpi=acos(-1)*2=2*pi)

r=i*tpi;
x1=sin(r); y1=cos(r); z1=v/4;

r=1*tpi=tpi;
x1=sin(tpi)=0; y1=cos(tpi)=1; z1=1/4=0.25;

Now, find maxdistance like this:
sqrt(x1*x1+y1*y1+z1*z1)=sqrt(0*0+1*1+0.25*0.25)=sqrt(1.125)

So for the example scope, zs should equal sqrt(sqrt(1.125)*2)=pow(4.5,0.25).

If you want the scope to be slightly inside the frame, use a higher zs. If you want it to be slightly outside the frame, use a lower zs.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 27th November 2002, 22:56   #31
Zevensoft
Major Dude
 
Zevensoft's Avatar
 
Join Date: Apr 2002
Location: Ballarat, Australia
Posts: 529
Here's the engine I created for Matrix_Reality.

Dynamic Movement:
Init
code:

js=.002;pi=acos(-1);pitch=0;yaw=0;density=.33;



Frame
code:

j=if(above(j,1),-1+js*2,j+js);

ox=cos(j*pi)*.125;oy=sin(j*pi)*.5;oz=j*3.5;

ys=yaw;yaw=cos(j*pi)*.125;
roll=(roll*5-ys*5)*.0125;pitch=sin(j*pi)*.125;
pitch=if(above(abs(pitch),.5),sign(pitch)*.5,pitch);
cy=cos(yaw*pi);cx=cos(pitch*pi);cz=cos(roll*pi);
sy=sin(yaw*pi);sx=sin(pitch*pi);sz=sin(roll*pi);



Point
code:

dx=x;dy=y;dz=1;

tx=dx*cy-dz*sy;tz=dz*cy+dx*sy;
ty=dy*cx-tz*sx;dz=tz*cx+dy*sx;
dx=tx*cz-ty*sz;dy=ty*cz+tx*sz;

kx=if(above(dx,0),abs((ox-1)/dx),abs((ox+1)/dx));
ky=if(above(dy,0),abs((oy-1)/dy),abs((oy+1)/dy));
kz=if(above(dz,0),abs((oz-4)/dz),abs((oz+4)/dz));

k=min(min(kx,ky),kz);

utx=oz+dz*kx;uty=oy+dy*kx;utz=ox+dx*kx;
vtx=ox+dx*ky;vty=oz+dz*ky;vtz=oy+dy*ky;
wtx=ox+dx*kz;wty=oy+dy*kz;wtz=oz+dz*kz;

x=if(equal(k,kz),wtx,if(equal(k,kx),utx,vtx));
y=if(equal(k,kz),wty,if(equal(k,kx),uty,-vty));

alpha=(1/pow(2.71828,sqr(k*density)))*(1-abs(pow(j,5)));



Blend:On | Bilinear:On | Wrap:On | RectCoord:On

----------------

Superscope.
Init
code:

n=200;js=.002;pi=acos(-1);pitch=0;yaw=0;density=.33;bp=.5;



Frame
code:

bp=if(above(bp,-4),bp+.1,if(above(getspec(.1,.1,0),.25),-3.9,bp));bp=if(above(bp,8),-4,bp);
by=if(above(bp,4),by*1.1,.05);
ox=cos(j*pi)*.125;
oy=sin(j*pi)*.5;
oz=j*3.5;
sy=sin(-yaw*pi);
sx=sin(-pitch*pi);
sz=sin(-roll*pi);
cy=cos(-yaw*pi);
cx=cos(-pitch*pi);
cz=cos(-roll*pi);
pitch=if(above(abs(pitch),.5),sign(pitch)*.5,pitch);
roll=(roll*5-ys*5)*.0125;
pitch=sin(j*pi)*.125;
ys=yaw;yaw=cos(j*pi)*.125;
j=if(above(j,1),-1+js*2,j+js);



Point
code:

dx=cos(i*pi*20)*.01-ox;
dy=sin(i*pi*20)*.01-oy+by-.05;
dz=i*.05-oz+if(above(bp,4),4,3+(1-pow(1-(bp+4)*.125,3)*8))*.35;
tx=dx*cz-dy*sz;ty=dy*cz+dx*sz;
dy=ty*cx-dz*sx;tz=dz*cx+ty*sx;
dx=tx*cy-tz*sy;dz=tz*cy+tx*sy;
a=if(above(bp,-4),(1/pow(2.71828,sqr(dz*density))),0);
red=if(below(dz,.1),0,1)*a;
green=red;
blue=0;
k=1/if(equal(dz,0),1,dz);
x=dx*k;y=dy*k;



Draw: Lines
-------------------

The above is the room and a bullet from my Matrix_Reality preset. Here is a basic description of variables:
  • ox,oy,oz = Camera Position
  • pitch,roll,yaw = Camera Rotation Angles
  • density = Fog Density (Exponential Squared)
  • j = Synchronization Variable (js = timing speed)
It limits the pitch to +/-.5 (Vertical) so there aren't any gimble situations, and automatic roll is created for changes in yaw.
Attached Files
File Type: zip zevensoft_matrix_reality.zip (2.7 KB, 1221 views)

1 | 2 | 3 | 4 | 3W | 4WW
Zevensoft is offline   Reply With Quote
Old 27th November 2002, 23:51   #32
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
If you want to post long pieces of code, use <font=courier>...</font> (replace <> with square brackets) to prevent from stretching the page.

UnConeD is offline   Reply With Quote
Old 28th November 2002, 07:01   #33
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
Don't forget your manners, UnConeD

PLEASE USE COURIER!!!

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 28th November 2002, 08:58   #34
blazer1504
Senior Member
 
blazer1504's Avatar
 
Join Date: Dec 2001
Location: .fi
Posts: 155
No tug, you got me wrong. I'm not saying that every tip in this thread are total bullshit, but what I am saying is that this thread shouldn't be filled with codes / tips (and posts like this ) that doesn't affect to fps rate "efficiently" . I tried some of these and I really couldn't see any fps difference between code A and code B. If some method saves alot fps compared to the others, yeah it's good to be mentioned, but if it saves only like 0.1 fps you think that this thread should be filled with codes/tips like these ?? :P

And what comes to my presets. Usually the use of complex colors makes the preset slow. And colors aren't just that easy to optimize. Of course I always try to erase things you don't necessarily need & try to make it as fast as possible, but sometimes you just can't make it any faster without radical changes. Sure I can replace all those tricky colors with a Utone or two for some real boost up, but that's just not me....
blazer1504 is offline   Reply With Quote
Old 29th November 2002, 06:30   #35
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
Okay, just a tip...as long as we're on this page of
the thread, try just typing in your carriage returns
like this...

Anyway, just one thing to remember as AVSers: Any god
damned thing is possible in AVS once you put your
mind to it. Trust me, if I didn't keep telling
myself this, I wouldn't be doing any of what I've
been doing (i.e. 4D, life algorithms, etc.) I'd bet
money that Jheriko's been having to reasure himself
of this a lot for some of his scopes lately My
point is, you shouldn't just give up because you think
it can't be done. That's not a good reason. Give up
because you're lazy, or because you need to clip your
toenails, or for something important like that.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 29th November 2002, 14:48   #36
Jaheckelsafar
Major Dude
 
Join Date: Feb 2002
Location: home
Posts: 1,318
Here's a simple one that I'm sue everyone here knows. Might help a
noob though. (that is kinda what this thread was intended to do, right?)

sin, cos, and tan are all calculated from the radian value.
This means the wavs have a period of 2*PI.

sin(3.141) = sin(3.141) = sin(6.282) = 0
sin (3.141/2) = 1
sin (3.141*3/2) = -1

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

- Arnold Rimmer
Red Dwarf
Jaheckelsafar is offline   Reply With Quote
Old 2nd December 2002, 21:18   #37
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
Quote:
Originally posted by Atero
I'd bet money that Jheriko's been having
to reasure himself of this a lot for some
of his scopes lately
That is true.

I still have ideas that I'm forcing myself
into doing right now, the coolest AVS i've
made haven't been released yet because they
don't work properly, but like atero said,
anything is possible so I never give up on
them, I just keep working on them in the
background. Like that sonic battlefield from
pack VI, I'm still working on that on and off.

The point is never to give up, force yourself
through to the end. Thats more general life
advice though.


Here is something more useful though; I'm certain
that a lot of you out there know exactly what you
want to do in AVS but have no idea about what
sort of maths you need to do it. I'm also certain
that there are a lot of mathematical methods
that would be useful for AVS if we knew about them.
Personally I think that maths is pretty important
for AVS (the technical side at least) so if you
have any maths questions my tip would be to check
this cool page that I found, or alternatively send
me some mail. I'm not going to pretend to know
everything about maths but I have a lot of knowledge
and a lot of textbooks too.

jheriko@ntlworld.com

EDIT: Here are some trig identities to add to Jaheckelsafar's list, these will probably all have some applications in AVS, don't ask me what though:

code:


cos(pi/4) = sin(pi/4) = 1/sqrt(2)
cos(pi/6) = sin(pi/3) = sqrt(3)/2
cos(pi/3) = sin(pi/6) = 1/2

(sin(x))^2+(cos(x))^2 = 1
cos(x) = sin(x+pi/2)
cos(-x) = cos(x)
sin(-x) = -sin(x)
tan(x) = sin(x)/cos(x)
cot(x) = 1/tan(x) = cos(x)/sin(x)
sec(x) = 1/cos(x)
csc(x) = 1/sin(x)

sin(x+y) = cos(x)sin(y)+sin(x)cos(y)
sin(x-y) = cos(x)sin(y)-sin(x)cos(y)
cos(x+y) = cos(x)cos(y)-sin(x)sin(y)
cos(x-y) = cos(x)cos(y)+sin(x)sin(y)
sin(2x) = 2sin(x)cos(x)
cos(2x) = 2(cos(x))^2-1
cos(2x) = 1-2(sin(x))^2
cos(3x) = 4(cos(x))^3-3cos(x)
sin(3x) = 3sin(x)-4(sin(x))^3




There are a ton more things like this, identities
for cos(ax) and sin(ax) for instance, but I can't
remember them all off of the top of my head.

-- Jheriko

'Everything around us can be represented and understood through numbers'

Last edited by jheriko; 2nd December 2002 at 21:44.
jheriko is offline   Reply With Quote
Old 3rd December 2002, 07:31   #38
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
Damn...NOW I know why my trig teacher wanted me to memorize identities. She didn't show me the USEFUL ones.....

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 3rd December 2002, 12:16   #39
VisualAgnosia
Senior Member
 
VisualAgnosia's Avatar
 
Join Date: Nov 2002
Location: Australia
Posts: 190
Hey there,

I was wanting to ask, (I've spent the last week going throught the forums) If some one could give me a running example purley for reference how to create a plane in 3D SSC and effect it with this function

z=x*e^(-x^2-y^2)

I use a 3d ploting program that I'm used to and enter this

plot3d(x*exp(-x^2-y^2), x=-2..2 y=-2..2)

works fine .. You should see the triped stuff I'm getting "TRYING to emulate this to AVS.. I've totaly forgot how to rearange the "e" with log and I got paper and shit all over my desk and room. ahhhhhhhhh where's my text books... I'm also giving up smoking 3 days now.

z being the third axis of course, e is the exponent and ^ is to the power. Because I'm used to this program alot I tend to have blunders converting to AVS. Gimme a couple of weeks tho no probs but hey I'm always looking to learn quicker from some experienced bruzza'z.

If anyone feeling Crwayzie mabey give z=cos(x)*sin(y) a try and show us. I feel that if I see an example of something I've done I might be able to bridge the gap faster.



P.s. I's it just me or does anyone here alos go to sleep and end up dreaming about Freakin' equation's accompanied by some major tripped lighting visual dreams.... waaaaaaah. sheeesh If only I could remember what code I was dreaming I might be able to pull something awsome out of my subconcious ... I guess the best thing to say here is ...

Keep Dreaming

Rez---pec-t..

The VIzAG
VisualAgnosia is offline   Reply With Quote
Old 3rd December 2002, 19:46   #40
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
here's an idea: do your own work instead of expecting us to do it for you.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly 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