I just improved the https://castle-engine.io/x3d_extensions_screen_effects.php .
That said I think we should expose view matrix and projection matrix as built-in uniforms for ScreenEffect, as I found many use-cases require those 2.
I agree. But it depends on the effect. I have a lot of effects (and “The Unholy Society” and “Escape from the Universe” we have more) where these matrix values are not needed.
Added to TODO, I’ll introduce a boolean like
I also think we need a new set of built-in functions that accept/return values in 0…1 range
I deliberately wanted to start with more friendly API, and indeed it means that some functions divide by screen size, and later some functions multiply by it. If your effect is not doing anything where this matters (e.g. you don’t want to look “10 pixels to the left”, instead you want to look “1/100 of width to the left”), then the existing functions waste time (and precision) doing useless calculations.
Added to TODO to introduce new set of functions.
tex_coord_frag will be then renamed to something better, like
screenc_position (if new functions will be named