Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deferred shading #4

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 63 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,144 +1,98 @@
-------------------------------------------------------------------------------
CIS565: Project 6: Deferred Shader
Deferred Shader
-------------------------------------------------------------------------------
Fall 2013
-------------------------------------------------------------------------------
Due Friday 11/15/2013
![alt text](renders/title.bmp)
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
NOTE:
FEATURES:
-------------------------------------------------------------------------------
This project requires any graphics card with support for a modern OpenGL
pipeline. Any AMD, NVIDIA, or Intel card from the past few years should work
fine, and every machine in the SIG Lab and Moore 100 is capable of running
this project.

-------------------------------------------------------------------------------
INTRODUCTION:
-------------------------------------------------------------------------------
In this project, you will get introduced to the basics of deferred shading. You will write GLSL and OpenGL code to perform various tasks in a deferred lighting pipeline such as creating and writing to a G-Buffer.
This project demostrates various effects that can be achieved by deferred shading in OpenGL, including:

-------------------------------------------------------------------------------
CONTENTS:
-------------------------------------------------------------------------------
The Project6 root directory contains the following subdirectories:

* base/
* PROJ_WIN/ contains the vs2010 project files
* PROJ_NIX/ contains makefile for building (tested on ubuntu 12.04 LTS)
* res/ contains resources including shader source and obj files
* src/ contains the c++ code for the project along with SOIL and tiny_obj_loader
* shared32/ contains freeglut, glm, and glew.

-------------------------------------------------------------------------------
REQUIREMENTS:
-------------------------------------------------------------------------------

In this project, you are given code for:
* Loading .obj files
* Rendering to a minimal G buffer:
###Basic features:
* Rendering to G buffer:
* Depth
* Normal
* Color
* Eye space position
* Rendering simple ambient and directional lighting to texture
* Example post process shader to add a vignette
* Post process shader to add a vignette

You are required to implement:
* Either of the following effects
* Bloom (feel free to use [GPU Gems](http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html) as a rough guide)
* "Toon" Shading (with basic silhouetting)
###Advanced features:
* Bloom with separable filter for Gaussian blur
* Toon Shading with Canny Edge detection
* Point light sources
* An additional G buffer slot and some effect showing it off

**NOTE**: Implementing separable convolution will require another link in your pipeline and will count as an extra feature if you do performance analysis with a standard one-pass 2D convolution. The overhead of rendering and reading from a texture _may_ offset the extra computations for smaller 2D kernels.
* Glowmap G-buffer slot
* Screen space ambient occlusion (SSAO)

You must implement two of the following extras:
* The effect you did not choose above
* Screen space ambient occlusion
* Compare performance to a normal forward renderer with
* No optimizations
* Coarse sort geometry front-to-back for early-z
* Z-prepass for early-z
* Optimize g-buffer format, e.g., pack things together, quantize, reconstruct z from normal x and y (because it is normalized), etc.
* Must be accompanied with a performance analysis to count
* Additional lighting and pre/post processing effects! (email first please, if they are good you may add multiple).
###Input:
* 1: (linear) Depth shading
* 2: Eye space normal
* 3: Flat shading
* 4: Eye space position
* 5: Diffuse shading with point light and directional light
* 6: Toon shading
* Shift+6: Toon shading with silhouette
* 7: Blooming
* Shift+7: Glow map used for blooming
* 8: Screen Space ambient occlusion
* 0: Directional light only

-------------------------------------------------------------------------------
README
SCREENSHOTS:
-------------------------------------------------------------------------------
All students must replace or augment the contents of this Readme.md in a clear
manner with the following:
####Point light source
![alt text](renders/point_light.bmp)

* A brief description of the project and the specific features you implemented.
* At least one screenshot of your project running.
* A 30 second or longer video of your project running. To create the video you
can use http://www.microsoft.com/expression/products/Encoder4_Overview.aspx
* A performance evaluation (described in detail below).
####Toon Shading
![alt text](renders/Dragon_toon.bmp)

-------------------------------------------------------------------------------
PERFORMANCE EVALUATION
-------------------------------------------------------------------------------
The performance evaluation is where you will investigate how to make your
program more efficient using the skills you've learned in class. You must have
performed at least one experiment on your code to investigate the positive or
negative effects on performance.
####Toon Shading with Edge
![alt text](renders/Dragon_edge.bmp)

We encourage you to get creative with your tweaks. Consider places in your code
that could be considered bottlenecks and try to improve them.
####Blooming
![alt text](renders/Dragon_Bloom.bmp)

Each student should provide no more than a one page summary of their
optimizations along with tables and or graphs to visually explain any
performance differences.
####Diffuse lighting without Screen Space Ambient Occlusion
![alt text](renders/sponza_SSAO_contrast.bmp)

-------------------------------------------------------------------------------
THIRD PARTY CODE POLICY
-------------------------------------------------------------------------------
* Use of any third-party code must be approved by asking on the Google groups.
If it is approved, all students are welcome to use it. Generally, we approve
use of third-party code that is not a core part of the project. For example,
for the ray tracer, we would approve using a third-party library for loading
models, but would not approve copying and pasting a CUDA function for doing
refraction.
* Third-party code must be credited in README.md.
* Using third-party code without its approval, including using another
student's code, is an academic integrity violation, and will result in you
receiving an F for the semester.
####Diffuse lighting with Screen Space Ambient Occlusion
![alt text](renders/sponza_SSAO.bmp)

####Sponza blooming
![alt text](renders/sponza_blooming.bmp)

####Glow map used for Sponza blooming
![alt text](renders/sponza_glowmap.bmp)
-------------------------------------------------------------------------------
SELF-GRADING
PERFORMANCE EVALUATION
-------------------------------------------------------------------------------
* On the submission date, email your grade, on a scale of 0 to 100, to Liam,
[email protected], with a one paragraph explanation. Be concise and
realistic. Recall that we reserve 30 points as a sanity check to adjust your
grade. Your actual grade will be (0.7 * your grade) + (0.3 * our grade). We
hope to only use this in extreme cases when your grade does not realistically
reflect your work - it is either too high or too low. In most cases, we plan
to give you the exact grade you suggest.
* Projects are not weighted evenly, e.g., Project 0 doesn't count as much as
the path tracer. We will determine the weighting at the end of the semester
based on the size of each project.
This section will come later.


---
SUBMISSION
HOW TO BUILD
---
As with the previous projects, you should fork this project and work inside of
your fork. Upon completion, commit your finished project back to your fork, and
make a pull request to the master repository. You should include a README.md
file in the root directory detailing the following

* A brief description of the project and specific features you implemented
* At least one screenshot of your project running.
* A link to a video of your project running.
* Instructions for building and running your project if they differ from the
base code.
* A performance writeup as detailed above.
* A list of all third-party code used.
* This Readme file edited as described above in the README section.

This project make use of OpenGL 4.4 with support of multidimensional arrays, just for performance comparison sake. Make sure you have the latest driver support.

---
ACKNOWLEDGEMENTS
---
This project makes use of [tinyobjloader](http://syoyo.github.io/tinyobjloader/) and [SOIL](http://lonesock.net/soil.html)
* This project makes use of [tinyobjloader](http://syoyo.github.io/tinyobjloader/) and [SOIL](http://lonesock.net/soil.html)
* References for edge detection algorithm used in toon shader:
* [Wikipedia Canny edge detector page](http://en.wikipedia.org/wiki/Canny_edge_detector)
* [Wikipedia Sobel operator page](http://en.wikipedia.org/wiki/Sobel_operator)
* [Songho's page for 2D convolution](http://www.songho.ca/dsp/convolution/convolution.html)
* References for blooming effect:
* [GPU Gem chapter](http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html)
* [Devmaster Tutorial](http://devmaster.net/posts/3100/shader-effects-glow-and-bloom)
* [Non-maximal suppression](http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter40.html)
* References for SSAO implementation:
* [Devmaster Tutorial](http://devmaster.net/posts/3095/shader-effects-screen-space-ambient-occlusion)
* [Game Dev Tutorial](http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-simple-and-practical-approach-to-ssao-r2753)
* [Base code for SSAO from CIS565 Fall 2012](https://github.com/CIS565-Fall-2012/Project5-AdvancedGLSL)



3 changes: 2 additions & 1 deletion base/PROJ_WIN/P6/P6/P6.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(SolutionDir)$(Configuration);..\..\..\..\shared32\glew\lib;..\..\..\..\shared32\freeglut\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>freeglut.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>freeglut.lib;glew32.lib;SOIL.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
Expand All @@ -90,6 +90,7 @@
<None Include="..\..\..\res\shaders\point.frag" />
<None Include="..\..\..\res\shaders\post.frag" />
<None Include="..\..\..\res\shaders\post.vert" />
<None Include="..\..\..\res\shaders\post2.frag" />
<None Include="..\..\..\res\shaders\shade.vert" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
3 changes: 3 additions & 0 deletions base/PROJ_WIN/P6/P6/P6.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@
<None Include="..\..\..\res\shaders\shade.vert">
<Filter>Resource Files</Filter>
</None>
<None Include="..\..\..\res\shaders\post2.frag">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>
Binary file added base/PROJ_WIN/P6/P6/freeglut.dll
Binary file not shown.
Binary file added base/PROJ_WIN/P6/P6/glew32.dll
Binary file not shown.
12 changes: 12 additions & 0 deletions base/res/buddha.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
# File Created: 04.07.2010 10:28:13

newmtl wire_134110008
Ns 32
d 1
Tr 1
Tf 1 1 1
illum 2
Ka 0.0000 0.0000 0.0000
Kd 0.5255 0.4314 0.0314
Ks 0.3500 0.3500 0.3500
Loading