SFML community forums
Help => Graphics => Topic started by: oomek on January 15, 2018, 03:35:14 am
-
Is anyone willing to help explaining in detail how to implement a multipass fragment shader in SFML?
I need it for kawase blur so it should have an uniform integer accessible from within shader with the pass number.
-
Easiest solution for your multiple passes is to use two or more render textures:
- Scene is rendered to render texture 1 using pass 1 shader.
- Render texture 1 is rendered to render texture 2 using pass 2 shader.
- Render texture 2 is rendered to render texture 1 using pass 3 shader.
- Repeat as often as needed…
- Render texture is rendered to the window using the last shader.
-
It could work for fullscreen effects, but what should I do If I need multipass for sprites with transformations? Normally sprite is drawn on a fullscreen rendertarget, but for every pass before the final one I should draw it to the intermediate render target and reset the transformations? Should the imrt be the size of the source sprite texture, or the size after scaling?