-
Notifications
You must be signed in to change notification settings - Fork 186
ShaderLesson5
This series relies on the minimal lwjgl-basics API for shader and rendering utilities. The code has also been Ported to LibGDX. The concepts should be universal enough that they could be applied to Love2D, GLSL Sandbox, iOS, or any other platforms that support GLSL.
This lesson requires understanding the Frame Buffer Object (FBO), so read up on them if you haven't already. Also ensure you are well-versed on the basics of sprite batching.
The lesson will demonstrate a gaussian blur technique in GLSL inspired by this article. The blur is applied in two passes -- horizontally and vertically -- however, our implementation will only require a single fragment shader.
Here is a visual overview of the two-pass blurring process:
You can follow along with the source here. We first load some textures, as usual, then we set up our frame buffers:
//create our FBOs
blurTargetA = new FrameBuffer(FBO_SIZE, FBO_SIZE, Texture.NEAREST);
blurTargetB = new FrameBuffer(FBO_SIZE, FBO_SIZE, Texture.NEAREST);
work in progress