Old 1st May 2003, 16:24   #81
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
AVS axer: actually no. The line below the one you 'corrected' uses atan to imitate atan2. Therefore it should still be "You can imagine atan2 to be the same as this...." ('this' refers to that line of code).

UnConeD is offline   Reply With Quote
Old 2nd May 2003, 04:38   #82
AVS Axer
Member
 
AVS Axer's Avatar
 
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
Sorry, i should have checked with yu first... i thought 'this' was referring to the bit above, not the bit below..
AVS Axer is offline   Reply With Quote
Old 2nd May 2003, 13:54   #83
Jaheckelsafar
Major Dude
 
Join Date: Feb 2002
Location: home
Posts: 1,318
percent value

ll : lower limit
hl : higher limit
val : value

(val-ll)/(hl-ll)

gives a number between 0 and 1 for a number between the lower limit and the higher limit.

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

- Arnold Rimmer
Red Dwarf
Jaheckelsafar is offline   Reply With Quote
Old 2nd May 2003, 15:08   #84
Deamon
Major Dude
 
Deamon's Avatar
 
Join Date: Nov 2002
Location: Arnhem, the Netherlands
Posts: 927
is that equal to:

(0.5*sin(val)+1) ?

.:HyperNation @ winamp:. .:DeviantArt:.
Thermal is now available for download at DeviantArt.
Deamon is offline   Reply With Quote
Old 3rd May 2003, 03:25   #85
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
uh, no.. not at all

his method keeps the scale linear.

(0.5*sin(val)+1) would return a soinsoid of val between 0 and 1. in other words it loops, and doesnt really produce a version of the variable 'val'.

(val-ll)/(hl-ll)
would return val exactly, only scaled between 1 and 0, instead of high limit and low limit. The variable remains linear
sidd is offline   Reply With Quote
Old 3rd May 2003, 09:54   #86
Deamon
Major Dude
 
Deamon's Avatar
 
Join Date: Nov 2002
Location: Arnhem, the Netherlands
Posts: 927
ok thank you

.:HyperNation @ winamp:. .:DeviantArt:.
Thermal is now available for download at DeviantArt.
Deamon is offline   Reply With Quote
Old 12th May 2003, 03:34   #87
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
I came up with this a while back and have been usingit heaps, thought it might be useful to everyone out there.

This converts hue,sat,lum color mode to r,g,b. So you can have more control over your color coding in superscopes. all hue sat and lum values are between 0 and 1. Hue, follows red-> green-> blue in 1/3 sections.

For all those who dont know, hue is the color, sat is the intensity of that color, and lum is the amount of black(0) or white(1) in that colour.

As you can imagin, the code is VERY useful, but unfortunatly isnt as small as one would like, it takes up 11 variables!!, i might be able to make that 8 but its tricky.

code:
hue=1;
lum=0.5;
sat=t;
tm2=if(below(lum,0.5),lum*(1+sat),lum+sat-lum*sat);
tm1=2*lum-tm2;
tm3r=hue+1/3;
tm3g=hue;
tm3b=hue-1/3;
tm3r=if(above(tm3r,1),tm3r-1,if(below(tm3r,0),tm3r+1,tm3r));
tm3g=if(above(tm3g,1),tm3g-1,if(below(tm3g,0),tm3g+1,tm3g));
tm3b=if(above(tm3b,1),tm3b-1,if(below(tm3b,0),tm3b+1,tm3b));
rd=if(below(6*tm3r,1),tm1+(tm2-tm1)*6*tm3r,if(below(2*tm3r,1),
tm2,if(below(tm3r*3,2),tm1+(tm2-tm1)*((2/3)-tm3r)*6,tm1)));
gr=if(below(6*tm3g,1),tm1+(tm2-tm1)*6*tm3g,if(below(2*tm3g,1),
tm2,if(below(tm3g*3,2),tm1+(tm2-tm1)*((2/3)-tm3g)*6,tm1)));
bl=if(below(6*tm3b,1),tm1+(tm2-tm1)*6*tm3b,if(below(2*tm3b,1),
tm2,if(below(tm3b*3,2),tm1+(tm2-tm1)*((2/3)-tm3b)*6,tm1)));
green=if(sat,gr,lum);
blue=if(sat,bl,lum);
red=if(sat,rd,lum);

sidd is offline   Reply With Quote
Old 12th May 2003, 10:29   #88
Montana
Major Dude
 
Montana's Avatar
 
Join Date: Dec 2001
Location: Södertälje, Sweden
Posts: 1,058
Send a message via ICQ to Montana Send a message via AIM to Montana Send a message via Yahoo to Montana
hsv to rgb, fast version

init: tpi=acos(-1)*2; pit=tpi/6; tpit=pit*2;
pixel:
sat2=sat*0.5; hue2=hue*tpi;
red=abs(sin(hue2))*sat2+lum;
green=abs(sin(hue2+pit))*sat2+lum;
blue=abs(sin(hue2+tpit))*sat2+lum;

batman
Montana is offline   Reply With Quote
Old 12th May 2003, 11:19   #89
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
nice work!! few problems with it obviously, cuz its simplifying a complicated process into only a few lines. luminuesence isnt scalar, nor is it dithered between colours correctly. Same deal with saturation. for example, 0 lum should make it black regarless.
all values should be between 0-1, or something else as long as it is finite. And the line 'hue2=hue*tpi' should be just hue*pi.

Im gonna use your code when i just need a nice color fading code, but ill stick with the other way for accuracy.
sidd is offline   Reply With Quote
Old 13th May 2003, 15:54   #90
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
i already used some of such code in the flow contest to make the ssc

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 13th May 2003, 20:49   #91
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
actually, that "fast" version isn't nearly correct, but it's a comparatively good approximation, and you get more proverbial bang for your buck

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 22nd May 2003, 02:34   #92
VisualAgnosia
Senior Member
 
VisualAgnosia's Avatar
 
Join Date: Nov 2002
Location: Australia
Posts: 190
Ozshtrayleeuh --- Repra - zent
VisualAgnosia is offline   Reply With Quote
Old 22nd May 2003, 05:28   #93
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
a big w00t to that sir.
sidd is offline   Reply With Quote
Old 22nd May 2003, 20:04   #94
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
a big 57f|_| to that sir.

visag, i'm going to tell you this one last time. STOP MAKING THOSE FUCKING RANDOM POSTS

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 23rd May 2003, 06:10   #95
VisualAgnosia
Senior Member
 
VisualAgnosia's Avatar
 
Join Date: Nov 2002
Location: Australia
Posts: 190
Good to hear from you Atero. I've missed your highly inteligent attempts at abuse for things that have nothing to do with you

Your attempt to inveigle me not to post "randomly" might be founded if they were actually "random". Odviously resorting to colourful language one may pick up from a seedy back alley where crack cocaine and "Hoes" may be obtained, is a fitting way of showing your dissapreciation for things you don't understand .

Not to worry I have found an old dusty copy of the "Big ol' fun book of psychiatric experts, ways to help individuals not make fools of themselves .. written by Dr. Phil" which i could post you. A great read which I admit changed my life when I was an abusive, sexually frustrated, introvertedly sadistic egotist myself. There is hope ! moving along..

N E Way .. I have finnished my work now and I am a free man again. Unleashed from my bindings of the working class. I am once again umonkst the frey of self indulgence to do what ever I please.

A very interesting thread this one I have seen alot which is of good use to me.

Repra - Zent Siddhartha_1 All the Adeladians in tha house
[img]http://www.educo*****b_zahran/images/en_australie/prace/adelaide_small.jpg[/img]
VisualAgnosia is offline   Reply With Quote
Old 23rd May 2003, 07:06   #96
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
no where did i put that "ban him" screenshot...

gd material belongs in gd, KEEP IT THERE.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 24th May 2003, 02:33   #97
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
an interlect which we will probably never uinderstand.

atero, the king off being pissed off at whatever is happening anywhere.

The cunning smarts of posting a useless message to inform someone that they have posted a useless message.

If that isnt the most intelegent thing you have ever seen, please post and tell me what is. But i wont chack on GD, so post it here!
HAHA!


sigh
sidd is offline   Reply With Quote
Old 24th May 2003, 15:05   #98
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
i posted this on another thread, and thought it should go here:

Quote:
The color fade doesnt use HLS, as this wouldnt really effect the way it fades out at all. It is is tad more complicated, and if you read this you will see why Nullsoft didnt even try to explain it to all the n00bs who download AVS.

This is what i have worked out:

The top bar deals with the additive colors, or cyan, magentta and yellow. If it is left of half way across, is timesed by a number between 0 and 1, if more than half way across, it is timesd by a number greater than 1.
Because C,M and Y are comprised of mixes of the base colours (RGB), this method connot make solid cyans etc. Instead, as you increase the slider, the colors apear to lose their base, or their saturation, and eventually fade to white.

The middle slider deals with the base colours, or Red, Green and Blue. It works in the same way as CMY, by multiplying by 0-1, or 1>. Because it is multiplied, not added, and colours connot excede there maximum potential, the colours dont fade to white. Instead, more to the right you put it, the more the original colours will become solid red, green or blue.

The last one sort of works with brightness, luminescence, or the amount of 'white' (whichever does it for you). Works with the same multiplication method as above. This is the most 'normal' and useful: This will make the screen either fade to black or white. At a rate depending on how far to the left or right you place the bar.

A few tips:
the normal fadeout effect can be done by placing all the bars in the same position, and to the left of the center.

You can avoid the CMY bar doing the fading to white thing by makjing sure the RGB bar is always postioned slightly greater.

Remember that the sliders do not actually reprisent the colour values, they are multipliers and such.

If you dont understand the multiplication thingo, it is basically doing this:
if the slider is x units to the left: variable/x
if the slifer is x units to the right: variable*x
sidd is offline   Reply With Quote
Old 24th May 2003, 19:29   #99
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
which is, afaik, not true. put the top slidebar all the way to the left and you get rgb, put the second slidebar all the way to the left and you get low contrast, fast cycling pallettes. check out my post in the "Laser? WTF?" thread

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 25th May 2003, 06:31   #100
Raz
Forum King
 
Raz's Avatar
 
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
Lets try to keep this thread for tips and tricks about avs and not about how atero has pms and how visag posts random stuff. Really, who cares? And if they do, why? Is there something wrong with their brain that means they have to get pissed off at the slightest fault. Atero, it's not the end of the world if theres one random post. Sometimes random posting is funny. Theres no need to go all anal and be the hitler of the forum. Now... avs...

Oh yeah, nice to see you back visag, try not to provoke him too much.

Raz is offline   Reply With Quote
Old 27th May 2003, 08:34   #101
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
RGB - HSL

Convert the RBG values to the range 0-1
Example: from the video colors page, colorbar red has R=83%, B=7%, G=7%, or in this scale, R=.83, B=.07, G=.07

Find min and max values of R, B, G
In the example, maxcolor = .83, mincolor=.07

If the max and min colors are the same (ie the color is some kind of grey), S is defined to be 0, and H is undefined but in programs usually written as 0

Otherwise, L = (maxcolor + mincolor)/2
For the example, L = (.83+.07)/2 = .45

Test L.
If L < 0.5, S=(maxcolor-mincolor)/(maxcolor+mincolor)
If L >=0.5, S=(maxcolor-mincolor)/(2.0-maxcolor-mincolor)
For the example, L=0.45 so S=(.83-.07)/(.83+.07) = .84

If R=maxcolor, H = (G-B)/(maxcolor-mincolor)
If G=maxcolor, H = 2.0 + (B-R)/(maxcolor-mincolor)
If B=maxcolor, H = 4.0 + (R-G)/(maxcolor-mincolor)
For the example, R=maxcolor so H = (.07-.07)/(.83-.07) = 0

To use the scaling shown in the video color page, convert L and S back to percentages, and H into an angle in degrees (ie scale it from 0-360)

HSL - RGB
If S=0, define R, G, and B all to L

Otherwise, test L.
If L < 0.5, temp2=L*(1.0+S)
If L >= 0.5, temp2=L+S - L*S
In the colorbar example for colorbar green, H=120, L=52, S=79, so converting to the range 0-1, L=.52, so
temp2=(.52+.79) - (.52*.79) = .899

temp1 = 2.0*L - temp2
In the example, temp1 = 2.0*.52 - .899 = .141

Convert H to the range 0-1
In the example, H=120/360 = .33

For each of R, G, B, compute another temporary value, temp3, as follows:
for R, temp3=H+1.0/3.0
for G, temp3=H
for B, temp3=H-1.0/3.0
if temp3 < 0, temp3 = temp3 + 1.0
In the example, Rtemp3=.33+.33 = .66, Gtemp3=.33, Btemp3=.33-.33=0

For each of R, G, B, do the following test:
If 6.0*temp3 < 1, color=temp1+(temp2-temp1)*6.0*temp3
Else if 2.0*temp3 < 1, color=temp2
Else if 3.0*temp3 < 2, color=temp1+(temp2-temp1)*((2.0/3.0)-temp3)*6.0
In the example,
3.0*Rtemp3 < 2 so R=.141+(.899-.141)*((2.0/3.0-.66)*6.0=.141
2.0*Gtemp3 < 1 so G=.899
6.0*Btemp3 < 1 so B=.141+(.899-.141)*6.0*0=.141


Scale back to the range 0-100 to use the scaling shown in the video color page
For the example, R=14, G=90, B=14

Found on the net

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 27th May 2003, 15:59   #102
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
it'd be quite a bit more useful if you could link us to the page...

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 28th May 2003, 04:56   #103
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
hang on,
what use is RGB-HSL if the only time you ever get to specify colours in code form is in the superscope, where you can only use RGB for output.

also, your HSL-RGB code is exactly the same as given above, only mine was already coded for avs.
sidd is offline   Reply With Quote
Old 28th May 2003, 05:06   #104
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
well, axer, that's probably because they use the same algorithm

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 28th May 2003, 05:38   #105
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
that was kinda the point atero... they both use the HSL-RGB algorithm... so why post it twice?
you follow?
sidd is offline   Reply With Quote
Old 28th May 2003, 06:38   #106
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
whereas your algorithm was compiled (sorta), and shreyas's post explained it in detail.

and...afaik there is only one hsl/rgb algorithm. excepting sat={1,0} and lum={1,0}, it's a one-to-one function

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 28th May 2003, 08:09   #107
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
well, thats not entirely true, there are many different ways of alligning the hue value to show as loop from 0-1.
It is not neccessarily correct to have red, green or blue in any order, (although it is normally R-G-B).
Also, most methods use sine to 'shape' the scale. The one me and shreyas used doesnt, it just uses linear 1/3's.
sidd is offline   Reply With Quote
Old 28th May 2003, 12:34   #108
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Conding the algo in AVS sort of makes it a bit more complicated, so I just posted the algo here. No need to post the link, as I have copied whatever was preset on the page

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 28th May 2003, 13:14   #109
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
ok
sidd is offline   Reply With Quote
Old 28th May 2003, 20:52   #110
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
and...look at your hsl colorpicker some time. does it look like it has a sinusoidal interpolation? no, i'm afraid it doesn't. and what do you see when h=0? red. h=240? red. that's just the way it is, i'm sorry....

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 28th May 2003, 23:18   #111
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
rightyo.. enough on this please
sidd is offline   Reply With Quote
Old 6th June 2003, 09:52   #112
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Metaballs dm, I made it some time ago:
code:

init:
dc=1.2;g1=1;g2=1;

Frame:
bf=(bf+.1)/1.1;mov=tx1*tx2*tx3;af=h/w;
tx1=(tx1+dx1*.1)/1.1;ty1=(ty1+dy1*.1)/1.1;
tx2=(tx2+dx2*.1)/1.1;ty2=(ty2+dy2*.1)/1.1;
tx3=(tx3+dx3*.1)/1.1;ty3=(ty3+dy3*.1)/1.1;
tx4=(tx4+dx4*.1)/1.1;ty4=(ty4+dy4*.1)/1.1;
tx5=(tx5+dx5*.1)/1.1;ty5=(ty5+dy5*.1)/1.1;

Beat:
dx1=(rand(200)/100-1)*dc;dy1=(rand(200)/100-1)*dc;
dx2=(rand(200)/100-1)*dc;dy2=(rand(200)/100-1)*dc;
dx3=(rand(200)/100-1)*dc;dy3=(rand(200)/100-1)*dc;
dx4=(rand(200)/100-1)*dc;dy4=(rand(200)/100-1)*dc;
dx5=(rand(200)/100-1)*dc;dy5=(rand(200)/100-1)*dc;
bf=2;

Pixel:
y=y*af;
x1=x+tx1;
y1=y+ty1;

x2=x+tx2;
y2=y+ty2;

x3=x+tx3;
y3=y+ty3;

x4=x+tx4;
y4=y+ty4;

x5=x+tx5;
y5=y+ty6;

d1=pow(sqrt(sqr(x1)+sqr(y1))*g1,g2);
d2=pow(sqrt(sqr(x2)+sqr(y2))*g1,g2);
d3=pow(sqrt(sqr(x3)+sqr(y3))*g1,g2);
d4=pow(sqrt(sqr(x4)+sqr(y4))*g1,g2);
d5=pow(sqrt(sqr(x5)+sqr(y5))*g1,g2);

d=d1*d2*d3*d4*d5;
x=x1+x2+x3+x4+x5;
y=y1+y2+y3+y4+y5;
r=atan2(x1,y1)+mov;

alpha=bf-min(bf,d)



I am quite happy with the end results, dunno if its done before.

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 6th June 2003, 12:24   #113
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
shift per pixel

A simple trick for advanced avsers.

To shift a scope by pixel.

X-axis
xt=xt+(#/w)*2

Y-axis
yt=yt+(#/h)*2

#=ammount of pixels skipped. 1=none , 0=no movement

Example:

per frame
xt=xt+(2/w)*2 ;

per pixel
y=i*2-1 ;
x=if(above(xt,1),-1,xt)


This will shift your scope by skipping every other line.

code:

|-|-|-|-




Notice that if you want to skip 2 pixels, you don't use 2 you use 3. A way of "remembering" it is to write it like this:

xt=xt+(#/w)*2+2/w

2/w adds the extra pixel, so that what ever number you use in # it will skip that ammount of pixels. Of course it's better to use straight up higher number, but it's just for convenience.

example:

xt=xt+(3/w)*2+2/w

Will move the scope like this:

code:

|---|---|---|---|---





Notice also that shifting per pixel won't work with sin&cos, only when you apply it directly to the scope movement it will work, you can use the if functions to limit the movement of the scope or to make it warp to the otherside once it reaches the end.

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 14th June 2003, 18:43   #114
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
A very neat trick to darken the colours a little bit.
use an effect list with input replace and outpuit multiply. this will squrare the colours. as rgb are 0....1 then if RGB are not 0 or 1 their squares will be less than the original numbers!

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 15th June 2003, 02:27   #115
Zevensoft
Major Dude
 
Zevensoft's Avatar
 
Join Date: Apr 2002
Location: Ballarat, Australia
Posts: 529
It's effectively exactly the same as a Gamma 0.5 ramp.
If you invert the colours before and after, it becomes a Gamma 2.0 ramp.

1 | 2 | 3 | 4 | 3W | 4WW
Zevensoft is offline   Reply With Quote
Old 12th August 2003, 10:14   #116
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Bunch of dm's I wrote in spare time...I hope someone can make good use of it.
DM Collection:
1) Binaculors

Frame:
t=t+.05;t1=t1+ti*.1;ti=ti*.9;
ox1=sin(t1)*.5*sin(t);oy=cos(t1)*.5;
rx=0;ry=0;rz=rz+.01+sin(t1-sin(t))*.05;
oz=t*5+sin(t1)*.5+.5;
sx=sin(rx);sy=sin(ry);sz=sin(rz);
cx=cos(rx);cy=cos(ry);cz=cos(rz);
af=max(h,w)/min(h,w);


Beat: ti=1

Point:
y=if(above(h,w),y*af,y);x=if(above(w,h),x*af,x);
dx1=x*cz-y*sz;dy1=x*sz+y*cz;
dy2=dy1*cx-sx;dz2=dy1*sx+cx;
dx3=dx1*cy-dz2*sy;dz2=dx1*sy+dz2*cy;

ox=ox1+.5;
dx1=sqr(dx3);dy1=sqr(dy2);dz1=sqr(dz2);
mtx=dx3*ox;mty=dy2*oy;mtz=dz2*oz;

a=2*(dx1+dy1);
b=2*(mtx+mty);
c=sqr(ox)+sqr(oy)-1;
D=sqr(b)-2*a*c;
k1=(-b+sqrt(abs(D)))/a;

ox=ox1-.5;
mtx=dx3*ox;mty=dy2*oy;mtz=dz2*oz;

a=2*(dx1+dy1);
b=2*(mtx+mty);
c=sqr(ox)+sqr(oy)-1;
D=sqr(b)-2*a*c;
k2=(-b+sqrt(abs(D)))/a;

k=max(k1,k2);
ix=k*dx3+ox;
iy=k*dy2+oy;
iz=k*dz2+oz;

x=atan2(ix,iy);
y=asin(sin(iz));
d=sqr(ix-ox)+sqr(iy-oy)+sqr(iz-oz);
alpha=4/(d+1);



2) 8 sided shape
Frame:
t=t+.001+ti*.1;ti=ti*.9;
ox=cos(t)*.6*sin(t*.76+t);
oy=cos(t*.76+1)*.9;
oz=sin(t-1)*cos(t);
rx=0.1+atan2(ox,sqr(oy)+sqr(oz));
ry=atan2(ox,oz);
rz=-atan2(oz,sqr(ox)+sqr(oy));

sx=sin(rx);sy=sin(ry);sz=sin(rz);
cx=cos(rx);cy=cos(ry);cz=cos(rz);
af=max(h,w)/min(h,w);

cz1=cos(-pi/4);sz1=sin(-pi/4);

Beat:ti=.4

Point:
y=if(above(h,w),y*af,y);x=if(above(w,h),x*af,x);

dx1=x*cz-y*sz;
dy1=x*sz+y*cz;
dy2=dy1*cx-sx;
dz2=dy1*sx+cx;
dx3=dx1*cy-dz2*sy;
dz2=dx1*sy+dz2*cy;
dx1=dx3*cz1-dy2*sz1;
dy1=dx3*sz1+dy2*cz1;
dx3=dx1;dy2=dy1;

k1=(1-oy-ox)/(dy2+dx3);
k1=if(below(k1,0),(-1-oy-ox)/(dy2+dx3),k1);

k3=(1-oy)/dy2;
k3=if(below(k3,0),(-1-oy)/dy2,k3);

k4=(1-ox)/dx3;
k4=if(below(k4,0),(-1-ox)/dx3,k4);

k5=(2-oz)/dz2;
k5=if(below(k5,0),(-2-oz)/dz2,k5);

k=min(min(k1,k5),min(k4,k3));

x=k*dx3+ox;
y=k*dz2+oz;

x=if(equal(k,k4),k*dy2+oy,x);
y=if(equal(k,k5),k*dy2+oz,y);


3) 3 tunnel intersection:
Note: there is something special about this dm, what you need to do is use a 4X4 colour grid to the original texture so that the upper right part of the texture has a different colour tone than the lower left part. Now observe

Frame:
t=t+.05;

rad=1.4;
rx=(rx+rx1*.1)/1.1;
ry=(ry+ry1*.1)/1.1;
rz=(rz+rz1*.1)/1.1;

sx=sin(rx);sy=sin(ry);sz=sin(rz);
cx=cos(rx);cy=cos(ry);cz=cos(rz);

ox=(sx+cy+cz)*.33;
oy=(sy+cx+cz)*.33;
oz=(sz+cx+cy)*.33;

af=max(h,w)/min(h,w);

Beat:
cb=cb+1;
rx1=if(cb%5,rx1,if(below(abs(rx-rx1),.3),rx1+pi/2*sign(getosc(0,0,0)),rx1));
ry1=if(cb%3,ry1,if(below(abs(ry-ry1),.3),ry1+pi/2*sign(getosc(0.1,0,0)),ry1));
rz1=if(cb%2,rz1,if(below(abs(rz-rz1),.3),rz1+pi/2*sign(getosc(0.2,0,0)),rz1));
col=-col;

Point:
y=if(above(h,w),y*af,y);x=if(above(w,h),x*af,x);
dx1=x*cz-y*sz;dy1=x*sz+y*cz;
dy2=dy1*cx-sx;dz2=dy1*sx+cx;
dx3=dx1*cy-dz2*sy;dz2=dx1*sy+dz2*cy;

dx1=sqr(dx3);dy1=sqr(dy2);dz1=sqr(dz2);
mtx=dx3*ox;mty=dy2*oy;mtz=dz2*oz;

¤ center sphere;

a=dx1+dy1+dz1;
b=2*(dx3*ox+dy2*oy+dz2*oz);
c=sqr(oz)+sqr(oy)+sqr(oz)-4;
D=sqr(b)-4*a*c;
k4=(-b+sqrt(abs(d)))/(2*a);
k4=if(below(D,0),1000,k4);

c=sqr(oz)+sqr(oy)+sqr(oz)-16;
D=sqr(b)-4*a*c;
k5=(-b+sqrt(abs(d)))/(2*a);
k5=if(below(D,0),1000,k5);

¤cylinder on z-axis;
a=2*(dx1+dy1);
b=2*(mtx+mty);
c=sqr(ox)+sqr(oy)-sqr(rad);
D=sqr(b)-2*a*c;
k1=(-b+sqrt(abs(D)))/a;

k1=if(below(D,0),1000,k1);

¤cyliner along y-axis;
a=2*(dx1+dz1);
b=2*(mtx+mtz);
c=sqr(ox)+sqr(oz)-sqr(rad);
D=sqr(b)-2*a*c;
k2=(-b+sqrt(abs(D)))/a;
k2=if(below(D,0),1000,k2);

¤cyliner along x-axis;
a=2*(dy1+dz1);
b=2*(mty+mtz);
c=sqr(oy)+sqr(oz)-sqr(rad);
D=sqr(b)-2*a*c;
k3=(-b+sqrt(abs(D)))/a;

k3=if(below(D,0),1000,k3);

k=min(max(max(max(k1,k2),k3),k4),k5);

ix=k*dx3+ox;iy=k*dy2+oy;iz=k*dz2+oz;

x=if(equal(k,k1),ix,if(equal(k,k2),ix,iy));
y=if(equal(k,k1),iz,if(equal(k,k2),iy,ix));

r=if(equal(k,k4),2,4);
x=if(equal(k,k4)+equal(k,k5),atan2(ix,iz)/2,x);
y=if(equal(k,k4)+equal(k,k5),asin(iy/r)*2,y);

x=asin(sin(x*pi*.5))*2/pi;
y=asin(sin(y*pi*.5))*2/pi;

x=if(equal(k,k4)+equal(k,k5),abs(x)*col,-abs(x)*col);
y=if(equal(k,k4)+equal(k,k5),abs(y)*col,-abs(y)*col);
d=sqr(ix-ox)+sqr(iy-oy)+sqr(iz-oz);
alpha=7/(d+1)*bnot(equal(k,1000));



4) 3 tunnel intersection in a cube: same as above except insead of the intersection sphere, there is a cube
Init:
pi=acos(-1);col=1
fRAME:
t=t+.05;

rx=(rx+rx1*.1)/1.1;
ry=(ry+ry1*.1)/1.1;
rz=(rz+rz1*.1)/1.1;

sx=sin(rx);sy=sin(ry);sz=sin(rz);
cx=cos(rx);cy=cos(ry);cz=cos(rz);

ox=(sx+cy+cz)*.33;
oy=(sy+cx+cz)*.33;
oz=(sz+cx+cy)*.33;

af=max(h,w)/min(h,w);

Beat:
cb=cb+1;
rx1=if(cb%5,rx1,if(below(abs(rx-rx1),.3),rx1+pi/2*sign(getosc(0,0,0)),rx1));
ry1=if(cb%3,ry1,if(below(abs(ry-ry1),.3),ry1+pi/2*sign(getosc(0.1,0,0)),ry1));
rz1=if(cb%2,rz1,if(below(abs(rz-rz1),.3),rz1+pi/2*sign(getosc(0.2,0,0)),rz1));
col=-col;

Point:
y=if(above(h,w),y*af,y);x=if(above(w,h),x*af,x);
dx1=x*cz-y*sz;dy1=x*sz+y*cz;
dy2=dy1*cx-sx;dz2=dy1*sx+cx;
dx3=dx1*cy-dz2*sy;dz2=dx1*sy+dz2*cy;

dx1=sqr(dx3);dy1=sqr(dy2);dz1=sqr(dz2);
mtx=dx3*ox;mty=dy2*oy;mtz=dz2*oz;

¤cylinder on z-axis;
a=2*(dx1+dy1);
b=2*(mtx+mty);
c=sqr(ox)+sqr(oy)-sqr(rad);
D=sqr(b)-2*a*c;
k1=(-b+sqrt(abs(D)))/a;

k1=if(below(D,0),1000,k1);

¤cyliner along y-axis;
a=2*(dx1+dz1);
b=2*(mtx+mtz);
c=sqr(ox)+sqr(oz)-sqr(rad);
D=sqr(b)-2*a*c;
k2=(-b+sqrt(abs(D)))/a;
k2=if(below(D,0),1000,k2);

¤cyliner along x-axis;
a=2*(dy1+dz1);
b=2*(mty+mtz);
c=sqr(oy)+sqr(oz)-sqr(rad);
D=sqr(b)-2*a*c;
k3=(-b+sqrt(abs(D)))/a;

k3=if(below(D,0),1000,k3);

k4=(2-ox)/dx3;
k5=(2-oy)/dy2;
k6=(2-oz)/dz2;

k4=if(below(k4,0),(-ox-2)/dx3,k4);
k5=if(below(k5,0),(-oy-2)/dy2,k5);
k6=if(below(k6,0),(-oz-2)/dz2,k6);

k=min(min(k4,k5),k6);
k=max(k,max(max(k1,k2),k3));

ix=k*dx3+ox;iy=k*dy2+oy;iz=k*dz2+oz;

x=if(equal(k,k1),ix,if(equal(k,k2),ix,iy));
y=if(equal(k,k1),iz,if(equal(k,k2),iy,ix));
y=if(equal(k,k4),iy,y);
y=if(bor(equal(k,k5),equal(k,k6)),iz,y);
y=if(equal(k,k6),iy,y);
x=if(equal(k,k4),iz,x);
x=if(bor(equal(k,k5),equal(k,k6)),ix,x);
dx1=if(equal(k,k1)+equal(k,k2)+equal(k,k3),1,-1);

x=abs(asin(sin(x*pi*.5))*2/pi)*col*dx1;
y=abs(asin(sin(y*pi*.5))*2/pi)*col*dx1;
d=sqr(ix-ox)+sqr(iy-oy)+sqr(iz-oz);
alpha=4/(d+1)*bnot(equal(k,1000));

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 15th August 2003, 15:40   #117
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,149
Send a message via ICQ to jheriko
Those DMs could use some optimisation. Remember that putting things in if statements means that both results are calculated so for instance:

x=if(equal(k,k4)+equal(k,k5),abs(x)*col,-abs(x)*col);

should be

x=if(equal(k,k4)+equal(k,k5),1,-1)*abs(x)*col;

one less abs and one less * than before.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 15th August 2003, 16:36   #118
kPlanet
Junior Member
 
Join Date: Aug 2003
Location: Ger
Posts: 6
Send a message via ICQ to kPlanet
There are anywhere "TipsTricks in AVS" for german people!?^^
who know some...
thx
kPlanet is offline   Reply With Quote
Old 15th August 2003, 18:11   #119
anubis2003
Forum King
 
anubis2003's Avatar
 
Join Date: Dec 2002
Location: middle of somewhere
Posts: 5,564
Send a message via AIM to anubis2003
nein, keine "Tips and tricks" für deutsche.
anubis2003 is offline   Reply With Quote
Old 15th August 2003, 18:43   #120
kPlanet
Junior Member
 
Join Date: Aug 2003
Location: Ger
Posts: 6
Send a message via ICQ to kPlanet
och warumn ni!?
da müsste sich mal einer ransetzen...^^
und... nein ich werd das nicht sein! löl
kPlanet 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