Skip to content
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
171 changes: 33 additions & 138 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
------------------------------------------------------------------------------
CIS565: Project 6 -- Deferred Shader
-------------------------------------------------------------------------------
Fall 2014
-------------------------------------------------------------------------------
Due Wed, 11/12/2014 at Noon
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
NOTE:
-------------------------------------------------------------------------------
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.

This project also requires a WebGL capable browser. The project is known to
have issues with Chrome on windows, but Firefox seems to run it fine.

-------------------------------------------------------------------------------
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.
![glow25](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/glow_25.png)

-------------------------------------------------------------------------------
CONTENTS:
Expand Down Expand Up @@ -74,145 +54,58 @@ WASDRF - Movement (along w the arrow keys)
There are also mouse controls for camera rotation.

-------------------------------------------------------------------------------
REQUIREMENTS:
Implemented
-------------------------------------------------------------------------------

In this project, you are given code for:
* Loading .obj file
* Deferred shading pipeline
* GBuffer pass

You are required to implement:
* Either of the following effects
* Bloom
* "Toon" Shading (with basic silhouetting)
* Screen Space Ambient Occlusion
* Diffuse and Blinn-Phong shading

**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.

You must implement two of the following extras:
* The effect you did not choose above
* 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).

-------------------------------------------------------------------------------
RUNNING THE CODE:
Bloom
-------------------------------------------------------------------------------

Since the code attempts to access files that are local to your computer, you
will either need to:

* Run your browser under modified security settings, or
* Create a simple local server that serves the files


FIREFOX: change ``strict_origin_policy`` to false in about:config

CHROME: run with the following argument : `--allow-file-access-from-files`

(You can do this on OSX by running Chrome from /Applications/Google
Chrome/Contents/MacOS with `open -a "Google Chrome" --args
--allow-file-access-from-files`)

* To check if you have set the flag properly, you can open chrome://version and
check under the flags

RUNNING A SIMPLE SERVER:

If you have Python installed, you can simply run a simple HTTP server off your
machine from the root directory of this repository with the following command:

`python -m SimpleHTTPServer`
![glow25](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/glow_25.png)
![glow15](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/glow_15.png)
![glow10](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/glow_10.png)
![glow5](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/glow_5.png)
![glow0](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/glow_0.png)

-------------------------------------------------------------------------------
RESOURCES:
Ambient Occlusion
-------------------------------------------------------------------------------
![off](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/AO_off.png)
![no blur](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/AO_0.png)
![no blur white](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/AO_0_white.png)
![2 blur](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/AO_2.png)
![2 blur white](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/AO_2_white.png)
![5 blur](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/AO_5.png)
![5 blur white](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/AO_5_white.png)

The following are articles and resources that have been chosen to help give you
a sense of each of the effects:

* Bloom : [GPU Gems](http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html)
* Screen Space Ambient Occlusion : [Floored
Article](http://floored.com/blog/2013/ssao-screen-space-ambient-occlusion.html)

-------------------------------------------------------------------------------
README
Toon Shading
-------------------------------------------------------------------------------
All students must replace or augment the contents of this Readme.md in a clear
manner with the following:

* 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 [Open Broadcaster Software](http://obsproject.com)
* A performance evaluation (described in detail below).
![off](https://raw.githubusercontent.com/RTCassidy1/Project6-DeferredShader/master/renders/TrexToon.png)

-------------------------------------------------------------------------------
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.
I'm running on a 2.7ghz i7 macbookPro with a NVIDIA GeForce GT 650M 1024 MB video card. All my tests were done in firefox.

We encourage you to get creative with your tweaks. Consider places in your code
that could be considered bottlenecks and try to improve them.
In my implementation my post processing had a gaussian kernel that I can set to various widths and change the standard deviation.
* I broke Ambient Occlusion into a separate stage that rendered to a texture so that I could blur it in the post-processing phase.
* With the Blur off for ambient occlusion my performance oscilated between 57 and 60 frames per second
* with the Blur at 2 pixels in each direction (25 total pixels) the performance dropped to 48-49 FPS
* when I expanded the blur to 5 pixels each direction (121 pixels) performance dropped to 25-26 FPS

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.
I also included a glow in my post processing. I measured it's performance with Ambient Occlusion turned off.
* no glow performed at 60 FPS
* glow of 5 pixels each direction performed at 40 FPS
* glow of 10 pixels each direction performed at 21 FPS
* glow of 15 pixels each direction performed at 12 FPS
* glow of 25 pixels each direction performed at 5 FPS

-------------------------------------------------------------------------------
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.

-------------------------------------------------------------------------------
SELF-GRADING
-------------------------------------------------------------------------------
* On the submission date, email your grade, on a scale of 0 to 100, to Harmony,
[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.


---
SUBMISSION
---
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.
The bottleneck for both of these features was the gaussian blur. The reason is I implemented it as a 2d blur in a single shader. What I want to do , but haven't had time yet, is to implement two 1d gaussian blurs. One for the X direction and a second one for the Y. That way if my Gaussian is +/- 25 pixels in X and Y I only have to sample 101 pixels instead of 2601. This should offer a huge improvement in my glow25 performance.

---
ACKNOWLEDGEMENTS
Expand All @@ -222,3 +115,5 @@ Many thanks to Cheng-Tso Lin, whose framework for CIS700 we used for this
assignment.

This project makes use of [three.js](http://www.threejs.org).
This project also uses stats.js for performance analysis
The Trex model used in this project came from TurboSquid
2 changes: 1 addition & 1 deletion assets/deferred/posPass.vert
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ varying vec4 v_pos;
varying float v_depth;

void main(void){
gl_Position = u_mvp * vec4( a_pos, 1.0 );
gl_Position = u_mvp * vec4( a_pos, 1.0 );
v_pos = u_modelview * vec4( a_pos, 1.0 );
v_depth = ( gl_Position.z / gl_Position.w + 1.0 ) / 2.0;
}
Loading