nicof Posted November 4, 2015 Share Posted November 4, 2015 I was looking at the sources of Pixi 3 and they have a FXAA filter. https://github.com/pixijs/pixi.js/blob/master/src/core/renderers/webgl/filters/FXAAFilter.jsIt's composed of a vertex shader and a fragment shader.Looking at Phaser sample filter https://github.com/photonstorm/phaser/blob/master/filters/SampleFilter.jsthere is no vertex shader. Is there a way to create a filter with a vertex and fragment shaders ? chg 1 Link to comment Share on other sites More sharing options...
chg Posted November 7, 2015 Share Posted November 7, 2015 I don't know what the proper answer to this is, but I think it's a decent question - not necessarily for FXAA particularly (I'm not convinced that it makes sense for 2D rendering), but rather the "need" for vertex shaders for Phaser filters.It's explained in the vertex shader source rather well -//texcoords computed in vertex step//to avoid dependent texture readsvarying vec2 v_rgbNW;varying vec2 v_rgbNE;varying vec2 v_rgbSW;varying vec2 v_rgbSE;varying vec2 v_rgbM;ie. you can do this effect with a the kind of generic vertex shader provided to you with Phaser's filters (without additional UV coords varyings) computing the coords for the neighbouring source pixels to sample in the fragment shader, but it's going to be slower on some mobile GPUs where this (dependant texture read) is potentially a more costly way to sample from the source texture. Link to comment Share on other sites More sharing options...
Recommended Posts