Docsity

Assignment 5: Approximating Large-Radius Gaussian Filter using Box Filters - Prof. Juraj O, Assignments of Computer Graphics

Toggle sidebar
bg1
CAP4720
Assignment 5
Due date:
December 11
th
, 11.59.59 pm
Delivery:
Source code and screenshots to [email protected] or [email protected]
Problem:
Implement an approximation of large-radius Gaussian filter using a sequence of box filters.
Large-radius Gaussian:
The naïve way to implement a Gaussian with large radius is by using large radius a 2 for-loops
in a pixel shader. The complexity of this operation is O(n*n) where n is the radius of the kernel.
The task of the assignment is to simplify this operation and perform multiple blurs using the box
kernel on render targets with different resolutions. Once this is done, the large-radius Gaussian
blur can be approximated by blending all render target-textures together.
Recommended steps:
1) Review the new code template. It contains revised FBO interface which allows for easy
rendering into different render targets and access to their contents from shaders.
2) Prepare your quad geometry. You can set up your own render buffer (look inside
ModelLoader for hints) or use the quad model. The quad needs to span the whole clip
space!
3) Set up 3-4 render targets with different resolutions (e.g. 1024*1024, 512*512, 256x256).
4) Render original scene to a shadow map from the light’s point of view.
5) Render JUST the shadow into a separate render target (only black/white image should
result from this).
6) For each resolution
Render quad with a 3x3 or 5x5 box blur shader
7) Render JUST geometry with lighting (NO SHADOWS) on screen
8) Set up blending modes (I’ll leave it up to you to figure out which one you want)
9) Final pass – Render quad and accumulate contributions from all render targets in the
pixel shader (sample tex1 through texN and add everything together).
pf2

Partial preview of the text

Download Assignment 5: Approximating Large-Radius Gaussian Filter using Box Filters - Prof. Juraj O and more Assignments Computer Graphics in PDF only on Docsity!

CAP

Assignment 5

Due date: December 11th, 11.59.59 pm

Delivery: Source code and screenshots to [email protected] or [email protected]

Problem: Implement an approximation of large-radius Gaussian filter using a sequence of box filters.

Large-radius Gaussian: The naïve way to implement a Gaussian with large radius is by using large radius a 2 for-loops in a pixel shader. The complexity of this operation is O(n*n) where n is the radius of the kernel.

The task of the assignment is to simplify this operation and perform multiple blurs using the box kernel on render targets with different resolutions. Once this is done, the large-radius Gaussian blur can be approximated by blending all render target-textures together.

Recommended steps:

  1. Review the new code template. It contains revised FBO interface which allows for easy rendering into different render targets and access to their contents from shaders.

  2. Prepare your quad geometry. You can set up your own render buffer (look inside ModelLoader for hints) or use the quad model. The quad needs to span the whole clip space!

  3. Set up 3-4 render targets with different resolutions (e.g. 10241024, 512512, 256x256).

  4. Render original scene to a shadow map from the light’s point of view.

  5. Render JUST the shadow into a separate render target (only black/white image should result from this).

  6. For each resolution Render quad with a 3x3 or 5x5 box blur shader

  7. Render JUST geometry with lighting (NO SHADOWS) on screen

  8. Set up blending modes (I’ll leave it up to you to figure out which one you want)

  9. Final pass – Render quad and accumulate contributions from all render targets in the pixel shader (sample tex1 through texN and add everything together).

BONUS :

Bonus (25%) will be awarded if you implement separable box blurs. This means that you won’t blur by using 2 for-loops and 3x3 or 5x5 kernels, but you will blur using 1 horizontal pass with a 3x1 kernel followed by 1 vertical pass with 1x3 kernel. This will happen for each resolution.

MORE INFO: If you have problems reusing your code from Assignment 4, you can blur something else. For example, in step 5) you can render only a black tiger on white background. Then blur this 3-4 times and composite with the original tiger in the last step. This will give you a nice glow effect.