Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

FXAA Filter ?


nicof
 Share

Recommended Posts

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.js

It's composed of a vertex shader and a fragment shader.

Looking at Phaser sample filter https://github.com/photonstorm/phaser/blob/master/filters/SampleFilter.js

there is no vertex shader.

 

Is there a way to create a filter with a vertex and fragment shaders ?

 

 

Link to comment
Share on other sites

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

 Share

  • Recently Browsing   0 members

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