thanks, that works well, but i'd rather have it run on getspec or getosc so it works like other effects.
or is there some way to make a starfeild ssc?
Tips&Tricks in AVS
274 posts
starfield? megabuf() ! ^^
some framework for that:
[code]
frame:
pn=0;
point:
ix=megabuf(pn);
iy=megabuf(pn+1);
iz=megabuf(pn+2);
//to do: move the particles towards viewer
//to do: if(particles behind viewer) {put particles far away at a random position on a "spawn plane" or better yet in a "spawn cuboid"}
assign(megabuf(pn),ix);
assign(megabuf(pn+1,iy);
assign(megabuf(pn+2,iz);
pn=pn+3;
//to do: 3D transformation
//to do: color coding
some framework for that:
[code]
frame:
pn=0;
point:
ix=megabuf(pn);
iy=megabuf(pn+1);
iz=megabuf(pn+2);
//to do: move the particles towards viewer
//to do: if(particles behind viewer) {put particles far away at a random position on a "spawn plane" or better yet in a "spawn cuboid"}
assign(megabuf(pn),ix);
assign(megabuf(pn+1,iy);
assign(megabuf(pn+2,iz);
pn=pn+3;
//to do: 3D transformation
//to do: color coding
3d, not yet...
I'll just leave it how it is for now, thanks for your help though.
Only 8 presets to go utill i release my 2nd pack, stay tuned.
I'll just leave it how it is for now, thanks for your help though.
Only 8 presets to go utill i release my 2nd pack, stay tuned.
how about an ultimate aspect ratio correction? :P
The really cool thing about this is that is matches the Trans/Movement's own aspect ratio fixing, so you can align complex movements and renderers easily :P
This way your squares will look square, and circles circular, at all window sizes, even wierd ones.[frame:]
wh=w/h; hw=h/w;
aspy=if(above(hw,wh),wh,1);
aspx=if(above(wh,hw),hw,1);
[somewhere in pixel:]
x=your_final_x*aspx;
y=your_final_y*aspy;
The really cool thing about this is that is matches the Trans/Movement's own aspect ratio fixing, so you can align complex movements and renderers easily :P
You can make a starfield without any megabuf and just a single ssc:
[FRAME]
r1=1/7;r2=4/9;r3=5/3;
zo=gettime(0)*.1;
[POINT]
r1=r2*9333.2312311+r3*33222.93329; r1=r1-floor(r1);
r2=r3*6233.73553+r1*9423.1323219; r2=r2-floor(r2);
r3=r1*373.871324+r2*43322.4323441; r3=r3-floor(r3);
z1=r3-zo;z1=.5/(z1-floor(z1)+.2);
x=(r2*2-1)*z1;
y=(r1*2-1)*z1;
red=1-exp(-z1*z1); green=red; blue=red;
The idea is that r1,r2,r3 is a pseudo random generator. (i used the same approach in my gax preset).
[FRAME]
r1=1/7;r2=4/9;r3=5/3;
zo=gettime(0)*.1;
[POINT]
r1=r2*9333.2312311+r3*33222.93329; r1=r1-floor(r1);
r2=r3*6233.73553+r1*9423.1323219; r2=r2-floor(r2);
r3=r1*373.871324+r2*43322.4323441; r3=r3-floor(r3);
z1=r3-zo;z1=.5/(z1-floor(z1)+.2);
x=(r2*2-1)*z1;
y=(r1*2-1)*z1;
red=1-exp(-z1*z1); green=red; blue=red;
The idea is that r1,r2,r3 is a pseudo random generator. (i used the same approach in my gax preset).
The if statement in enabled=if(above(getspec(0,.5,0),a),1,0); is superfluous since above will return a 1 or 0 anyway. Personally I would use enabled=above(getspec(0,0,0),0);, but I'm at work so I cant test the effectiveness of that. If you wanted to blend it in and out:
playing=above(getspec(0,0,0),0);
fader=fader+(playing-fader)*speed;
alphaout=fader;
enabled=above(fader,0);
(The last line is just an optimisation)
speed=a value between 0 and 1 representing how fast you want it to blend in and out. You might be able to replace 'fader' with alphaout and get rid of the penultimate line but I dont know if AVS would allow it, sometimes its fussy like that. Again, I'm at work so I cant test if this would work or not 😁
playing=above(getspec(0,0,0),0);
fader=fader+(playing-fader)*speed;
alphaout=fader;
enabled=above(fader,0);
(The last line is just an optimisation)
speed=a value between 0 and 1 representing how fast you want it to blend in and out. You might be able to replace 'fader' with alphaout and get rid of the penultimate line but I dont know if AVS would allow it, sometimes its fussy like that. Again, I'm at work so I cant test if this would work or not 😁
Originally posted by fragmerlook into my presets since I am at deviantart that use 3D superscopes, i use this method since start of 2003 🙂
how about an ultimate aspect ratio correction? :P
[frame:]
wh=w/h; hw=h/w;
aspy=if(above(hw,wh),wh,1);
aspx=if(above(wh,hw),hw,1);
[somewhere in pixel:]
x=your_final_x*aspx;
y=your_final_y*aspy;
What do you want, a medal? 🙄
Dynamoves with bilinear filtering cause a slow fade out... This can be circumvented by this Colormodifier:
red=if(red,red+1/128,0);
green=if(green,green+1/128,0);
blue=if(blue,blue+1/128,0);
red=if(red,red+1/128,0);
green=if(green,green+1/128,0);
blue=if(blue,blue+1/128,0);
shorter:
red=if(red,red+1/128,0);
green=red;
blue=red;
even shorter:
red=assign(green,assign(blue,if(red,red+1/128,0)));
Color modifiers always have red==green==blue before the "level" section is executed, so if you want a monochrome color modifier (one that does the same to all colors), just modify one color and assign its value to the other colors.
red=if(red,red+1/128,0);
green=red;
blue=red;
even shorter:
red=assign(green,assign(blue,if(red,red+1/128,0)));
Color modifiers always have red==green==blue before the "level" section is executed, so if you want a monochrome color modifier (one that does the same to all colors), just modify one color and assign its value to the other colors.
Here's a cool little spiraly-like movement trans i wrote:
d=d*(0.7+(sin((r/$PI+($PI*(d*0.5)))*28)*0.08));
just thought someone might like it...
d=d*(0.7+(sin((r/$PI+($PI*(d*0.5)))*28)*0.08));
just thought someone might like it...
Sigmoid Motion - 3 Simple Examples
Attached is a zip file with 3 basic example avs using the sigmoid function. I thought these might be helpful for anyone who would like to get a basic sense of what the sigmoid function does.
A sigmoid is a line curved in two directions like an S. The sigmoid function can be used when you want a movement that starts out slow, speeds up, and then slows down again, e.g., like a plane taking off and landing.
sigmoid(value,value2)
= returns sigmoid function value of x='value' ('value2'=constraint)
The larger value2 is, the faster your acceleration, top speed, and deceleration will be.
Attached is a zip file with 3 basic example avs using the sigmoid function. I thought these might be helpful for anyone who would like to get a basic sense of what the sigmoid function does.
A sigmoid is a line curved in two directions like an S. The sigmoid function can be used when you want a movement that starts out slow, speeds up, and then slows down again, e.g., like a plane taking off and landing.
sigmoid(value,value2)
= returns sigmoid function value of x='value' ('value2'=constraint)
The larger value2 is, the faster your acceleration, top speed, and deceleration will be.
Hi,
Earlier in the thread Tuggummi was musing about the possibilities of animated bitmaps. This was like maybe 4 or 5 pages ago. I don't know for sure if anyone offerred a solution. I found an application called BMP2AVI while browsing a favorite haunt of mine. It's freeware(yay🙂). Here's the link: http://www.divx-digest.com/software/bmp2avi.html
Don't even bother trying to check out the homepage, as it seems to have vanished. However the application can be downloaded via the direct download link(I only downloaded the gui version).
Maybe with that handy little utility(looks handy, haven't used it yet personally), someone can do some nifty animation that might be a great deal more difficult to code, than to simply draw🙂
I'm sorry if it's a useless app. I mean, I have only just started with AVS(really should stop telling folks that), and so I don't know how well the AVI render works.
*Fingers Crossed* I hope it does the trick, you have done some really amazing stuff without animated .bmp so I think with animation you might do still more amazing stuff(or it could turn to rubbish, but if that happened you'd just stop using non-AVS generated animations right?)
Earlier in the thread Tuggummi was musing about the possibilities of animated bitmaps. This was like maybe 4 or 5 pages ago. I don't know for sure if anyone offerred a solution. I found an application called BMP2AVI while browsing a favorite haunt of mine. It's freeware(yay🙂). Here's the link: http://www.divx-digest.com/software/bmp2avi.html
Don't even bother trying to check out the homepage, as it seems to have vanished. However the application can be downloaded via the direct download link(I only downloaded the gui version).
Maybe with that handy little utility(looks handy, haven't used it yet personally), someone can do some nifty animation that might be a great deal more difficult to code, than to simply draw🙂
I'm sorry if it's a useless app. I mean, I have only just started with AVS(really should stop telling folks that), and so I don't know how well the AVI render works.
*Fingers Crossed* I hope it does the trick, you have done some really amazing stuff without animated .bmp so I think with animation you might do still more amazing stuff(or it could turn to rubbish, but if that happened you'd just stop using non-AVS generated animations right?)
cos and sin functions , as most people know, clamp variables between 1 and -1, but the thing is, cos/sin doesn't just flip when in reaches -1 or 1, it slows down, so when it reaches 1 or -1 it is actually at a dead stop and then goes so slow it goes backwards. sin/cos is fine for movement, but not for counters or any other types of timers, because the rate of change will increase as it gets closer to 0 and then start slowing down. Here's a nifty piece of code that keeps the rate of change constant and still clamps between 1 and -1:
Frame:
a=a+if(equal(a3,0),0.02,if(equal(a3,1),-0.02,a2));
a2=if(above(a,1),assign(a3,1),if(below(a,-1),assign(a3,0),0));
Pixel;
whatever=a1
there you go. a lot longer, but keeps a constant speed.
Frame:
a=a+if(equal(a3,0),0.02,if(equal(a3,1),-0.02,a2));
a2=if(above(a,1),assign(a3,1),if(below(a,-1),assign(a3,0),0));
Pixel;
whatever=a1
there you go. a lot longer, but keeps a constant speed.
A faster way:
Triangular wave for an SSC:
Triangular wave for an SSC:
for general use:x=i*2-1;
y=asin(sin(i*$pi*2))/asin(1);
frame:
t=t+.05;
numwave=3;
point:
y=asin(sin(t*$pi*2*numwave))/asin(1);
Faster? your method uses two asins a sin and 3 multiplications... thats slower.
slower, ok.. but no step sizes
yeah, take that wotl! :P
Hi everyone!
Wrote a 3d rotation engine powered by Linear Algebra:
Init:
rx=...; ry=...; rz=...;
Per Frame:
srx=sin(rx); sry=sin(ry); srz=sin(rz);
crx=cos(rx); cry=cos(ry); crz=cos(rz);
r11=cry*crz; r12=-cry*srz; r13=sry;
r21=srx*sry*crz+crx*srz; r22=-srx*sry*srz+crx*crz; r23=-srx*cry;
r31=-crx*sry*crz+srx*srz; r32=crx*sry*srz+srx*crz; r33=crx*cry;
Per Point:
x1=...; y1=...; z1=...; //3D object
x2=r11*x1+r12*y1+r13*z1;
y2=r21*x1+r22*y1+r23*z1;
z2=r31*x1+r32*y1+r33*z1;
The point is to compute the entries of a full rotation matrix in the per frame section (instead of per point rotation). Hope this works faster, haven't tried it yet.
Wrote a 3d rotation engine powered by Linear Algebra:
Init:
rx=...; ry=...; rz=...;
Per Frame:
srx=sin(rx); sry=sin(ry); srz=sin(rz);
crx=cos(rx); cry=cos(ry); crz=cos(rz);
r11=cry*crz; r12=-cry*srz; r13=sry;
r21=srx*sry*crz+crx*srz; r22=-srx*sry*srz+crx*crz; r23=-srx*cry;
r31=-crx*sry*crz+srx*srz; r32=crx*sry*srz+srx*crz; r33=crx*cry;
Per Point:
x1=...; y1=...; z1=...; //3D object
x2=r11*x1+r12*y1+r13*z1;
y2=r21*x1+r22*y1+r23*z1;
z2=r31*x1+r32*y1+r33*z1;
The point is to compute the entries of a full rotation matrix in the per frame section (instead of per point rotation). Hope this works faster, haven't tried it yet.
Originally posted by q-visOnly 2 multiplications faster (per point) that "regular" rotation, but you have to remultiply all matrices if you want to change rotation order, with "regular" method you do not have to do this. Also, this code is much harder to eyeball.
Hi everyone!
The point is to compute the entries of a full rotation matrix in the per frame section (instead of per point rotation). Hope this works faster, haven't tried it yet.
as in "regular" rotation code i mean regular as in what avsers are using.
That means, I wrote that horrible matrix for nothing?!!
Well, at least it's 0.00000000001 fps faster 😁
Well, at least it's 0.00000000001 fps faster 😁
Originally posted by JaakThat is a trivial effort, and is no harder to do for one method than the other. If you really want to go all out on optimisations combine your matrices and then combine them reversed... once you do it once thats it. Has anyone in here ever derived a rotation matrix from anything other than somebody elses preset? (I know some have... you get the point tho...) So whats wrong with copy pasting that block of code, you save 4 muls per point, not much but I've seen more done for less speed before.
Only 2 multiplications faster (per point) that "regular" rotation, but you have to remultiply all matrices if you want to change rotation order, with "regular" method you do not have to do this.
Is there anyway we could see some new tricks and tips? Gradients are on THE FIRST PAGE. The aspect ratio and rotation matrix have been mentioned literally dozens of times before in these forums (though maybe not on this thread).
So that I'm not wasting a post... here is a tip:
About 80% of the time everything else is more expensive than coded components in terms of framerate. If you have 10 effect lists, 3 waters and 2 bumps and your favorite renders are SVP loaders then no amount of code optimisation will speed that preset up.
One of the most annoying mistakes I see in presets is the use of <insert large number here> components to achieve the effect of 1 or 2, almost always with the result of making the computer strain to draw what is already a really crappy preset. Nothing screams n00b and 'I don't learn from other peoples mistakes, or off my own back' like this particular error.
I know I have made some really slow presets... but what do they do... render a blurry bumpy kaleidoscope with a dot fountain in front of it?. Don't think so. When you know basically how AVS works (i.e. that it follows a sequential execution path and that each component takes time to execute) its actually pretty difficult to make a preset that suffers from 'too many bumps', or whatever, by mistake.
Try to use simple superscopes or simple movments or dms, although its tempting to use water, bump and color map all the time, please don't. All these effects do is give your preset the same tired look as hundreds of others that rely on these effects, and at the same time you are probably wasting framerate, since these sorts of effects can normally be replaced with something reasonably similar that runs a lot faster, using some clever movements, sscs or convo filters, or even just by coding it right in the first place. Unique tones and colour maps aren't for colouring in superscopes, the red, green and blue variables are!
[ /rant ]
edit: 10 points to Mr Nudge on the triangular wave... thats a good tip as many n00bs will go straight for the silly sin approach <cough>WotL<cough>. 😛
Originally posted by jherikoI have lots of tips, but they are all code optimisations that most people arent interested in.
Is there anyway we could see some new tricks and tips? Gradients are on THE FIRST PAGE. The aspect ratio and rotation matrix have been mentioned literally dozens of times before in these forums (though maybe not on this thread).
About 80% of the time everything else is more expensive than coded components in terms of framerate. If you have 10 effect lists, 3 waters and 2 bumps and your favorite renders are SVP loaders then no amount of code optimisation will speed that preset up.@jheriko: That's all right, undoubtly. But the remaining 20% is for the avs freak creating dozens of rotating superscopes with a not-so-perfect engine, wasting tons of multiplications😉
Besides, I've got a little question: I want to release my first AVS pack soon (worked on that 2 years), created also the Installer and so on, but I've read something in this thread like "first, put it here for discussion". Is that right? Sorry if I post it here, but I've already searched throughout the forum.
It's great for betatesting/comments before final release
^
that post was offtopic
next time create a new thread for different questions please.
^
that post was offtopic
next time create a new thread for different questions please.
I don't know if this has been made in any kind of interest but how do i make a Solid object? I have been looking and looking, i've done some stuff with depth and want a filler instead of a grid...otherwise it looks crap 😛
^post that in the troubleshooting forum.
you should know by now where to post.
Keep this thread clean please and do not reply.
And search the forums.. it's been asked a million of times
you should know by now where to post.
Keep this thread clean please and do not reply.
And search the forums.. it's been asked a million of times
(well it was for other newbies who decided to ask you can refer them to that now)
PAK-9's programming guide has a part for solid scopes
Here's what I use for 3D rotation:
x2=x1*cos(a1)+y1*sin(a1);
y2=-x1*sin(a1)+y1*cos(a1);
x3=x2*cos(a2)+z1*sin(a2);
z2=-x2*sin(a2)+z1*cos(a2);
y3=y2*cos(a3)+z2*sin(a3);
z3=-y2*sin(a3)+z2*cos(a3);
x1,y1,z1 are the coordinates of the object.
x3,y3,z3 are the final coordinates of the rotated object
x2,y2,z2 are just temporary
a1,a2,a3 are the three angles of rotation (xoy, xoz, yoz)
Is there any better way to do this? Basically I am using 3 diffrent planar rotations, I couldn't find any good formulas for a 3D rotation.
Also, this is what I use for 3D transformation, and I think it's the best way, because besides zoom, it's got perspective correction.
x=((x3*z0)/(z0-z3))/(z0-1);
y=((y3*z0)/(z0-z3))/(z0-1);
x3,y3,z3 are the object coordinates, z0 is the zoom.
If anyone got an optimisation for this... I'd gladly use it.
x2=x1*cos(a1)+y1*sin(a1);
y2=-x1*sin(a1)+y1*cos(a1);
x3=x2*cos(a2)+z1*sin(a2);
z2=-x2*sin(a2)+z1*cos(a2);
y3=y2*cos(a3)+z2*sin(a3);
z3=-y2*sin(a3)+z2*cos(a3);
x1,y1,z1 are the coordinates of the object.
x3,y3,z3 are the final coordinates of the rotated object
x2,y2,z2 are just temporary
a1,a2,a3 are the three angles of rotation (xoy, xoz, yoz)
Is there any better way to do this? Basically I am using 3 diffrent planar rotations, I couldn't find any good formulas for a 3D rotation.
Also, this is what I use for 3D transformation, and I think it's the best way, because besides zoom, it's got perspective correction.
x=((x3*z0)/(z0-z3))/(z0-1);
y=((y3*z0)/(z0-z3))/(z0-1);
x3,y3,z3 are the object coordinates, z0 is the zoom.
If anyone got an optimisation for this... I'd gladly use it.