Jump to content

Pass uniforms to Filter's shader


Timopheym
 Share

Recommended Posts

Hey people!

 

I wanna implement this shader (https://www.shadertoy.com/view/MslGWN#) in phaser state.

So i transformed the shader to WebGL style, and added patch to phaser to update iChannel uniforms on update.

Phaser.Filter.prototype.update = function (pointer, uniforms) {    if (typeof pointer !== 'undefined')    {        var x = pointer.x / this.game.width;        var y = 1 - pointer.y / this.game.height;        if (x !== this.prevPoint.x || y !== this.prevPoint.y)        {            this.uniforms.mouse.value.x = x.toFixed(2);            this.uniforms.mouse.value.y = y.toFixed(2);            this.prevPoint.set(x, y);        }    }	if (typeof uniforms !== 'undefined')    {    	for (var i in uniforms) {    		this.uniforms[i].value = uniforms[i];    	}    }    this.uniforms.time.value = this.game.time.totalElapsedSeconds();};

But it does no helped. There is no affection from music to fractal generation. Like i do pass null's.

Example could be found here:

https://timopheym.me/phaser/shader_music.html (sorry, i don't have ssl certificate =( )

I have no idea where am i wrong. It's about two days i am trying to fight it... thanks! 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...