Basic shader to create stuff with events?

  • Sorry for the tittle no idea how explain well .

    I don't know if this is possible, the idea is just a shader with 6 parameters, maybe will be helpful anothers but is a start.

    X= X coordinates

    Y= Y coordinates

    R= Red

    G= Green

    B= Blue

    C= Clear (To erase any)

    Then, create the things we want in the shader using events.

    For example in c2 events do a for / loopindex in X,Y and for each one until the last pixel do a:

    R=Random(128-255)

    G=Random(128-255)

    B=Random(128-255)

    This should create in the shader a colorfull noise. Maybe also will need another param like "paint" or "add color" to set/apply in the shader or something, but i think you get the point of the idea.

    Can be possible?

  • Using the Paster by R0J0hound i achieved to do this using a 1x1 pixel sprite as painter and doing a loopindex with random RGB for tint:

    But was 18 seconds :S , here the events used:

    I don't know if will be the same slow as with the shader thing, if i'm right the Paster plugin uses WebGL too, or maybe my events are not well optimized or i'm missing something. Or just the events works in CPU and no matter use a shader to use a GPU :S .

    Maybe is there anyway to edit the Shader code in Runtime? Not talking about parameters and numbers, i'm talking about code/operations. ¿?

  • matriax

    I made for loop test ... but with pixijs

    it take 4 seconds for me to perform 2x2 pixel shape in random color,

    and 5 seconds with 1x1 pixel shape.

    http://gigatron3k.free.fr/html5/C2/pixigfx/

    why not using noise shader ?

    https://www.shadertoy.com/view/Mljczw

  • Gigatron Because is not only noise, this is just an example.

    The idea is some "shader template" on via events you can create the stuff.

    I mean, some kind of ShaderToy but on you build your shaders using the C2 event based system instead code. So you can use loop, math expresions, conditions,etc... so with the Shader parameters like X,Y,R,G,B and others you can draw anything what you want. The noise is just an small example of what to do to understand the idea.

    Is just an idea, but maybe can't be done. C2 events are cpu based but maybe is there anyway to edit the shader in some way i don't know. Just tried some workaround but nothing.

  • matriax

    1 - make shader code with all functions you need and call them with C2 events (much work needed);

    2- use canvas plugin from ROJO

    3- or use pixijs canvas like ROJO canvas and call every function with C2 events... i am working slowly on pixijs shapes plugin

  • matriax

    3- or use pixijs canvas like ROJO canvas and call every function with C2 events... i am working slowly on pixijs shapes plugin

    interesting

    I would have bought such a plugin

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Gigatron No idea about that Pixi.JS thing until now and after read the plugin thread seems interesting and maybe can do what i want so i'm gonna test it

    Edit: Just tested it but seems is to work with stars? Is not possible change that star by an C2 sprite for example? Or C2 animated sprite, that can allow lots of possibilities.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)