Tips&Tricks in AVS

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Tuggummi
    Bin King
    • Mar 2001
    • 2190

    Tips&Tricks in AVS

    As i have made avs for 2 years now, i really don't know much about how to do things differently.

    Confused?
    Read more.

    As Advanced Visualization Studio is a highly customizable visualization plugin/component there are usually many ways to do simple things. And when it comes to coding your own superscopes and dynamic movements there are several different ways to make things, like in the dynamic movement using rectangular coordinates rather than polar coordinates to create the exactly same effect.

    Sometimes if you do things differently you may gain some priviledges, like better frame rates or the benefits of using a different coordinate system. Also when you use the built-in functions differently you may get faster&better results than doing the same thing with different effects.


    EXAMPLE
    Creating a rotoblitter effect in movement with both polar- & rectangular coordinates.


    Polar
    r=r+0.1

    BENEFITS:
    Simple, easy and a fast way.


    Rectangular
    x=x+y*0.1 ;
    y=y-x*0.1

    BENEFITS:
    You can shift it around the screen which can't be done in polar coordinates.


    These helpful speed up tricks and better quality tips are scattered all over the forum, so what im asking here is to collect all those helpful notes into a single forum post, this post.

    So feel free to post your ideas and comments how something that is frequently used can be done faster&better, this is all for the common good and will surely help us all as we are always searching a alternative way to make presets.

    And please remember that, althought the most tips consider coding there is still many different ways to use the built-in effects differently and still get the same effect. If you have discovered a clever way of using example: Trans / Water , you can post it here so it will help other avs artists as well.

    Hope you all understanded the point of this post and hope that you all contribute as much as you can
    Texer Resources

    Im retarded... err i mean retired!
    Probably both...
  • Atero
    Forum King
    • Jun 2001
    • 2651

    #2
    Rotoblitter in polar:
    r=r+spin;
    d=d*(zoom+1);

    Rotoblitter in rectangular:
    x1=x; zoom2=zoom+1;
    x=x*zoom2+y*spin;
    y=y*zoom2+x1*spin;

    Just a bit of a fix by your friendly local anal retentive AVSer...
    "guilt is the cause of more disauders
    than history's most obscene marorders" --E. E. Cummings

    Comment

    • Jaheckelsafar
      Major Dude
      • Feb 2002
      • 1318

      #3
      2 ways of shifting values, not sure which is executed faster:

      value = value * (1-speed) + target * speed;

      or

      value = value + (taget - value) * speed;
      Stoke me a clipper. I'll be back for Christmas.

      - Arnold Rimmer
      Red Dwarf

      Comment

      • Zevensoft
        Major Dude
        • Apr 2002
        • 529

        #4
        No order targeting:
        value = target

        First order targeting:
        value = (value + target * speed) / (speed + 1)

        Linear Interpolation:
        value = value1 * position + value2 * (1-position)

        Bilinear Interpolation:
        value12 = value1 * posx + value2 * (1-posx)
        value34 = value3 * posx + value4 * (1-posx)
        value = value12 * posy + value34 * (1-posy)

        Trilinear Interpolation:
        value12 = value1 * posx + value2 * (1-posx)
        value34 = value3 * posx + value4 * (1-posx)
        value56 = value5 * posx + value6 * (1-posx)
        value78 = value7 * posx + value8 * (1-posx)
        value1234 = value12 * posy + value34 * (1-posy)
        value5678 = value56 * posy + value78 * (1-posy)
        value = value1234 * posz + value5678 * (1-posz)
        1 | 2 | 3 | 4 | 3W | 4WW

        Comment

        • Michaelthecat
          Major Dude
          • May 2001
          • 1293

          #5
          Two questions...

          First order targeting is increasing a value by increments (speed), until it reaches target, right?

          What is (bi/tri)linear interpolation?
          powered by C₈H₁₀N₄O₂

          Comment

          • UnConeD
            Whacked Moderator
            • Jun 2001
            • 2104

            #6
            Bilinear is interpolation linearly in 2D... like zooming on a picture, but instead of blocky pixels you get a blurry, smooth texture.

            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.

            Comment

            • Tuggummi
              Bin King
              • Mar 2001
              • 2190

              #7
              What i would like to know is: What is the fastest way to create a fullscreen gradient? I have used this method:

              1 single ssc line

              INIT: n=2
              PER POINT: x=i*2-1 ; y=1

              1 movement with rect coords (bilinear filtering on)
              y=y-0.0x

              It could also be done by using a gradient line and then using a movement with x=0.

              Which way is faster? Or is there even a faster way to do it?

              Thanks
              Texer Resources

              Im retarded... err i mean retired!
              Probably both...

              Comment

              • uNDefineD
                Senior Member
                • Jan 2002
                • 297

                #8
                Tug: in his HiRes pack that came with J7, jheriko used a vertical line, and a static movement with r=0. Looks awesome.
                http://undefined22.deviantart.com/

                Comment

                • Tuggummi
                  Bin King
                  • Mar 2001
                  • 2190

                  #9
                  uNDefineD, it creates a conical gradient, right?

                  Different gradients:

                  Linear:


                  1 SuperScope

                  Init:
                  n=100 (the more numpoints the more accurate gradient)

                  Per Point:
                  x=i*2-1 ;
                  y=0 ;
                  col=i ;
                  blue=col ; red=col ; green=col


                  1 Movement

                  Rect Coords ON

                  Bilinear Filtering ON/OFF (not absolutly necessary, it looks ok even without it)

                  Code:
                  y=0



                  Radial:


                  1 SuperScope

                  Same as in Linear


                  1 Movement

                  Rect Coords ON

                  Bilinear Filtering ON

                  Code:
                  y=0 ;
                  x=d



                  Im not sure how the conical gradient is done, but i guess it's just using the r=0 movement and then using a color code in a superscope like col=sin(i*pi). I don't have avs right now so i can't check did i get those other two right, so ill edit this post tomorrow (at 8:XXam gmt +2).
                  Texer Resources

                  Im retarded... err i mean retired!
                  Probably both...

                  Comment

                  • Zevensoft
                    Major Dude
                    • Apr 2002
                    • 529

                    #10


                    Look in my 3rd pack (desert sunset) to see how to do fullscreen gradients in 1 scope.
                    1 | 2 | 3 | 4 | 3W | 4WW

                    Comment

                    • Tuggummi
                      Bin King
                      • Mar 2001
                      • 2190

                      #11
                      Well yes you can use just one superscope, but to fill the entire screen with just one superscope requires a big numpoint number and the bigger the resolution the more numpoints and more slower it is. With the scope and the movement technique the numpoint number always stays the same and still the whole screen gets filled with the gradient.

                      There for the movement and ssc technique is a lot faster than using one BIG ssc.
                      Texer Resources

                      Im retarded... err i mean retired!
                      Probably both...

                      Comment

                      • nixa
                        Senior Member
                        • Jul 2002
                        • 149

                        #12
                        the fastest way I know to make a gradient is:
                        scope:

                        n=w*detail; < whith deatil going from 2/w to 1 >

                        x=x*2-1;y=0;
                        red=blabla;green=blablabla;green=blabla;

                        movement:

                        x=0;

                        Comment

                        • Nic01
                          Major Dude
                          • Mar 2002
                          • 508

                          #13
                          GRADIENTS :

                          Note : "v" stands for variable (Replace with something), and it will be number-tagged. Red/green/blue is to be coded yourself.

                          Vertical, Horizontal, and Radial gradients already mentioned. Remember, you can always use another D/M to morph the gradient into one desired.

                          Fullscreen Gradients :

                          Horizontal gradient (Colors cycling left-right) :

                          x=-1+i*2;
                          v1=bnot(v1) OR v1=1-v1
                          y=v1*2-1;

                          Vertical : Exchange x and y.

                          Polar : You'll need dot-grid and colorcode it... Too slow.

                          -You can combine Hor. and Ver. Gradients to make combinations. Experiment with render modes.

                          Cheap fullscreen combo gradient :

                          Use 2 lines, perpendicular, use a good linewidth (30-50 should do it), then use a movement to fill the screen. (Technique from several of UnConeD's presets) (Is it copyrighted? )

                          Dot-Grid :

                          http://forums.winamp.com/showthread....threadid=83695 - But I'll post the code here for convenience. The one here have edited variables to signify the new variables.

                          FRAME :

                          v1=w+1; v2=h+1; n=v1*v2; v3=0; v4=0; v5=1/ww; v6=1/hh;

                          POINT :

                          x=v3*v5*2-1; y=v4*v6*2-1;

                          v3=if(above(v3+1,v1),0,v3+1);
                          v4=if(v3,v4,v4+1);

                          --

                          But of course, that will be goddamn slow. You can always reduce the amount of points and manipulate the size to conform with the screen.
                          In colorcoding, use x and y, i won't work well. Additional tips are in the original page.

                          Examples : El-Vis - I Cannot Dance, Carry Me Home, Lucy In The Sky With Diamonds, and some others.

                          It's quite slow, but is the most versatile, providing you use the right effects. You can also use convolution filter to make the pixels bigger and make a pixel-doubled effect.

                          --

                          All I can think for now... I think there are more ways...
                          [soon to leave, sirs]

                          Comment

                          • Tuggummi
                            Bin King
                            • Mar 2001
                            • 2190

                            #14
                            DOH! I thought the edit time was 3 days (i don't remember where i heard that but it was somewhere around these forums, oh well...)

                            Ok Here we go again!

                            Gradients



                            Linear

                            Ssc

                            Init:
                            n=255

                            Per Point:
                            x=i*2-1 ;
                            y=0 ;
                            col=i ;
                            red=col ; green=col ; blue=col

                            Movement

                            Bilinear Filtering OFF
                            Rect Coords ON

                            Code:
                            y=0



                            Radial

                            Ssc

                            Same as in Linear

                            Movement

                            Bilinear Filtering OFF
                            Rect Coords ON

                            Code:
                            y=0 ;
                            x=-d*1.5+0.5



                            Rectangular

                            Ssc

                            Init:
                            n=255 ; pi=acos(-1)

                            Per Point:
                            x=i*2-1 ;
                            y=0 ;
                            col=sin(i*pi) ;
                            red=col ; green=col ; blue=col

                            2 Movements

                            1st
                            Bilinear Filtering OFF
                            Rect Coords ON

                            Code:
                            y=0


                            2nd
                            Bilinear Filtering OFF
                            Rect Coords ON

                            Code:
                            x=-if(above(y*y,x*x),y*y,x*x)*1.75+0.75 ;



                            Conical

                            Ssc

                            Same as in Rectangular


                            2 Movements

                            1st
                            Bilinear Filtering OFF
                            Rect Coords ON

                            Code:
                            y=0


                            2nd
                            Bilinear Filtering ON
                            Rect Coords OFF

                            Code:
                            r=((r-1.25)*1.25)*0.35 ;
                            d=r



                            This time i actually made them, so they now work right. If you have trouble understanding code, or are just lazy download these example presets i made. Includes all the 4 gradients and a "real" preset i made in about 10 minutes that uses a "Dynamic-Gradient-Utone"
                            Attached Files
                            Texer Resources

                            Im retarded... err i mean retired!
                            Probably both...

                            Comment

                            • jheriko
                              Forum King
                              • Aug 2002
                              • 2150

                              #15
                              Here are some code tips for you.

                              Optimise everything. Higher FPS makes your presets a lot nicer. Here are some examples:


                              3D transformation

                              x=x1/z1;
                              y=y1/z1;

                              can be made faster by using:

                              z1=1/z1;
                              x=x1*z1;
                              y=y1*z1;

                              using trig in conjunction with a timer can be made faster too:

                              on beat:

                              drx=0.2*getosc(0.2,0.2,0);

                              per frame:

                              rx=rx+drx;crx=cos(rx);

                              per pixel:

                              x=crx;
                              y=0;

                              Using this sort of thing a lot can make your code faster.
                              -- Jheriko

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

                              Comment

                              Working...
                              X