Tips&Tricks in AVS

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • TomyLobo
    Major Dude
    • Feb 2004
    • 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.

    Comment

    • The Earthquaker
      Member
      • Jan 2006
      • 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
      At deviantart
      AVS

      Comment

      • TomyLobo
        Major Dude
        • Feb 2004
        • 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.

        Comment

        • TomyLobo
          Major Dude
          • Feb 2004
          • 580

          Originally posted by UIUC85
          int:
          x=# of frames you want to run it for;

          frame:
          enabled=if(above(x,0),1,0);
          x=x-1;

          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.

          Comment

          • StevenRoy
            Senior Member
            • Jun 2005
            • 129

            Originally posted by Warrior of the Light
            Triangular wave for an SSC:

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

            Sorry, but I just can't ignore that ugliness anymore. Here, try this instead:
            code:
            x=i*2-1;
            ii=i-.25;
            y=abs((ii-floor(ii))*2-1)*2-1;

            There. Thank goodness for the floor() function!

            Comment

            • jheriko
              Forum King
              • Aug 2002
              • 2150

              Raytracing...

              I keep teaching people how to raytrace... so this time I made a half decent resource:

              -- Jheriko

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

              Comment

              • The Earthquaker
                Member
                • Jan 2006
                • 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.
                At deviantart
                AVS

                Comment

                • TomyLobo
                  Major Dude
                  • Feb 2004
                  • 580

                  yay random code for the win
                  If you can't say something nice, say something surrealistic.

                  Comment

                  • jheriko
                    Forum King
                    • Aug 2002
                    • 2150

                    Originally posted by The Earthquaker
                    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.

                    its like three totally disconnected statements glued together...
                    -- Jheriko

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

                    Comment

                    • Tuggummi
                      Bin King
                      • Mar 2001
                      • 2190

                      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
                      Texer Resources

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

                      Comment

                      • Warrior of the Light
                        Forum King
                        • Aug 2002
                        • 4135

                        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

                        Comment

                        • fastingaciu
                          Major Dude
                          • Dec 2005
                          • 940

                          Question: How do you get the liquid effect using a dm?
                          Those who can do, do; those who can't do, teach.

                          Comment

                          • The Earthquaker
                            Member
                            • Jan 2006
                            • 87

                            Originally posted by The Earthquaker
                            I need an advice on time-based evaluation.

                            ...

                            And it seems the best solution is to work on custom BPM:
                            Skip 7 beats.
                            I want to apologize for that though I thought I make a post with intro and outro.

                            The stuff that is sandwiched beetween is what I meant a general question.
                            At deviantart
                            AVS

                            Comment

                            • jheriko
                              Forum King
                              • Aug 2002
                              • 2150

                              Originally posted by The Earthquaker
                              I want to apologize for that though I thought I make a post with intro and outro.

                              The stuff that is sandwiched beetween is what I meant a general question.
                              i still didnt get the idea. there is gettime() if you want something to be dependent on a timer...
                              -- Jheriko

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

                              Comment

                              • TomyLobo
                                Major Dude
                                • Feb 2004
                                • 580

                                eeltrans macros for HSL -> RGB conversion:
                                // --- HSL ---
                                // converts from HSL color space to RGB color space
                                #define HSL2RGB(H,S,L,R,G,B) (var_2=if(below(L,.5),L * ( 1 + S ),( L + S ) - ( S * L ));var_1=2 * L - var_2;R=Hue_2_RGB(var_1,var_2,H+third);G=Hue_2_RGB(var_1,var_2,H);B=Hue_2_RGB(var_1,var_2,H-third))

                                // initialization macro for HSL2RGB
                                #define init_HSL2RGB() third=1/3;

                                // helper macro for HSL2RGB - needs wrap()
                                #define Hue_2_RGB(v1,v2,invH) (vH=invH;wrap(vH, 0, 1, 1); v6H=6*vH; if(below(v6H, 1), v1+(v2-v1)*v6H, if(below(2*vH, 1), v2, if(below(3*vH, 2), v1+(v2-v1)*(4-v6H), v1))))

                                // wraps a value between minval and maxval. range should be (maxval-minval)
                                #define wrap(var,minval,maxval,range) if(below(var,minval),var=var+range,if(above(var,maxval),var=var-range,0));
                                Usage:
                                code:
                                hue=.3;
                                sat=1;
                                lum=.5;
                                HSL2RGB(hue,sat,lum,red,green,blue);

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

                                Comment

                                Working...
                                X