Coder Social home page Coder Social logo

Comments (5)

brunchboy avatar brunchboy commented on May 22, 2024

I think you are on the right track. Hopefully my answer in #12 will get you moving again. Otherwise, the fade tests and chase tests are additional examples of cues layering on top of each other. You will be best served by coming up with some very simple ones that work with your lights and seeing what happens when you combine them. Using cues with a controller can be helpful in experimenting, and a fade that lets you turn the overlay cue intensity up and down by moving a fader or turning an encoder is informative too.

from afterglow.

brunchboy avatar brunchboy commented on May 22, 2024

As you seem to have discovered, transform-colors is precisely an example of doing this. You just need to get the effect running at the same time, and with a higher priority than another effect that is creating a color. The easiest way to experiment with layering effects, and turning them on and off, is to set up cues, and then just use the web interface to interact with the cue grid, since you probably don’t have an Ableton Push to play with. Have you tried that at all?

from afterglow.

dandaka avatar dandaka commented on May 22, 2024

Thank you for your help. transform-colors is working, but function is super complicated to get any idea, how it is working right now.

Can I ask you to give any example of two simple effects, that work together, while modifying results of each other? Like global-color-effect with other simple effect, like hue rotation or lightness oscillator?

I will help to understand, how do they work.

I am guessing following, which has no effect:

(show/add-effect! :color
  (afterglow.effects/scene "Green color with hue rotate"
    (afterglow.effects.color/color-effect "Plain green" (create-color "green") (show/all-fixtures))
        (afterglow.effects.color/color-effect "Hue rotate" (afterglow.effects.params/build-color-param :adjust-hue 90) (show/all-fixtures))))

from afterglow.

brunchboy avatar brunchboy commented on May 22, 2024

You’re right, that approach won’t work. I’m afraid transform-colors might be almost as simple as it gets, because for an effect to modify another effect, it needs to work as part of the rendering pipeline, which is the deepest, most performance-critical part of Afterglow, and there are a number of protocols (the Clojure equivalent of Java interfaces) involved. I will try to see if I can come up with any more hints or pointers (as well as responding to your other questions and pull requests) but need to focus on the day job for a while at the moment.

In the mean time, the Effect Lifecycle documentation is where I try to explain how this works. I think it may make more sense to you now than the first few times that you may have looked at it, because you are now trying to implement something that fits into it. And the overall description of how that lifecycle is used to render DMX values is explained in the Rendering Loop documentation. When an effect is running, it creates Assigners, which are the things that produce DMX values. The assigners get a chance to look at the value that any other, earlier effect has produced for the channel, color, rotation, or whatever it is they are supposed to assign, and can either use it, modify it, or replace it.

Perhaps by looking over those pages, and seeing how the transform-colors code fits into them will help before I have time to write more examples. I think that copying transform-color and changing it to rotate the hue is an excellent exercise to try. Most of the code will be the same, and hopefully the documentation pages will help explain what it is for.

The part of transform-colors that you will want to change is… wait! I just looked at the code, and realized that I had written it in a way to make it easily extensible. You can reuse my existing code, and just supply a different transformation function. My code will do all the work of living in the rendering loop, and finding any previous color value that was going to be assigned, giving you a chance to manipulate it. All you need to do is write your own version of build-saturation-transformation that rotates the hue instead of playing with the saturation, and then pass it to transform-colors something like this (assuming you called your function build-hue-transformation):

(transform-colors (show/all-fixtures) :transform-fn (build-hue-transformation))

That would create an effect that would shift the hues of any colors being sent to all the fixtures in the show, once you add it to the show (and with a higher priority than the effects that you want it to adjust). , Of course you can pass arguments to your hue transformation function if you want.

And after looking at it, I agree that transform-colors is more complicated than it needs to be, because it has this flexibility built into it to make it easier to use with other kinds of color transformations, and it also has support for working with Pangolin Beyond laser shows, which has nothing to do with what you are trying to do. So a simpler example that does just one kind of transformation would be useful. But hopefully this series of explanations can get you further for a while.

from afterglow.

brunchboy avatar brunchboy commented on May 22, 2024

Here is another example! The virtual dimmers that you wanted in #43 are implemented as a transforming color effect with simpler code than the above discussion.

from afterglow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.