Old 3rd June 2004, 10:09   #201
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
a lot of formulae there, you're right... problem is that it's listed by name/category, so you have to know the name/category to find a formula... but thanks for the link i think i'm just gonna try random 4th degree polynomials with raytracing

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 7th June 2004, 10:51   #202
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
Is there any way to use the effects list override to filter out certain wavelengths of sound, so you only get bass through or treble?
Any help would be good...

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 7th June 2004, 13:01   #203
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Mr_Nudge, you could use getspec or getosc for detecting the sound values and then just use the "evallib override" in the effect list. But there is a problem with that, because every song is different and one getosc/getspec setting would detect your desired values on one song and completly something else on some other (if you're even that lucky you manage to find the exact value for those which i highly doubt)

Perfect or even good bass/beat detection is said to be impossible even with the supercomputers of today

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 8th June 2004, 01:44   #204
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
you cannot change the waveform
all you can do is read it and then change the variables you store it in.

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 8th June 2004, 10:27   #205
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Tug: good beat detection is perfectly possible, but it would require more CPU time. I know, cos I had to make a good beat detector for a univ project .

My approach: do an FFT per N samples, and calculate the autocorrelation in time of these FFTs. The shift at which the correlation is highest (except of course zero shift) is usually a multiple of the bpm.

UnConeD is offline   Reply With Quote
Old 30th June 2004, 04:09   #206
fragmer
Senior Member
 
fragmer's Avatar
 
Join Date: May 2003
Posts: 101
if you want to create a radial gradient out of (y=i;x=0) superscope, put a movement after it:
code:
r=atan2(0,-abs(y))
Attached Files
File Type: zip fragzample.zip (359 Bytes, 751 views)
fragmer is offline   Reply With Quote
Old 1st July 2004, 14:46   #207
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Global nullifier & scrambler

Two emtpy presets with one superscope. The other nullifies (sets to zero) all global vars and the other gives them random values between 0-999.

Someone just had to wrote them
Useful for debuggin your presets, or just copy the nullifier lines to your own preset.
Attached Files
File Type: zip global_rulette.zip (918 Bytes, 755 views)

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 17th July 2004, 14:16   #208
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
Ok, another effects list question:
how would you get an effects list to enable only when there's music playing, i've tried using
enabled=if((above(getspec(1,0.1,0)),1),1,0)
but it doesn't work. By the way i'm not that good at avs code, but for what i do know this looks like it should work.

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 17th July 2004, 14:32   #209
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
you could check playpos using gettime(-1) and see if it changed in the last frame
code:

lpos=pos;
pos=gettime(-1);
enabled=1-equal(pos,lpos);


or optimized:
code:

lpos=pos;
enabled=1-equal(lpos,assign(pos,gettime(-1)));



[edit]
even more optimized ^^
code:

enabled=1-equal(pos+0,assign(pos,gettime(-1)));


the +0 is needed so equal() wont read its first input value from pos, but from a temporary buffer

If you can't say something nice, say something surrealistic.

Last edited by TomyLobo; 17th July 2004 at 15:52.
TomyLobo is offline   Reply With Quote
Old 17th July 2004, 14:44   #210
AvsManDan
Junior Member
 
Join Date: May 2004
Posts: 24
Try using enabled=if(above(getspec(0,.5,0),a),1,0); instead. I used "a" because you can set the treshold if you wish(between 0 and 1). The lower the number, the more often the effect list is enabled.

What you did wrong was to return 1 when the getspec data is above 1, which is never. I replaced it with 0. Also, you based the data on getspec(1,0.1,0) which looks at a narrow band in the higher pitches.

If I were you I would add some code to change the blend level so it can blend in and out of volume levels.
AvsManDan is offline   Reply With Quote
Old 17th July 2004, 14:48   #211
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
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?

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 17th July 2004, 16:03   #212
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
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

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 18th July 2004, 04:28   #213
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
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.

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 28th July 2004, 05:53   #214
fragmer
Senior Member
 
fragmer's Avatar
 
Join Date: May 2003
Posts: 101
how about an ultimate aspect ratio correction? :P
code:
[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;


This way your squares will look square, and circles circular, at all window sizes, even wierd ones.

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
fragmer is offline   Reply With Quote
Old 28th July 2004, 14:04   #215
vanderphunck
Junior Member
 
vanderphunck's Avatar
 
Join Date: Jul 2004
Location: Finland
Posts: 47
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).
vanderphunck is offline   Reply With Quote
Old 29th July 2004, 08:39   #216
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
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

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 30th July 2004, 15:10   #217
hboy
Senior Member
 
hboy's Avatar
 
Join Date: Dec 2003
Location: Hungary
Posts: 217
Send a message via AIM to hboy
Quote:
Originally posted by fragmer
how about an ultimate aspect ratio correction? :P
code:
[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;


look into my presets since I am at deviantart that use 3D superscopes, i use this method since start of 2003
hboy is offline   Reply With Quote
Old 31st July 2004, 18:25   #218
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
What do you want, a medal?

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 17th August 2004, 10:25   #219
vanderphunck
Junior Member
 
vanderphunck's Avatar
 
Join Date: Jul 2004
Location: Finland
Posts: 47
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);
vanderphunck is offline   Reply With Quote
Old 18th August 2004, 14:48   #220
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
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.

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 4th September 2004, 08:43   #221
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
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...

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 5th September 2004, 19:44   #222
Oshango
Junior Member
 
Oshango's Avatar
 
Join Date: Aug 2004
Location: Bardo
Posts: 21
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 Files
File Type: zip avs-sigmoid-examples.zip (1.5 KB, 722 views)
Oshango is offline   Reply With Quote
Old 15th November 2004, 02:27   #223
Nolita
Senior Member
 
Join Date: Sep 2004
Posts: 101
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?)
Nolita is offline   Reply With Quote
Old 18th March 2005, 10:28   #224
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
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.

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 19th March 2005, 11:43   #225
Warrior of the Light
Forum King
 
Warrior of the Light's Avatar
 
Join Date: Aug 2002
Location: The Netherlands
Posts: 4,051
A faster way:
Triangular wave for an SSC:

code:
x=i*2-1;
y=asin(sin(i*$pi*2))/asin(1);



for general use:
code:

frame:
t=t+.05;
numwave=3;
point:
y=asin(sin(t*$pi*2*numwave))/asin(1);


Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever

Last edited by Warrior of the Light; 19th March 2005 at 12:03.
Warrior of the Light is offline   Reply With Quote
Old 19th March 2005, 13:44   #226
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
Faster? your method uses two asins a sin and 3 multiplications... thats slower.

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 19th March 2005, 15:55   #227
Warrior of the Light
Forum King
 
Warrior of the Light's Avatar
 
Join Date: Aug 2002
Location: The Netherlands
Posts: 4,051
slower, ok.. but no step sizes

Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever
Warrior of the Light is offline   Reply With Quote
Old 20th March 2005, 00:40   #228
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
yeah, take that wotl! :P

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 22nd March 2005, 18:55   #229
q-vis
Junior Member
 
Join Date: Mar 2005
Location: germany
Posts: 3
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.
q-vis is offline   Reply With Quote
Old 22nd March 2005, 21:47   #230
Jaak
Major Dude
 
Jaak's Avatar
 
Join Date: Jan 2003
Location: Estonia.
Posts: 851
Quote:
Originally posted by q-vis
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.
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. Also, this code is much harder to eyeball.

as in "regular" rotation code i mean regular as in what avsers are using.

Phi = (1+sqrt(5))/2
Jaak is offline   Reply With Quote
Old 24th March 2005, 18:56   #231
q-vis
Junior Member
 
Join Date: Mar 2005
Location: germany
Posts: 3
That means, I wrote that horrible matrix for nothing?!!
Well, at least it's 0.00000000001 fps faster
q-vis is offline   Reply With Quote
Old 28th March 2005, 06:58   #232
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 Jaak
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.
That 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.

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>.

-- Jheriko

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

Last edited by jheriko; 28th March 2005 at 07:31.
jheriko is offline   Reply With Quote
Old 29th March 2005, 12:40   #233
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
Quote:
Originally posted by jheriko
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).
I have lots of tips, but they are all code optimisations that most people arent interested in.

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 29th March 2005, 18:43   #234
q-vis
Junior Member
 
Join Date: Mar 2005
Location: germany
Posts: 3
Quote:
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.
q-vis is offline   Reply With Quote
Old 29th March 2005, 19:16   #235
Warrior of the Light
Forum King
 
Warrior of the Light's Avatar
 
Join Date: Aug 2002
Location: The Netherlands
Posts: 4,051
It's great for betatesting/comments before final release

^
that post was offtopic
next time create a new thread for different questions please.

Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever
Warrior of the Light is offline   Reply With Quote
Old 22nd May 2005, 05:46   #236
MaTTFURY
Major Dude
 
MaTTFURY's Avatar
 
Join Date: Jun 2004
Location: Australia,
Posts: 1,357
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

i am not normal, no really.
MaTTFURY is offline   Reply With Quote
Old 22nd May 2005, 13:13   #237
Warrior of the Light
Forum King
 
Warrior of the Light's Avatar
 
Join Date: Aug 2002
Location: The Netherlands
Posts: 4,051
^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
http://forums.winamp.com/showthread....ight=solid+ssc

Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever
Warrior of the Light is offline   Reply With Quote
Old 22nd May 2005, 21:22   #238
MaTTFURY
Major Dude
 
MaTTFURY's Avatar
 
Join Date: Jun 2004
Location: Australia,
Posts: 1,357
(well it was for other newbies who decided to ask you can refer them to that now)

i am not normal, no really.
MaTTFURY is offline   Reply With Quote
Old 23rd May 2005, 15:43   #239
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
PAK-9's programming guide has a part for solid scopes

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 5th June 2005, 17:02   #240
bodisan
Junior Member
 
Join Date: Oct 2004
Location: Romania
Posts: 22
Send a message via Yahoo to bodisan
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.
bodisan 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