Author Topic: XLights 4 - add effect pdf?  (Read 5222 times)

Offline robs113

  • Newbie
  • *
  • Posts: 10
    • View Profile
XLights 4 - add effect pdf?
« on: July 18, 2016, 07:37:01 AM »
Greetings.

I am wanting to add a couple my Arduino/FastLeds effects to my xLights.

I setup the development environment as per the docs.

It appears adding an effect is quite different in xLights 4 than is was in the tutorial and docs.

Is there an xLights 4 equivalent document to the "How_To_Add_effects_To_Nutcracker.pdf" ?

or...
Is xLights 3 source available so I can try adding my effect to that?

Thanks.

Offline dkulp

  • Supporting Member
  • Hero Member
  • *
  • Posts: 812
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #1 on: July 18, 2016, 08:21:34 AM »

It should be a ton easier now with xLights 2016 than with 3.x/4.x.   If you look in the xLights/effects directory, you can see that each effect now has it's own c++ class that implements a few methods.   Thus, you pretty much need to implement that class (actually, its two classes, one for the effect and one for the Panel in the UI, but the latter is mostly generated via CodeBlocks), add the class to the list in EffectManager.cpp, and that's about it.   The only two "existing" files you need to modify are the EffectManager.h and EffectManager.cpp. 

Anyway, I'd look at one of the simple effects in there to use as an example.   



Daniel Kulp
Framingham, MA

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #2 on: July 18, 2016, 08:26:48 AM »
Can you show a video of the effect(s) you have in mind or describe them?  We just want to make sure its really something completely different from what's there because in some cases you can just add an option to an existing effect to produce the same thing.

Offline robs113

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #3 on: July 18, 2016, 08:34:41 AM »
Good point.
I will make a video of the effect on a setup I have in my basement.


Offline kevinp

  • Sr. Member
  • ****
  • Posts: 373
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #4 on: July 18, 2016, 08:36:16 AM »
Not sure how relevant it is now with all of the changes the last 6 months, but Sean did create a video on adding effects to xLights.

https://vimeo.com/138371241
Kevin Pankratz
Blaine MN

Offline robs113

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #5 on: July 18, 2016, 10:21:36 AM »
kevinp, yes that is the video that got me thinking of bringing my effect over to xLights ;)


gilrock,
Here are some videos of what I want to do.
In general a static light display with some animation to change colors.
That is, static red/green, animation to change to static blue/green. Hold static for 20-30 seconds, then another animation, etc.

Slide Fill
https://youtu.be/OKjiV37pzww

Slide Clear
https://youtu.be/3KevXlPVYJU

Centre Fill (like slide file but starts at string centre and fill to ends.
https://youtu.be/C1s7ENHKFeU

Chase Fill (Shown here at 4x speed)
https://youtu.be/1kVqhSNyiTo

If I can do something similar with the existing xLights that would be great.
« Last Edit: July 18, 2016, 10:23:47 AM by robs113 »

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #6 on: July 18, 2016, 11:47:06 AM »
I think some of those could be accomplished by just adding a few more options to the existing Fill effect.  Like if we allowed the user to specify that the colors alternate through the palette and define band size and gaps kinda like Marquee it would work like you want if you specify a value curve to define the motion.

Offline dkulp

  • Supporting Member
  • Hero Member
  • *
  • Posts: 812
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #7 on: July 18, 2016, 01:16:19 PM »
Slide fill and Center fill can be done with the Single Strand effect and turning on the "Persistent" checkbox on the "Layer Settings" panel.

The slide clear (and center clear) can be done with two layers.   Stick an On effect on the bottom layer and then on the top layer, put the "persistent Single Strand effect from above, but with "black" as the only color. 

Chase fill is interesting. 
Daniel Kulp
Framingham, MA

Offline robs113

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #8 on: July 18, 2016, 02:44:15 PM »
Thanks guys.

I will do some experimenting with single strand.




Offline robs113

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #9 on: July 19, 2016, 02:11:42 PM »
I have had no luck figuring how to make an existing effect do what I require, so I am on to attempting my own.

Question:
In the RenderBuffer, what are:
curPeriod
curEffStartPer
curEffEndPer

I am assuming the myEffect code needs to set all pixels each time it is called.

I would like to be able to know how many times the code is called so I can write a different pattern of pixels each call.
Simplified example, say model has 100 pixels.
First call just turn on pixel 1.
Second call turn on pixel 1 and 3.
Third call turn on 1,3,5.
etc..

curPeriod seems to increment each time the effect is called, up to curEffEndPer.
Hence the above question.




Offline keithsw1111

  • Administrator
  • Hero Member
  • *****
  • Posts: 2733
    • View Profile
    • Kellyville Christmas Lights
Re: XLights 4 - add effect pdf?
« Reply #10 on: July 19, 2016, 02:19:19 PM »
Curperiod - cureffstartperiod gives you your 0 based frame number. Yes you have to render each and every frame in full.

Offline keithsw1111

  • Administrator
  • Hero Member
  • *****
  • Posts: 2733
    • View Profile
    • Kellyville Christmas Lights
Re: XLights 4 - add effect pdf?
« Reply #11 on: July 19, 2016, 02:22:20 PM »
However I think you are on the wrong track. I looked at your videos and every one of them is achievable with existing effects. Share your rgb effects file and I can generate you a sequence that does it.

Offline keithsw1111

  • Administrator
  • Hero Member
  • *****
  • Posts: 2733
    • View Profile
    • Kellyville Christmas Lights
Re: XLights 4 - add effect pdf?
« Reply #12 on: July 19, 2016, 02:23:56 PM »
Except maybe the last and that should be a change to garlands.

Offline dkulp

  • Supporting Member
  • Hero Member
  • *
  • Posts: 812
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #13 on: July 19, 2016, 02:54:30 PM »
Those are the frame counts for the currently rendering effect.  However, it's rare that you should use them.   If you have a 25ms sequence compared to a 50ms sequence, the effect will run faster or slower if you depend on them.  Instead, use the buffer.GetEffectTimeIntervalPosition() (or the version that takes the number of cycles if your effect does cycles) to determine the % you are into the effect.    Base the calculations on what to draw based on that value.
Daniel Kulp
Framingham, MA

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
Re: XLights 4 - add effect pdf?
« Reply #14 on: July 19, 2016, 03:30:20 PM »
Even if we can't create them with existing effects most of those examples we do not want to create completely brand new effects.  What I was suggesting is I could add a couple more slider options to the existing Fill effect to do at least 2 of those.  For brand new effects they should really be new concepts.  I've already made that mistake myself.  I created the Fan effect which turned out I could have just modified and added options to Pinwheel to do the same thing.  I just think if we end up with 150 effect icons on the toolbar its going to be confusing.