You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on GLSL shaders with Pix and I would like to write them in separates files and load the contents with Javascript to use them in a Pixi Filter because writing the shader in a Javascript HTML element as some tutorials show isn't pretty at all.
Considering this code:
const frag_shader = document.getElementById( 'frag_shader' ).innerHTML; //Replacing this by reading the GLSL file
const filter = new PIXI.Filter('', frag_shader);
Is there any way for Pixi.js to load external GLSL files in order to pass their content to PIXI.Filter ?
If not, is it a planned feature or do you use an external tool such as the glslify npm package to do so (https://github.com/stackgl/glslify) ?
There isn't much information for how Pixi v4 handle GLSL files and SO doesn't seem to have the answers, so I open this issue in order to know if this is something you can come up with.
Thanks for your answer.
The text was updated successfully, but these errors were encountered:
Yes, PIXI includes glslify. You could use the loader.
PIXI.loader.add(["vert.txt","frag,txt"]);
PIXI.loader.load(finshed);
function finished()
{
var vert = PIXI.loader.resources["vert.txt"].data;
var frag = PIXI.loader.resources["frag.txt"].data
var myfilter = new PIXI.Filter(vert, frag);
}
Hello,
I'm working on GLSL shaders with Pix and I would like to write them in separates files and load the contents with Javascript to use them in a Pixi Filter because writing the shader in a Javascript HTML element as some tutorials show isn't pretty at all.
Considering this code:
Is there any way for Pixi.js to load external GLSL files in order to pass their content to
PIXI.Filter
?If not, is it a planned feature or do you use an external tool such as the
glslify
npm package to do so (https://github.com/stackgl/glslify) ?There isn't much information for how Pixi v4 handle GLSL files and SO doesn't seem to have the answers, so I open this issue in order to know if this is something you can come up with.
Thanks for your answer.
The text was updated successfully, but these errors were encountered: