![]() |
#241 |
Major Dude
Join Date: Feb 2004
Location: Germany
Posts: 580
|
3 planar rotations are what you might call "3D rotation"
btw you could cache the cosines and sines for optimization, since (co)sine is a very expensive operation look at that other thread you opened for info on how to optimize the divisions If you can't say something nice, say something surrealistic. |
![]() |
![]() |
![]() |
#242 |
Member
Join Date: Jan 2006
Location: Environment
Posts: 87
|
A surrealistic thing: this looks like a star.
init n=k0*600; tpi=2*acos(-1); point d=k1*v+i*tpi; x=x0+pow(cos(d),3)*kx; y=y0+pow(sin(d),3)*ky; k0, k1, kx, ky, x0, y0 are optional values, they equal to 0 (x0, y0) or 1 (k) by default; If this is well-known, I post it for reference. This is a bit oldschool, isn't it? Thanks ![]() |
![]() |
![]() |
![]() |
#243 |
Major Dude
Join Date: Feb 2004
Location: Germany
Posts: 580
|
a bit misplaced maybe, since this is about tips&tricks and not about specific scopes
things like rotation are used in many presets and in many different scopes, texers, DMs and whatnot in other words: rotation is part of the basics. your scope is not If you can't say something nice, say something surrealistic. |
![]() |
![]() |
![]() |
#244 | |
Major Dude
Join Date: Feb 2004
Location: Germany
Posts: 580
|
Quote:
dont write things like if(boolean expression,1,0) the if there is superfluous, since above returns 1 for true and 0 for false (as documented) If you can't say something nice, say something surrealistic. |
|
![]() |
![]() |
![]() |
#245 | |
Senior Member
|
Quote:
There. Thank goodness for the floor() function!code: |
|
![]() |
![]() |
![]() |
#246 |
Forum King
|
Raytracing...
I keep teaching people how to raytrace... so this time I made a half decent resource:
http://tutorials.jheriko.kicks-ass.net/ |
![]() |
![]() |
![]() |
#247 |
Member
Join Date: Jan 2006
Location: Environment
Posts: 87
|
I need an advice on time-based evaluation.
eg set=rand(n) is evaluated approx. every 5 seconds. m1=equal(set,1); m2=equal(set,2);... go on after 'set' changes. I used to make expressions like change=bor(below(t*k-floor(t*k),deltat*0.5),above(t*k-floor(t*k),1-deltat*0.5)); with t*k-floor(t*k)(main expression), deltat*0.5 cached at the beginning, in timer based on expression timer=t*k-floor(t*k). It works, but is too approximate, even more: this timer automates one variable, and cannot randomize. And it seems the best solution is to work on custom BPM: Skip 7 beats. |
![]() |
![]() |
![]() |
#248 |
Major Dude
Join Date: Feb 2004
Location: Germany
Posts: 580
|
yay random code for the win
If you can't say something nice, say something surrealistic. |
![]() |
![]() |
![]() |
#249 | |
Forum King
|
Quote:
its like three totally disconnected statements glued together... |
|
![]() |
![]() |
![]() |
#250 |
Bin King
Join Date: Mar 2001
Location: Finland
Posts: 2,173
|
Wow, when i made this long-long time ago i thought this would bring all neat or often used tricks and whatnot together to a nice package, but now it seems that this is more cluttered than the AVS forums itself
![]() In short, this thread makes little sense anymore ![]() |
![]() |
![]() |
![]() |
#251 |
Forum King
Join Date: Aug 2002
Location: The Netherlands
Posts: 4,116
|
it needs a refresh indeed.. .pdf anyone?
![]() Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever |
![]() |
![]() |
![]() |
#252 |
Major Dude
Join Date: Dec 2005
Location: Canada
Posts: 940
|
Question: How do you get the liquid effect using a dm?
Those who can do, do; those who can't do, teach. |
![]() |
![]() |
![]() |
#253 | |
Member
Join Date: Jan 2006
Location: Environment
Posts: 87
|
Quote:
The stuff that is sandwiched beetween is what I meant a general question. |
|
![]() |
![]() |
![]() |
#254 | |
Forum King
|
Quote:
|
|
![]() |
![]() |
![]() |
#255 | |
Major Dude
Join Date: Feb 2004
Location: Germany
Posts: 580
|
eeltrans macros for HSL -> RGB conversion:
Quote:
code: If you can't say something nice, say something surrealistic. |
|
![]() |
![]() |
![]() |
#256 |
Member
Join Date: Jan 2006
Location: Environment
Posts: 87
|
Anybody could they say why the code is so unefficient...
Its purpose was to draw a border with length halfx*2, width halfy*2, and this code is supposed to be optimised. SuperScope, n=535. //init halfx=100; halfy=50; opts=0.5/(halfx+halfy); sqd=sqr(opts); rej1=opts*halfx; rej2=opts*halfy; //frame rlw=halfx/w; rlh=halfy/h; //point x=if(above(i,rej1),if(above(i,0.5),if(above(i,0.5+rej1),-rlw,(i-0.5)*n*halfx*sqd*2-rlw),rlw),i*n*halfx*sqd*2-rlw); y=if(above(i,rej1),if(above(i,0.5),if(above(i,0.5+rej1),(i+rej2-1)*n*halfy*sqd*4-rlh,rlh),(i-rej1)*n*halfy*sqd*4-rlh),-rlh); |
![]() |
![]() |
![]() |
#257 | |
Forum King
|
Quote:
1.) Cache some multiplies to remove per point muls: //frame rlw=halfx/w; rlh=halfy/h; opt=2*n*sqd; //point x=if(above(i,rej1),if(above(i,0.5),if(above(i,0.5+rej1),-rlw,(i-0.5)*opt*halfx-rlw),rlw),i*opt*halfx-rlw); y=if(above(i,rej1),if(above(i,0.5),if(above(i,0.5+rej1),(i+rej2-1)*opt*halfy*2-rlh,rlh),(i-rej1)*opt*halfy*2-rlh),-rlh); 2.) Don't use points to draw lines when there is a line tool available. The 'lines' superscope option enables a c++/asm line drawing routine, this is orders of magnitude faster than any evallib routine... // innit n=4; halfx=100; halfy=50; // frame rlw=halfx/w; rlh=halfy/h; c=0; //point x=if(c%2,rlw,-rlw); y=if(above(c,1),rlh,-rlh); c=c+1; 3.) Make it do what its supposed to, notice how the rectangle resizes in a crazy way when you resize the window, you need aspect ratio correction. // innit n=4; halfx=100; halfy=50; // frame asp=h/w; rlw=halfx/w; rlh=halfy/h; c=0; //point x=if(c%2,rlw,-rlw); y=if(above(c,1),rlh,-rlh); c=c+1; |
|
![]() |
![]() |
![]() |
#258 |
Banned
Join Date: Jun 2006
Location: 439 East District, Mount Paozu
Posts: 57
|
Can I change thses values t=reg11;
e=equal(t,-1); ym=if(e,(rand(20)-10)*-.1,ym); xm=if(e,(rand(20)-10)*.1,xm); reg22=ym; to: g=abs(getosc(.7,.3,0)); s=if(above(g,s*.5),s+.03,s-.03); ym=if(below(ym,-1),1,ym-.01); xt1=xt1+.0277; xb2=xb2*.98; xt2=xt2+xb2; For getting trigonometry around together? |
![]() |
![]() |
![]() |
#259 |
Major Dude
Join Date: Feb 2004
Location: Germany
Posts: 580
|
1. What the HELL is that?
2. trigonometry? 3. What the hell is THAT? 4. Did you read PAK-9's AVS Programming Guide? 5. What the hell IS that? 6. oh and btw, stealing code without crediting is BAAAAD, ok? If you can't say something nice, say something surrealistic. |
![]() |
![]() |
![]() |
#260 | |
Forum King
|
Quote:
|
|
![]() |
![]() |
![]() |
#261 |
Major Dude
Join Date: Feb 2004
Location: Germany
Posts: 580
|
almost like those people who join help channels and then query the ops for help
or even worse, some even send channel notices... If you can't say something nice, say something surrealistic. |
![]() |
![]() |
![]() |
#262 |
Senior Member
Join Date: Apr 2006
Location: Planet Shintovia
Posts: 383
|
Help
I've been trying to make a set of code that detects a exact value and resets the variable to value i want. can that be done? its for a annoying dynamove i'm trying to stop from going to far with a zooming effect.
As far as idiots go i'm not sure. But as far as genius goes again i'm not sure. Now when it comes to imagination now thats another story. |
![]() |
![]() |
![]() |
#263 |
Forum King
Join Date: Aug 2002
Location: The Netherlands
Posts: 4,116
|
You should know very well by now that this is not the idea of this thread.
Next time, create a new thread with what you have so far (no matter how little) instead. but to answer your question and to get this over with: code: Since you don't want myvar to go to go over a specific value, you could also (or better) use above(a,b) instead of equal(a,b) But all this are basic operations which you could easially have found yourself in the expression help. Please don't reply here Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever |
![]() |
![]() |
![]() |
#264 |
Senior Member
Join Date: Apr 2006
Location: Planet Shintovia
Posts: 383
|
i'm looking for some useful tricks to making menus in avs.
also i'm very much wanting to know how to make global sliders and junk to control certain aspect of my presets. anything would be nice. and WoTL this does comply with the idea of this thread. As far as idiots go i'm not sure. But as far as genius goes again i'm not sure. Now when it comes to imagination now thats another story. |
![]() |
![]() |
![]() |
#265 |
Forum King
Join Date: Aug 2002
Location: The Netherlands
Posts: 4,116
|
This isn't a discussion thread, which means posting code only. (not requests)
See the attached file, some parts may be unoptimized Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever |
![]() |
![]() |
![]() |
#266 |
Senior Member
Join Date: Oct 2006
Posts: 327
|
You can attempt to pull the menu out of this one. The slider is alot simpler.
Note: you need globmgr.ape (included). |
![]() |
![]() |
![]() |
#267 |
Banned
Join Date: Mar 2007
Posts: 1
|
*crap removed*
|
![]() |
![]() |
![]() |
#268 |
Banned
Join Date: Jun 2007
Posts: 6
|
*crap removed*
|
![]() |
![]() |
![]() |
#269 |
Junior Member
Join Date: Nov 2007
Posts: 29
|
Converting Movement Equations Polar (r,d) to Parametric (x,y)
I've been working for sometime trying to change polar movement equations into parametric. After looking at a few presents, this is what I came up with:
midx=//x pole goes here; midy=//y pole goes here; r=atan2((x-midx),(y-midy)); rx=-cos(r); ry=sin(r); dx=sin(r); dy=cos(r); d=abs(sqrt(pow(y+midy,2)+pow(x+midx,2)))*2; midx and midy are the x and y cordiants for the pole (equivilant to the origin in parametric), or the center of the polar equation. r is the angle counterclockwise from the ray starting at the pole and extending right, and d is the distance from the pole. rx,dx,ry,dy are the direction of the vector. The first letter is what type of direction (distance or radial) and the second letter is what variable goes under (rx would go under the x=, and dy would go under the y=, etc) The Vector is comprised of a direction times the distance. This all may be a bit confusing so here are some sample equations: (asume midx and midy equals 0) CONVERTING: r=r+.1; d=d+.1; TO x=x+rx*.1+dx*.1; y=y+ry*.1+dx*.1; If you want to multiply a direction by the distance or angle use r or d: CONVERTING: r=r+.1/(d+.2); TO x=x+rx*.1/(d+.2); y=y+ry*.1/(d+.2); I like the equation but the converting process can get kind of annoying. feel free to use any of this and please comment! ![]() A fun little program: in the dynamic movements point box: midx=getkbmouse(1); midy=getkbmouse(2); ang=atan2((x-midx),(y-midy)); rx=-cos(ang); ry=sin(ang); dx=sin(ang); dy=cos(ang); d=abs(sqrt(pow(y+midy,2)+pow(x+midx,2)))*2; x=x+rx*.05/(d+.2)*sin(d*6)-dx*.05*sin(r*6); y=y+ry*.05/(d+.2)*sin(d*6)-dy*.05*sin(r*6); //move your mouse around and have fun!! |
![]() |
![]() |
![]() |
#270 |
Senior Member
Join Date: Oct 2005
Location: Germany
Posts: 338
|
framerate-independent movement
there's been some discussion on and off about how to achieve framerate-independence for variables changing over time. with little result. so i finally sat down and calculated it all out. here's how it goes, a quick tutorial about how to make your SSCs, DMs, Triangles and TexerIIs move with the same speed regardless of the fps [frames per second] AVS runs with:
there's three different kinds of changing a variable's value over time that i use frequently. they are of the shape: code: well looks good but these above depend on how fast your preset runs. so the first thing you need to know is how fast your preset actually runs. you can calculate that by using: code: this gives you the inverted fps*, here called "speed". i'll spare you the why's and how's and will just give you the equations. in the first one m is simply multiplied by 'speed' whereas in the other two cases you basically substitute s for a modified 'speed' value [which is the interesting part about this ![]() code: again s is a constant >0 and <1 which gives the speed of the change: low s -> faster motion. high s -> slower motion. dfps is the desired or simulated framerate set by you. it's a constant, maybe 20 to 50. do not use the actual calculated fps! have fun, grandchild _____________ *) note that this will give you the raw, fluctuating fps, not the number shown in the editor or fullscreen. but this is usually sufficient to get a decent result. ![]() ...and if you should need it: the fps is now calculated with 1/speed. |
![]() |
![]() |
![]() |
#271 | |
Junior Member
Join Date: May 2008
Posts: 1
|
Re: Two questions...
Quote:
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. |
|
![]() |
![]() |
![]() |
#272 |
Major Dude
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
|
not sure if anyone comes round here that often anymore, but nevertheless, here's some nifty code i made for mouse control.
//frame gmx=getkbmouse(2); gmy=getkbmouse(1); gmc=getkbmouse(3); mos=below(abs(gmx),1)*below(abs(gmy),1); gmc2=if(mos*gmc,1,if(bnot(gmc),0,gmc2)); gmc3=if(bnot(gmc2)*bnot(mos),0,if(bnot(gmc)*mos,1,gmc3)); os=gmc2*gmc3; -- basically, os returns 1 when you left click on the avs window and will keep returning 1 as long as the left mouse button is held, even if the mouse moves off the window. os will return 0 at all other times, even if the left mouse button is held then dragged onto the avs window. |
![]() |
![]() |
![]() |
#273 |
Junior Member
Join Date: May 2013
Posts: 7
|
First order targeting is increasing a value by increments (speed), until it reaches target, right?
What is (bi/tri)linear interpolation? |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|