Announcement

Collapse
No announcement yet.

Tips&Tricks in AVS

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #76
    Well, as it often happens, i was wrong..
    i looked at the idea more carefully and youre friend was right shreyas.
    One of the outcomes of the xor operation is that it can be inverted easily.
    yes,
    if x XOR y = z
    then y XOR z = x

    so you can decrypt z(the encryption) to get x(the original) so long as you have y (which acts as a sort of mask).

    This applied to avs.

    if you were to XOR blend imageA with imageB, you would get imageC
    you could then XOR blend image B with imageC and you would get youre original imageA back!!! wowee...
    i didnt know that untill shreyas pointed it out.. very clever, but not very useful...

    Comment


    • #77
      About atan2... you got one detail wrong. In a mathematical coordinate system, the angle for (x,y) with regard to the positive x axis is atan(y/x), not atan(x/y).

      By the way, you can imagine atan2 to be the same as this, except that atan2 can also handle the cases where x and/or y is 0:

      alpha=atan(y/x)+below(x,0)*acos(-1);

      Comment


      • #78
        Friendly edit:
        By the way, you can imagine atan... (not atan2)

        Comment


        • #79
          Transparencies

          do your 'background stuff'
          add a replace buffersave to #1

          do the 'over stuff'
          replace buffersave to #2
          multiply --> infinite square
          invert

          effect list (ignore/multiply)
          ..buffer restore (replace) #1
          [end effect list]
          buffer restore (max) #2

          (there might be a better way, this is what I have found to work)
          powered by C₈H₁₀N₄O₂

          Comment


          • #80
            switches:

            ---------------
            binary: sw=1-sw
            ---------------
            'sw' will switch from 1 to 0 every time the code is run. Because it is binary, you can use simple maths to get ANY two numbers from this switch:
            sw2=sw*(difference between desired numbers)+(lowest desired number)

            Superscope example (use dots, not lines):
            sw=1-sw;
            y=getosc(i,0,0)*0.2+(sw-0.5)*0.5;
            x=2*i-1;

            -------------------------------------
            Other Switches: t=t+1; sw=t%ns;
            Where ns is the number of switches.)
            ---------------------------------------
            sw will progress through 0 to ns and then loop.

            Superscope example:
            t=t+1;
            sw=(t%7);
            v=getspec(sw/7+i/7,0,0);
            x=v*0.2+((sw*0.2)-0.6)*1.5;
            y=2*i-1;

            Comment


            • #81
              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).

              Comment


              • #82
                Sorry, i should have checked with yu first... i thought 'this' was referring to the bit above, not the bit below..

                Comment


                • #83
                  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

                  Comment


                  • #84
                    is that equal to:

                    (0.5*sin(val)+1) ?
                    .:HyperNation @ winamp:. .:DeviantArt:.
                    Thermal is now available for download at DeviantArt.

                    Comment


                    • #85
                      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

                      Comment


                      • #86
                        ok thank you
                        .:HyperNation @ winamp:. .:DeviantArt:.
                        Thermal is now available for download at DeviantArt.

                        Comment


                        • #87
                          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);

                          Comment


                          • #88
                            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

                            Comment


                            • #89
                              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.

                              Comment


                              • #90
                                i already used some of such code in the flow contest to make the ssc
                                http://home.iitb.ac****~shreyaspotnis

                                Comment

                                Working...
                                X