Skip to content

Submission #10

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

Open
wants to merge 123 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
723aadc
Point lights complete.
rohith10 Nov 14, 2013
f867010
More point lights!
rohith10 Nov 15, 2013
bb77c50
Bloom shading?
rohith10 Nov 15, 2013
3d2eb2b
Bloom shading - almost.
rohith10 Nov 15, 2013
39302ce
More bloom shading stuff.
rohith10 Nov 15, 2013
342655d
Bloom shading and preliminary toon shading.
rohith10 Nov 15, 2013
ca67879
DOF!
rohith10 Nov 16, 2013
dd7e8f7
Submission commit.
rohith10 Nov 16, 2013
b629d7c
Update README.md
rohith10 Nov 16, 2013
8f1d933
Fixed DOF.
rohith10 Nov 21, 2013
cba94a8
Step 1: A fresh start. Goes a long way toward refactoring all the ugl…
rohith10 Feb 6, 2015
9c90d97
Step 2: Long overdue refactor/cleanup - Goodbye undesirable globals, …
rohith10 Feb 9, 2015
7066161
Step 3: Fully functional replace of freeglut with GLFW.
rohith10 Feb 12, 2015
8f741d3
Step 3.1: Minor refactoring
rohith10 Feb 12, 2015
0d164a2
Step 3.2: Cosmetic changes; Fixing vertical angle clamp
rohith10 Feb 18, 2015
99d8963
Step 4: Initial separation of church and er.. I mean, the App and the…
rohith10 Mar 5, 2015
fd4524c
Step 5: Major, major refactor complete. App and Renderer are separate…
rohith10 Mar 15, 2015
2f466c8
Step 5.1: Minor rename: POSTPROCESS_FRAMEBUFFER -> LIGHTING_FRAMEBUFFER
rohith10 Mar 23, 2015
9189651
Step 6: Introducing a ShaderConstantManager! .... (ABOUT TIME!)
rohith10 Apr 27, 2015
f4764c7
Reorganize GLRenderer.cpp
rohith10 Apr 29, 2015
e1e4360
Merge branch 'Reorganize-GLRenderer.cpp'
rohith10 Apr 29, 2015
124a939
Replace all non-texture glUniforms with SetShaderConstants.
rohith10 May 1, 2015
2877497
Step 6.1: Minor changes to how SetShaderConstant handles floats.
rohith10 May 3, 2015
a36b007
Step 6.2: Moving template definitions to the ShaderConstantManager he…
rohith10 May 3, 2015
1c04f95
Step 6.3: Replace all non-texture glUniforms with SetShaderConstants.
rohith10 May 3, 2015
7277148
Step 6.3.1: Vertex arrays now deleted before VBs/IBs. They are contai…
rohith10 May 8, 2015
3ccb4d4
New class GLProgram - holds the id of a program as well as all the te…
rohith10 May 12, 2015
eb73138
Fixing asserts in GLProgram; Fix for incorrect texture names used whi…
rohith10 May 14, 2015
b8347ae
Fixing vertex attribute bindings to match vertex specification. (Derp…
rohith10 May 16, 2015
daed726
Step 7: Create new class "GLProgram" to encapsulate shader program/te…
rohith10 May 16, 2015
f59d6fa
[minor] Step 7.0.1: Silently ignore trying to set an invalid texture.
rohith10 May 20, 2015
e635817
Shader refactor to use uniform blocks.
rohith10 May 26, 2015
274bbf0
ShaderConstantManager and Utility changes to support constant buffers.
rohith10 Jun 1, 2015
8e2ca96
Compilable state. Requires tons of debugging.
rohith10 Jun 2, 2015
de1dad8
Removing unused uniforms from shaders.
rohith10 Jun 10, 2015
4288140
Changes as a result of debugging:
rohith10 Jun 10, 2015
2d924a5
Shader changes to specify constant buffer bind points.
rohith10 Jun 10, 2015
2690d83
[major] Step 8: Switch to using uniform (constant) buffers.
rohith10 Jun 10, 2015
b4ab541
Update README.md
rohith10 Jun 10, 2015
90c1483
Step 8.1: Now applying per-frame shader constants just once, at the b…
rohith10 Jun 18, 2015
ae5317c
8.1.1: [minor] Remove debug comment.
rohith10 Jun 18, 2015
b9e3f70
Refactoring common code into header shaders. First step of larger sha…
rohith10 Jun 19, 2015
31acfbb
More shader refactoring; Fixing subtle bug in replacing shader prepro…
rohith10 Jun 21, 2015
f9a75d1
Transitioning shader constants into a uniform naming convention inclu…
rohith10 Jun 21, 2015
c1b56ac
Transitioning continued.. with PerFrame constants.
rohith10 Jun 22, 2015
d3b777c
Transitioning continued .. with PerDraw_Object.
rohith10 Jun 22, 2015
7c1dcf0
Transitioning continued .. with input attributes.
rohith10 Jun 22, 2015
cda9971
Transitioning continued .. with fragment shader outputs.
rohith10 Jun 22, 2015
9e35423
More Transitioning .. with in-betweens.
rohith10 Jun 22, 2015
32e47aa
Cleaning up shaders.
rohith10 Jun 23, 2015
6e4fb1e
Cleaning up remaining shaders.
rohith10 Jun 23, 2015
ceb4f5c
[major] Step 9: Refactoring and cleaning up shaders.
rohith10 Jun 23, 2015
8967300
Update README.md
rohith10 Jun 23, 2015
7759eec
Update README.md
rohith10 Jun 23, 2015
2a70ce5
[minor] Ongoing performance improvements.
rohith10 Jun 26, 2015
14b315e
[minor] Ongoing perf improvements - now using unordered_maps in Shade…
rohith10 Jun 26, 2015
25821dd
[minor] Perf improvement in progress - now using unordered_maps in GL…
rohith10 Jun 26, 2015
fbd552f
Replaced glm::notEqual with custom written functions.
rohith10 Jul 1, 2015
dc15c9e
Replaced in-built string hashing or std::[unordered_]map with custom …
rohith10 Jul 1, 2015
6d39ad9
Using custom hash function to lookup constant buffers by name.
rohith10 Jul 1, 2015
d199d12
Long overdue solution configuration changes.
rohith10 Jul 7, 2015
ae4fe11
Added GL type aliases typedef'd to native types. This allows us to ce…
rohith10 Jul 8, 2015
2e38bd7
Initial texturing support.
rohith10 Jul 8, 2015
0f3c2ad
Now using ref-counted textures to get rid of duplicate texture loads.
rohith10 Jul 9, 2015
9fbf130
Fix texcoords.
rohith10 Jul 9, 2015
e695565
Gamma correction in shader.
rohith10 Jul 9, 2015
9e30be4
[major] Added texturing support. Currently only using diffuse mapping.
rohith10 Jul 9, 2015
0f7870c
Now using SRGB framebuffers, thereby avoiding gamma correction within…
rohith10 Jul 9, 2015
9025a72
[minor] Trying to make sense of some non-sensical texture coords. Oh …
rohith10 Jul 9, 2015
407eb1c
Now properly using a core 4.5 context.
rohith10 Jul 23, 2015
b746cc6
[minor] Removed a useless assert in ShaderConstantManager::Destroy th…
rohith10 Jul 23, 2015
284c656
[minor] Fixing texture sampling; Also making correct use of index buf…
rohith10 Jul 25, 2015
7f12fdf
Removing "glowmask" texture and old bloom code.
rohith10 Jul 26, 2015
a371b89
More 4.5 compliance; Now loading textures using copy-pasta'd code fro…
rohith10 Jul 26, 2015
4caf8a8
[minor] ApplyShaderConstantsForFullScreenPass -> SetTexturesForFullSc…
rohith10 Jul 28, 2015
e8dc0b5
[minor] Reorder SetTexturesForFullScreenPass, rename textures in Post…
rohith10 Jul 28, 2015
9044dbd
[minor] Our input textures are in linear space.
rohith10 Jul 28, 2015
25b1ecd
[minor] Removing DISPLAY_LIGHTS
rohith10 Jul 28, 2015
b5eb15c
Restoring debug/diagnostic functionality.
rohith10 Jul 28, 2015
3336d27
FreeGLUT has been exorcised from the project.
rohith10 Jul 29, 2015
7529fbc
[minor] Project updates.
rohith10 Jul 29, 2015
cd95dc3
Upgrade GLM to latest stable version (0.9.6.3); code changes for comp…
rohith10 Jul 30, 2015
c586079
Upgrade glew to latest stable (1.12.0). Removed dll version of glew. …
rohith10 Jul 31, 2015
ad01e69
Utility.h should not include glew.h; Fixup for single-line comment in…
rohith10 Jul 31, 2015
9371a81
Now using Debug Output functionality to catch and report errors.
rohith10 Jul 31, 2015
5582572
[minor]:
rohith10 Oct 14, 2015
f89faa9
Moved directional and ambient light constants to a separate const buf…
rohith10 Oct 16, 2015
51528d4
[minor]
rohith10 Oct 18, 2015
3697918
Normals are now in world space. This essentially means we're doing wo…
rohith10 Oct 18, 2015
0b7e122
[minor] Textures fix - SOIL is weird.
rohith10 Oct 23, 2015
20d3153
Back to view-space lighting. Trying to store numbers in the range [-1…
rohith10 Oct 24, 2015
76869a8
std::map::at() will be called only where a resulting out_of_range exc…
rohith10 Oct 25, 2015
36cdb39
Near/far plane distances are now app parameterizable.
rohith10 Oct 26, 2015
7d3fab4
- Initial check-in of tangent space calculations
rohith10 Nov 30, 2015
2c5c928
Normal mapping works. Input is badly busted, so output will be too. N…
rohith10 Dec 4, 2015
765b846
Normal mapping done. Includes many changes:
rohith10 Dec 6, 2015
35b22da
Now applying a scene adaptive scale to ensure that our coordinates st…
rohith10 Dec 17, 2015
406c15a
Fix calculation of offsets while using the Standard Uniform Block Lay…
rohith10 Dec 25, 2015
d6f18b6
[minor] Fix loop logic.
rohith10 Dec 30, 2015
57064ac
Separating constant buffer bindings from buffer change commits. Perfo…
rohith10 Dec 30, 2015
127e2ce
[minor] Fix tangent/bitangent calculation.
rohith10 Dec 31, 2015
4b73a8c
[minor] Now using synchronous debug output.
rohith10 Dec 31, 2015
33d175a
Log function updates - logging now uses the OutputDebugString API cal…
rohith10 Dec 31, 2015
c17837f
Using BufferSubData instead of BufferData for ubo streaming.
rohith10 Jan 4, 2016
4808527
Using MapBufferRange with explicit buffer invalidation.
rohith10 Jan 15, 2016
1443b2f
Unsynch'd MapBufferRange + explicit buffer invalidation on map.
rohith10 Jan 15, 2016
7450e26
GL 4.5 Step 1: Migrate all buffers and textures to immutable storage,…
rohith10 Jan 17, 2016
c64a496
GL 4.5 Step 2 (of 2): Divorce Vertex Specification from Buffers.
rohith10 Jan 18, 2016
2c31433
Upgrade to GL 4.5. Changes include using Texture/Buffer Storage funct…
rohith10 Jan 18, 2016
525b13c
Switch over to using smart pointers where sensible.
rohith10 Jan 28, 2016
a6d759a
[minor] Refactor the CreateVertexSpecification method to directly ret…
rohith10 Jan 31, 2016
e75cfba
[minor] [project-management] 2015 versions of all projects.
rohith10 Feb 1, 2016
ba77b43
[project-management] Bump GLFW to version 3.1.2, Move glm to base/src…
rohith10 Feb 1, 2016
a6099fa
Merge branch 'master' into P6-D3D12
rohith10 Feb 1, 2016
f696c04
Update P6_2015 project file with changes merged from master, update a…
rohith10 Feb 1, 2016
97b4c21
[project-management] More project config updates: VS2015 projects now…
rohith10 Feb 1, 2016
c42fcbc
Clone VS2013 project filters into 2015.
rohith10 Jun 21, 2016
0d90996
The VS2015 version is now the default.
rohith10 Jun 21, 2016
7fe934e
New files in project: ShaderResourceReferences (source + header). The…
rohith10 Mar 22, 2017
cc3c761
[minor] Fix compiler warning for signed vs. unsigned comparison.
rohith10 Mar 22, 2017
b1b61b0
Remove VS 2013 projects.
rohith10 Sep 6, 2017
3bc00d5
Upgrade to x64 + VS 2017.
rohith10 Sep 6, 2017
0ff618a
Upgrade GLEW to 2.1.0 for OpenGL 4.6
rohith10 Sep 6, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
164 changes: 6 additions & 158 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,163 +1,11 @@
# Compiled Object files
*.slo
*.lo
*.o

# Compiled Dynamic libraries
*.so
*.dylib

# Compiled Static libraries
*.lai
*.la
*.a

# Output
sph/output/*

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml
*.pubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac crap
.DS_Store
base/runtime*
x64/

# Vim stuff
*.swp
# VS 2015+ Intellisense
.vs/
*.db
*.opendb
192 changes: 4 additions & 188 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,192 +1,8 @@
-------------------------------------------------------------------------------
CIS565: Project 6: Deferred Shader
P6: A modern OpenGL Renderer
-------------------------------------------------------------------------------
Fall 2013
-------------------------------------------------------------------------------
Due Friday 11/15/2013
-------------------------------------------------------------------------------

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

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

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

---
BASE CODE TOUR
---

Most of your edits will be confined to the various fragment shader programs and main.cpp.

Some methods worth exploring are:

[initShader](https://github.com/CIS565-Fall-2013/Project6-DeferredShader/blob/master/base/src/main.cpp#L223):
This method initializes each shader program from specified source files. Note that the source name is declared inside a `#ifdef WIN32` guard block. This is done to reflect the relative directory structure between the linux and windows versions of the code.

[initFBO](https://github.com/CIS565-Fall-2013/Project6-DeferredShader/blob/master/base/src/main.cpp#L360):
This method initializes the framebuffer objects used as render targets for the first and second stage of the pipeline. When you go to add another slot to the G buffer you will need to modify to first FBO accordingly. Try finding all the places where `colorTexture` is used (ctrl+F in windows will be helpful) and look at how textures are created, freed, added to the FBO, and assigned to the appropriate shader programs before adding your own. Also keep in mind that textures can be reused as inputs in other pipeline stages, for instance you might want access to the normals both in the lighting stage and in the post process stage.

[draw_mesh](https://github.com/CIS565-Fall-2013/Project6-DeferredShader/blob/master/base/src/main.cpp#L574),
[draw_quad](https://github.com/CIS565-Fall-2013/Project6-DeferredShader/blob/master/base/src/main.cpp#L647),
[draw_light](https://github.com/CIS565-Fall-2013/Project6-DeferredShader/blob/master/base/src/main.cpp#L657):
These methods render the scene geometry, viewing quad, and point light quad to the screen. The draw_light method in particular is interesting because it will set up the scissor window for efficient rendering of point lights.

[display](https://github.com/CIS565-Fall-2013/Project6-DeferredShader/blob/master/base/src/main.cpp#L742):
This is where the graphical work of your program is done. The method is separated into three stages with the majority of work being done in stage 2.

Stage 1 renders the scene geometry to the G-Buffer
* pass.vert
* pass.frag

Stage 2 renders the lighting passes and accumulates to the P-Buffer
* shade.vert
* ambient.frag
* point.frag
* diagnostic.frag

Stage 3 renders the post processing
* post.vert
* post.frag

[keyboard](https://github.com/CIS565-Fall-2013/Project6-DeferredShader/blob/master/base/src/main.cpp#L870):
This is a good reference for the key mappings in the program.
WASDQZ - Movement
X - Toggle scissor test
R - Reload shaders
1 - View depth
2 - View eye space normals
3 - View Diffuse color
4 - View eye space positions
5 - View lighting debug mode
0 - Standard view

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

In this project, you are given code for:
* Loading .obj files
* Rendering to a minimal G buffer:
* Depth
* Normal
* Color
* Eye space position
* Rendering simple ambient and directional lighting to texture
* Example 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)
* 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.

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

-------------------------------------------------------------------------------
README
-------------------------------------------------------------------------------
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 http://www.microsoft.com/expression/products/Encoder4_Overview.aspx
* A performance evaluation (described in detail below).

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

We encourage you to get creative with your tweaks. Consider places in your code
that could be considered bottlenecks and try to improve them.

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.

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


---
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 fresh direction, a fresh start. I'm calling this P6 (yes, I'm a completely unimaginative sod).

* 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.
Uses [tinyobjloader](http://syoyo.github.io/tinyobjloader/), [SOIL](http://lonesock.net/soil.html), [glew](http://glew.sourceforge.net/) and [glm](http://glm.g-truc.net/).

---
ACKNOWLEDGEMENTS
---
This project makes use of [tinyobjloader](http://syoyo.github.io/tinyobjloader/) and [SOIL](http://lonesock.net/soil.html)
(c) Rohith Chandran. This is an extension of a class project I did when I was at the University of Pennsylvania, so parts (c) Liam Boone, who wrote the initial framework, from which this was originally forked.
Loading