Author Topic: new effect: Lava Flow  (Read 45817 times)

0 Members and 2 Guests are viewing this topic.

Offline drlava

  • Sr. Member
  • ****
  • Posts: 314
  • Milliwatts: 18
    • View Profile
new effect: Lava Flow
« on: December 10, 2009, 01:51:31 am »
Hey James, If we come up with a new effect, will you name it after us or put us in the laserboy credits?

How about this one:  a frame set effect that animates the colored line that is drawn with another frame (but with blanking removed) moving through the x-y coordinates of the target frame, but with blanking for the target frame applied. 


For example if you had a frame with a dashed line like this:
-.-.-.-.-.-.-.-.-.-.-.-.

and a frame with a figure eight

then applied the dashed line coloring of the line to the path of the figure eight, repeating or truncating where necessary, and animated it 'moving through' the figure 8 that would look pretty slick.



Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: new effect: Lava Flow
« Reply #1 on: December 10, 2009, 01:25:08 pm »
I have been thinking about ways to use one frame as information to modify others.

There is already a way to rotate the colors around the vertex path in a frame.

Right now, I have to finish up the color rescales code and make sure it works right.

But, yeah, I get what you mean!

Hey! Anyone can write a frame or frame set effect. Send it to me and I'll put it in the code with a comment line that says you wrote it!

(Of course it has to be a good effect. It can't be crap!)

Code: [Select]
//############################################################################
int train(LaserBoy_frame* p_frame)
{
    int                 frame_count,
                        vertex_count;
    LaserBoy_3D_short   temp_position;
    LaserBoy_frame      frame(*p_frame);
    LaserBoy_frame_set  out(frame.p_space);
    //------------------------------------------------------------------------
    out += frame;
    for(frame_count = 0; frame_count < frame.number_of_vertices(); frame_count++)
    {
        temp_position = frame.front();
        for(vertex_count = 0; vertex_count < frame.number_of_vertices() - 1; vertex_count++)
            frame.at(vertex_count) = frame.at(vertex_count + 1).position();
        frame.back() = temp_position;
        out += frame;
    }
    out.save_as_ild(LASERBOY_ILD_SHARE + "train.ild");
    return LASERBOY_OK;
}

//############################################################################

//.....
    //------------------------------------------------------------------------
    frame_effects.push_back(train);
    frame_effect_names.push_back(string("train"));

This looks pretty cool!

But it shows all of the blanking jumps.

If you use a math generated curve, there won't be any blanking!

The "train" frame effect cycles the position of each vertext to its previous neighbor and the last vertex becomes the first. The color and blanking move with the vertex.

Beware!

This attachment contains the dreaded ILDA Format 2 ~ palette!

Making this also exposed a few limitations in my interface!  :P

Hmmmmmmmmmmm.  %)

WOW! Messing with this also exposed a real improvement in frame optimization (segment order)!  ;D

Now I can see why I get certain undesireable results sometimes.

Thanks man!

We really should work together more often.

James.  :)
« Last Edit: December 10, 2009, 04:10:22 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline meandean

  • Sr. Member
  • ****
  • Posts: 466
  • Milliwatts: 13
  • It's about sight AND sound.
    • View Profile
Re: new effect: Lava Flow
« Reply #2 on: December 10, 2009, 10:11:16 pm »
Quote
Hey James, If we come up with a new effect, will you name it after us or put us in the laserboy credits?

  You must have just fallen off the turnip truck... ;)
« Last Edit: December 10, 2009, 11:21:47 pm by meandean »
"Patience is for the dead."

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: new effect: Lava Flow
« Reply #3 on: December 11, 2009, 12:12:42 am »
DrLava, if you have more good ideas, I'd like to hear them anytime.

I think I know what you want here... I'm not quite sure how to do it.

See attachment:

If you render this to wave in LaserBoy, you can choose to enhance dots and control exactly how long the laser hangs on the white dots.

James.  :)
« Last Edit: December 11, 2009, 01:30:26 am by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: new effect: Lava Flow
« Reply #4 on: December 11, 2009, 01:52:48 am »
WOW!

Check this out!   ;D

The only way to see this is with an RGB laser projector or with the vertices highlighted in LaserBoy.

attached:
« Last Edit: December 11, 2009, 02:05:36 am by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline drlava

  • Sr. Member
  • ****
  • Posts: 314
  • Milliwatts: 18
    • View Profile
Re: new effect: Lava Flow
« Reply #5 on: December 11, 2009, 02:00:36 am »
yeah, that's close.  The algorithm I was thinking would go something like this pseudocode:
Code: [Select]
   int                 frame_count,
                        vertex_count,
                        colorindex=0;
    LaserBoy_3D_short   temp_position;
    LaserBoy_frame      frame(*p_frame);
    LaserBoy_frame_set  out(frame.p_space);
    Laserboy_segment colorsource = target_color_fame; //copy the frame

    colorsource.minimize_blank_points();


    out += frame;
    for(frame_count = 0; frame_count < target_path_frame.number_of_lit_vertices(); frame_count++)
       for (i=0; i<target_path_frame.number_of_points(); i++)
       {
          while (i < target_path_frame.number_of_points() && target_path_frame.at(i).is_blank()) i++;
          if (i >= target_path_frame.number_of_points()) break;
          target_path_frame.at(i) = (ez_color)colorsource.at(colorindex);
          target_path_frame.at(i).c = colorsource.at(colorindex++).c;
          if (colorindex == colorsource.number_of_points()) colorindex=0;
       }
       if (++colorindex == colorsource.number_of_points()) colorindex=0;
       out += frame;
    }

    out.save_as_ild(LASERBOY_ILD_SHARE + "LavaFLow.ild");
    return LASERBOY_OK;

note that this line:
target_path_frame.at(i) = (ez_color)colorsource.at(colorindex)
would require the proper = operator definition for assigning the colors to the point.


« Last Edit: December 11, 2009, 02:18:59 am by drlava »

Offline drlava

  • Sr. Member
  • ****
  • Posts: 314
  • Milliwatts: 18
    • View Profile
Re: new effect: Lava Flow
« Reply #6 on: December 11, 2009, 02:04:41 am »
note that above, some of the 'frame' refs should be target_path_frame

yeah with the gleam, you're starting to get the idea of what is possible with this. :)

Quote
WOW!

Check this out!   Grin
cool ! :)
« Last Edit: December 11, 2009, 02:09:37 am by drlava »

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: new effect: Lava Flow
« Reply #7 on: December 11, 2009, 02:08:24 am »
OK I get it.

lava_flow it is then.

I gotta' go to bed pretty soon.

Thanks again. That was very enlightening.

I also got train, glitter and gleam out of the deal!

James.  :)
« Last Edit: December 11, 2009, 03:35:15 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline drlava

  • Sr. Member
  • ****
  • Posts: 314
  • Milliwatts: 18
    • View Profile
Re: new effect: Lava Flow
« Reply #8 on: December 11, 2009, 02:21:26 am »
great.  the train effect I think you could do with the above code.  remember you can do crazt stuff to the color source frame like convert blank to black and rainbow palette.

this line:
while (i < target_path_frame.number_of_points() && target_path_frame.at(i).is_blank()) i++;

might error out if the compiler doesn't jump out of the conditional after failing the first < expression, so nested statements would be required.

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: new effect: Lava Flow
« Reply #9 on: December 11, 2009, 02:48:03 pm »
Ahhhh!

That is one of those beautiful "need to know" features of C and C++!

if(condition_1 && condition_2)
    reaction();

If condition_1 is false, condition_2 is never tested.

Even though && is commutative, the order matters for side effects.

What if condition_1 and condition_2 are function calls?

Cool huh?

Also, it is sometimes faster to put a quick possible false before a longer bool expression.

James.  :)
« Last Edit: December 11, 2009, 03:37:39 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline Fanny Pack

  • Hero Member
  • *****
  • Posts: 645
  • Milliwatts: -20
  • Gender: Male
    • View Profile
Re: new effect: Lava Flow
« Reply #10 on: December 11, 2009, 06:42:09 pm »
Works for OR as well.  Every language I have used except for VB supports short circuit logic.  It bites me everytime I have to work with VB.  VB just sucks.

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: new effect: Lava Flow
« Reply #11 on: December 11, 2009, 08:04:35 pm »
Once I learned how to use a structured language like C and C++, I just can't imagine why anyone would want to write code any other way.

BASIC is fine for learning. It sucks for real programming.

You can't even come close to the kinds of functional constructs that you can make in C/C++. Let's not even talk about pointers and such.

James.  :)
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline meandean

  • Sr. Member
  • ****
  • Posts: 466
  • Milliwatts: 13
  • It's about sight AND sound.
    • View Profile
Re: new effect: Lava Flow
« Reply #12 on: December 11, 2009, 08:10:33 pm »
 You can nest conditionals in VB... Is that the same thing?

Quote
You can't even come close to the kinds of functional constructs that you can make in C/C++. Let's not even talk about pointers and such.

 Then make a GUI with it...
"Patience is for the dead."

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: new effect: Lava Flow
« Reply #13 on: December 11, 2009, 08:13:24 pm »
Quote
Then make a GUI with it...

I did!

It just doesn't use a mouse.

It is a completely scalable vector graphics display with a bitmapped font.

It is totally event driven by what YOU type at the keyboard.

How much more GUI do you want?

James.  :)
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline meandean

  • Sr. Member
  • ****
  • Posts: 466
  • Milliwatts: 13
  • It's about sight AND sound.
    • View Profile
Re: new effect: Lava Flow
« Reply #14 on: December 11, 2009, 08:25:00 pm »
  It looks like something from the 1980's...
"Patience is for the dead."

 

SMF spam blocked by CleanTalk
SimplePortal 2.3.7 © 2008-2024, SimplePortal