diff --git a/README.md b/README.md
index f22c764..6a22e6a 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,17 @@
-------------------------------------------------------------------------------
-CIS565: Project 6: Deferred Shader
+Deferred Shader
-------------------------------------------------------------------------------
Fall 2013
-------------------------------------------------------------------------------
-Due Friday 11/15/2013
--------------------------------------------------------------------------------
+
+
+Youtube Video of Rendering:
+
+
+
--------------------------------------------------------------------------------
NOTE:
-------------------------------------------------------------------------------
This project requires any graphics card with support for a modern OpenGL
@@ -17,7 +22,10 @@ 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 implements a three stage deffered shader pipeline.
+Stage 1 renders geometry and samples model textures.
+Stage 2 performs point and ambient lighting calculations
+Stage 3 does any post processing effects
-------------------------------------------------------------------------------
CONTENTS:
@@ -31,29 +39,11 @@ The Project6 root directory contains the following subdirectories:
* 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.
+-------------------------------------------------------------------------------
+CODE TOUR/CONTROLS
+-------------------------------------------------------------------------------
-Stage 1 renders the scene geometry to the G-Buffer
+Stage 1 samples model textures renders the scene geometry to the G-Buffer
* pass.vert
* pass.frag
@@ -67,7 +57,8 @@ 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):
+Keyboard controls
+[keyboard](https://github.com/cboots/Deferred-Shading/blob/master/base/src/main.cpp#L1178):
This is a good reference for the key mappings in the program.
WASDQZ - Movement
X - Toggle scissor test
@@ -77,114 +68,102 @@ R - Reload shaders
3 - View Diffuse color
4 - View eye space positions
5 - View lighting debug mode
+6 - View Specular Mapping
+7 - View Only Bloomed Geometry
0 - Standard view
+x - Toggle Scissor Test
+r - Reload Shaders
+p - Print camera position to console
+j - Toggle timing measurements to console (averaged since last reset)
+SPACE - Reset timing averages
+
+Shift-L - Toggle Bloom
+Shift-T - Toggle Toon Shading
+Shift-D - Toggle Diffuse Mapping
+Shift-S - Toggle Specular Mapping
+Shift-B - Toggle Bump Mapping
+Shift-M - Toggle Transparency Masking
+
+c - Reset diffuse color to default
+t - Change diffuse color to texture coordinate visualization
+h - Overlay diffuse color with visualization of available textures
+b - Change diffuse color to bump map visualization if available
+m - Change diffuse color to white if mask texture is available
+
-------------------------------------------------------------------------------
-REQUIREMENTS:
+Features:
-------------------------------------------------------------------------------
-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
+* Renders .obj files with support for .mtl files with
+ * Diffuse Textures
+ * Specular Textures
+ * Height Maps (Bump Mapping)
+ * Texture Masking
+
+* Bloom (Not seperable, very inefficient)
+
+
-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
+* "Toon" Shading (with basic silhouetting and color quantization)
+
+
-**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).
+* Point light sources with specular
+
-------------------------------------------------------------------------------
-README
+SCREENSHOTS
-------------------------------------------------------------------------------
-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).
+No special features enabled. Just Point lighting:
+
--------------------------------------------------------------------------------
-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.
+Diffuse Texture:
+
-We encourage you to get creative with your tweaks. Consider places in your code
-that could be considered bottlenecks and try to improve them.
+Specular Texture:
+
-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.
+Bump Mapping:
+
+
+
--------------------------------------------------------------------------------
-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.
+Masking:
+
+
+
+
+
+All Textures:
+
+
+Scissor Test Specular Bug:
+
+
-------------------------------------------------------------------------------
-SELF-GRADING
+PERFORMANCE EVALUATION
-------------------------------------------------------------------------------
-* On the submission date, email your grade, on a scale of 0 to 100, to Liam,
- liamboone@gmail.com, 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.
+I measured the synchronized time to complete each stage of the pipeline with various features enabled.
+Two test scenes were used, a wide shot of the entire hall and a closeup of the lion sculpture (see above).
+Bloom was so inefficient that I removed it from some charts for scale
+Full Hall Metrics:
----
-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.
+
+
+
+Lion Closeup Metrics:
+
+
+
+
+Clearly the non-seperated convolution involved in the bloom effect has a huge impact on performance.
+Most of the other effects had only minimal impact on performance.
+The scissor test gave a huge boost to stage 2 performance but as shown above it results in visual artifacts.
+Another takeaway of this data is the second stage (lighting calculation) is the most intensive part of the process.
---
ACKNOWLEDGEMENTS
diff --git a/base/PROJ_WIN/P6/P6/P6.vcxproj b/base/PROJ_WIN/P6/P6/P6.vcxproj
index 61a6915..3500f75 100644
--- a/base/PROJ_WIN/P6/P6/P6.vcxproj
+++ b/base/PROJ_WIN/P6/P6/P6.vcxproj
@@ -19,12 +19,14 @@
ApplicationtrueUnicode
+ v110ApplicationfalsetrueUnicode
+ v110
@@ -60,14 +62,14 @@
MaxSpeedtruetrue
- ..\..\..\src\SOIL;..\..\..\src\tiny_obj_loader;..\..\..\..\shared32\freeglut\include;..\..\..\..\shared32\glew\include;..\..\..\..\shared32\glm;%(AdditionalIncludeDirectories)
+ ..\SOIL;..\..\..\src\tiny_obj_loader;..\..\..\..\shared32\freeglut\include;..\..\..\..\shared32\glew\include;..\..\..\..\shared32\glm;%(AdditionalIncludeDirectories)truetruetrue$(SolutionDir)$(Configuration);..\..\..\..\shared32\glew\lib;..\..\..\..\shared32\freeglut\lib;%(AdditionalLibraryDirectories)
- freeglut.lib;glew32.lib;%(AdditionalDependencies)
+ SOIL.lib;freeglut.lib;glew32.lib;%(AdditionalDependencies)Console
diff --git a/base/PROJ_WIN/P6/P6/P6.vcxproj.collin boots.nvuser b/base/PROJ_WIN/P6/P6/P6.vcxproj.collin boots.nvuser
new file mode 100644
index 0000000..120bd4a
--- /dev/null
+++ b/base/PROJ_WIN/P6/P6/P6.vcxproj.collin boots.nvuser
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/base/PROJ_WIN/P6/P6/P6.vcxproj.collin.nvuser b/base/PROJ_WIN/P6/P6/P6.vcxproj.collin.nvuser
new file mode 100644
index 0000000..f262169
--- /dev/null
+++ b/base/PROJ_WIN/P6/P6/P6.vcxproj.collin.nvuser
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/base/PROJ_WIN/P6/P6/freeglut.dll b/base/PROJ_WIN/P6/P6/freeglut.dll
new file mode 100644
index 0000000..4ec8893
Binary files /dev/null and b/base/PROJ_WIN/P6/P6/freeglut.dll differ
diff --git a/base/PROJ_WIN/P6/P6/glew32.dll b/base/PROJ_WIN/P6/P6/glew32.dll
new file mode 100644
index 0000000..999a59b
Binary files /dev/null and b/base/PROJ_WIN/P6/P6/glew32.dll differ
diff --git a/base/PROJ_WIN/P6/SOIL/SOIL.vcxproj b/base/PROJ_WIN/P6/SOIL/SOIL.vcxproj
index f341f68..2cff1d2 100644
--- a/base/PROJ_WIN/P6/SOIL/SOIL.vcxproj
+++ b/base/PROJ_WIN/P6/SOIL/SOIL.vcxproj
@@ -20,10 +20,12 @@
StaticLibraryUnicodetrue
+ v110StaticLibraryUnicode
+ v110
diff --git a/base/res/crytek-sponza/sponza.mtl b/base/res/crytek-sponza/sponza.mtl
index 168ec79..e0d1796 100644
--- a/base/res/crytek-sponza/sponza.mtl
+++ b/base/res/crytek-sponza/sponza.mtl
@@ -10,11 +10,12 @@ newmtl leaf
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_thorn_diff.tga
map_Kd textures\sponza_thorn_diff.tga
- map_d textures\sponza_thorn_mask.tga
+ map_Ks textures\sponza_thorn_spec.tga
+ map_d textures\sponza_thorn_mask.png
map_bump textures\sponza_thorn_bump.png
bump textures\sponza_thorn_bump.png
@@ -27,10 +28,11 @@ newmtl vase_round
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\vase_round.tga
map_Kd textures\vase_round.tga
+ map_Ks textures\vase_round_spec.tga
map_bump textures\vase_round_bump.png
bump textures\vase_round_bump.png
@@ -43,11 +45,12 @@ newmtl Material__57
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\vase_plant.tga
map_Kd textures\vase_plant.tga
- map_d textures\vase_plant_mask.tga
+ map_Ks textures\vase_plant_spec.tga
+ map_d textures\vase_plant_mask.png
newmtl Material__298
Ns 10.0000
@@ -88,11 +91,12 @@ newmtl bricks
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\spnza_bricks_a_diff.tga
map_Kd textures\spnza_bricks_a_diff.tga
- map_bump textures\spnza_bricks_a_diff.tga
+ map_Ks textures\spnza_bricks_a_spec.tga
+ map_bump textures\spnza_bricks_a_bump.png
bump textures\spnza_bricks_a_bump.png
newmtl arch
@@ -104,10 +108,11 @@ newmtl arch
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_arch_diff.tga
map_Kd textures\sponza_arch_diff.tga
+ map_Ks textures\sponza_arch_spec.tga
newmtl ceiling
Ns 10.0000
@@ -118,10 +123,12 @@ newmtl ceiling
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_ceiling_a_diff.tga
map_Kd textures\sponza_ceiling_a_diff.tga
+ map_Ks textures\sponza_ceiling_a_spec.tga
+
newmtl column_a
Ns 10.0000
@@ -148,10 +155,12 @@ newmtl floor
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_floor_a_diff.tga
map_Kd textures\sponza_floor_a_diff.tga
+ map_Ks textures\sponza_floor_a_spec.tga
+
newmtl column_c
Ns 10.0000
@@ -162,10 +171,11 @@ newmtl column_c
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_column_c_diff.tga
map_Kd textures\sponza_column_c_diff.tga
+ map_Ks textures\sponza_column_c_spec.tga
map_bump textures\sponza_column_c_bump.png
bump textures\sponza_column_c_bump.png
@@ -178,10 +188,12 @@ newmtl details
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_details_diff.tga
map_Kd textures\sponza_details_diff.tga
+ map_Ks textures\sponza_details_spec.tga
+
newmtl column_b
Ns 10.0000
@@ -192,10 +204,11 @@ newmtl column_b
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_column_b_diff.tga
map_Kd textures\sponza_column_b_diff.tga
+ map_Ks textures\sponza_column_b_spec.tga
map_bump textures\sponza_column_b_bump.png
bump textures\sponza_column_b_bump.png
@@ -220,10 +233,12 @@ newmtl flagpole
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_flagpole_diff.tga
map_Kd textures\sponza_flagpole_diff.tga
+ map_Ks textures\sponza_flagpole_spec.tga
+
newmtl fabric_e
Ns 10.0000
@@ -234,10 +249,12 @@ newmtl fabric_e
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_fabric_green_diff.tga
map_Kd textures\sponza_fabric_green_diff.tga
+ map_Ks textures\sponza_fabric_spec.tga
+
newmtl fabric_d
Ns 10.0000
@@ -248,10 +265,12 @@ newmtl fabric_d
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_fabric_blue_diff.tga
map_Kd textures\sponza_fabric_blue_diff.tga
+ map_Ks textures\sponza_fabric_spec.tga
+
newmtl fabric_a
Ns 10.0000
@@ -262,10 +281,12 @@ newmtl fabric_a
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
- Ks 0.0000 0.0000 0.0000
+ Ks 0.5880 0.5880 0.5880
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_fabric_diff.tga
map_Kd textures\sponza_fabric_diff.tga
+ map_Ks textures\sponza_fabric_spec.tga
+
newmtl fabric_g
Ns 10.0000
@@ -322,7 +343,7 @@ newmtl chain
Ke 0.0000 0.0000 0.0000
map_Ka textures\chain_texture.tga
map_Kd textures\chain_texture.tga
- map_d textures\chain_texture_mask.tga
+ map_d textures\chain_texture_mask.png
map_bump textures\chain_texture_bump.png
bump textures\chain_texture_bump.png
diff --git a/base/res/crytek-sponza/sponza.obj b/base/res/crytek-sponza/sponza.obj
index 281a316..1eca27a 100644
--- a/base/res/crytek-sponza/sponza.obj
+++ b/base/res/crytek-sponza/sponza.obj
@@ -14361,6 +14361,8 @@ f 3352/690/3630 3357/695/3635 3355/693/3633
f 3355/693/3633 3358/696/3636 3356/694/3634
f 3352/690/3630 3356/694/3634 3353/691/3631
f 3352/690/3630 3359/697/3637 3357/695/3635
+
+g sponza_01_a
usemtl vase_round
f 3360/698/3638 3361/699/3639 3362/700/3640 3363/701/3641
f 3364/702/3642 3365/703/3643 3366/704/3644 3367/705/3645
@@ -79165,6 +79167,8 @@ s 1
f 24431/14830/20801 24432/14831/20803 24434/14833/20800 24435/14834/20801
f 24425/14824/20800 24431/14830/20801 24435/14834/20801 24423/14822/20800
f 24426/14825/20800 24423/14822/20800 24435/14834/20801
+
+g sponza_71_a
usemtl bricks
s off
f 24429/14828/20840 24437/14828/20840 24438/14829/20840 24430/14829/20840
@@ -458968,6 +458972,8 @@ f 127666/75185/124029 127671/75190/124034 127669/75188/124032
f 127669/75188/124032 127672/75191/124035 127670/75189/124033
f 127666/75185/124029 127670/75189/124033 127667/75186/124030
f 127666/75185/124029 127673/75192/124036 127671/75190/124034
+
+g sponza_366_a
usemtl vase_round
f 127674/75193/124037 127675/75194/124038 127676/75195/124039 127677/75196/124040
f 127678/75197/124041 127679/75198/124042 127680/75199/124043 127681/75200/124044
@@ -464941,6 +464947,8 @@ f 129323/76520/125645 129328/76525/125650 129326/76523/125648
f 129326/76523/125648 129329/76526/125651 129327/76524/125649
f 129323/76520/125645 129327/76524/125649 129324/76521/125646
f 129323/76520/125645 129330/76527/125652 129328/76525/125650
+
+g sponza_367_a
usemtl vase_round
f 129331/76528/125653 129332/76529/125654 129333/76530/125655 129334/76531/125656
f 129335/76532/125657 129336/76533/125658 129337/76534/125659 129338/76535/125660
@@ -470913,6 +470921,8 @@ f 130980/77855/127260 130985/77860/127265 130983/77858/127263
f 130983/77858/127263 130986/77861/127266 130984/77859/127264
f 130980/77855/127260 130984/77859/127264 130981/77856/127261
f 130980/77855/127260 130987/77862/127267 130985/77860/127265
+
+g sponza_368_a
usemtl vase_round
f 130988/77863/127268 130989/77864/127269 130990/77865/127270 130991/77866/127271
f 130992/77867/127272 130993/77868/127273 130994/77869/127274 130995/77870/127275
@@ -476633,6 +476643,8 @@ f 132553/79117/128782 132554/79118/128783 132555/79115/128784 132556/79116/12878
f 132557/79120/128786 132558/79119/128787 132554/79118/128783 132553/79117/128782
f 132555/79115/128784 132554/79118/128783 132559/79121/128788 132560/79122/128789
f 132558/79119/128787 132561/79123/128790 132559/79121/128788 132554/79118/128783
+
+g sponza_369_a
usemtl vase_round
f 132562/79160/128791 132563/79161/128792 132564/79162/128793 132565/79163/128794
f 132566/79164/128795 132567/79165/128796 132568/79166/128797 132569/79167/128798
@@ -482353,6 +482365,8 @@ f 134127/80414/130305 134128/80415/130306 134129/80412/130307 134130/80413/13030
f 134131/80417/130309 134132/80416/130310 134128/80415/130306 134127/80414/130305
f 134129/80412/130307 134128/80415/130306 134133/80418/130311 134134/80419/130312
f 134132/80416/130310 134135/80420/130313 134133/80418/130311 134128/80415/130306
+
+g sponza_370_a
usemtl vase_round
f 134136/80457/130314 134137/80458/130315 134138/80459/130316 134139/80460/130317
f 134140/80461/130318 134141/80462/130319 134142/80463/130320 134143/80464/130321
@@ -488073,6 +488087,8 @@ f 135701/81711/131828 135702/81712/131829 135703/81709/131830 135704/81710/13183
f 135705/81714/131832 135706/81713/131833 135702/81712/131829 135701/81711/131828
f 135703/81709/131830 135702/81712/131829 135707/81715/131834 135708/81716/131835
f 135706/81713/131833 135709/81717/131836 135707/81715/131834 135702/81712/131829
+
+g sponza_371_a
usemtl vase_round
f 135710/81754/131837 135711/81755/131838 135712/81756/131839 135713/81757/131840
f 135714/81758/131841 135715/81759/131842 135716/81760/131843 135717/81761/131844
@@ -493794,6 +493810,8 @@ f 137275/83008/133352 137276/83009/133353 137277/83006/133354 137278/83007/13335
f 137279/83011/133356 137280/83010/133357 137276/83009/133353 137275/83008/133352
f 137277/83006/133354 137276/83009/133353 137281/83012/133358 137282/83013/133359
f 137280/83010/133357 137283/83014/133360 137281/83012/133358 137276/83009/133353
+
+g sponza_372_a
usemtl vase_round
f 137284/83051/133361 137285/83052/133362 137286/83053/133363 137287/83054/133364
f 137288/83055/133365 137289/83056/133366 137290/83057/133367 137291/83058/133368
@@ -518292,6 +518310,7 @@ f 143960/88549/139950 144005/88594/139995 144001/88590/139991 144003/88592/13999
f 143960/88549/139950 143640/88229/139630 143650/88239/139640
f 143871/88460/139861 143879/88468/139869 143889/88478/139879
f 143614/88203/139604 143607/88196/139597 143610/88199/139600
+g sponza_377_a
usemtl Material__298
f 144012/88601/140002 144013/88602/140003 144014/88603/140004
f 144015/88604/140005 144013/88602/140003 144012/88601/140002
@@ -524910,6 +524929,8 @@ f 145571/90160/141561 145616/90205/141606 145612/90201/141602 145614/90203/14160
f 145571/90160/141561 145251/89840/141241 145261/89850/141251
f 145482/90071/141472 145490/90079/141480 145500/90089/141490
f 145225/89814/141215 145218/89807/141208 145221/89810/141211
+
+g sponza_378_a
usemtl Material__298
f 145623/90212/141613 145624/90213/141614 145625/90214/141615
f 145626/90215/141616 145624/90213/141614 145623/90212/141613
diff --git a/base/res/crytek-sponza/textures/vase_hanging.tga b/base/res/crytek-sponza/textures/vase_hanging.tga
index 8954561..9fcf740 100644
Binary files a/base/res/crytek-sponza/textures/vase_hanging.tga and b/base/res/crytek-sponza/textures/vase_hanging.tga differ
diff --git a/base/res/crytek-sponza/textures/vase_hanging_backup.tga b/base/res/crytek-sponza/textures/vase_hanging_backup.tga
new file mode 100644
index 0000000..8954561
Binary files /dev/null and b/base/res/crytek-sponza/textures/vase_hanging_backup.tga differ
diff --git a/base/res/shaders/ambient.frag b/base/res/shaders/ambient.frag
index 69b878c..7dfa912 100644
--- a/base/res/shaders/ambient.frag
+++ b/base/res/shaders/ambient.frag
@@ -20,7 +20,8 @@ uniform mat4 u_Persp;
uniform sampler2D u_Depthtex;
uniform sampler2D u_Normaltex;
uniform sampler2D u_Positiontex;
-uniform sampler2D u_Colortex;
+uniform sampler2D u_DiffColortex;
+uniform sampler2D u_SpecColortex;
uniform sampler2D u_RandomNormaltex;
uniform sampler2D u_RandomScalartex;
@@ -67,9 +68,11 @@ vec3 samplePos(vec2 texcoords) {
return texture(u_Positiontex,texcoords).xyz;
}
+
+
//Helper function to automicatlly sample and unpack positions
-vec3 sampleCol(vec2 texcoords) {
- return texture(u_Colortex,texcoords).xyz;
+vec3 sampleSpecCol(vec2 texcoords) {
+ return texture(u_SpecColortex,texcoords).xyz;
}
//Get a random normal vector given a screen-space texture coordinate
@@ -100,7 +103,8 @@ void main() {
vec3 normal = sampleNrm(fs_Texcoord);
vec3 position = samplePos(fs_Texcoord);
- vec3 color = sampleCol(fs_Texcoord);
+ vec4 diffTexel = texture(u_DiffColortex,fs_Texcoord);
+ vec3 color = diffTexel.rgb;
vec3 light = u_Light.xyz;
float strength = u_Light.w;
if (lin_depth > 0.99f) {
@@ -108,7 +112,7 @@ void main() {
} else {
float ambient = u_LightIl;
float diffuse = max(0.0, dot(normalize(light),normal));
- out_Color = vec4(color*(strength*diffuse + ambient),1.0f);
+ out_Color = vec4(color*(strength*diffuse + ambient),1.0);
}
return;
}
diff --git a/base/res/shaders/diagnostic.frag b/base/res/shaders/diagnostic.frag
index ac73727..4a4166f 100644
--- a/base/res/shaders/diagnostic.frag
+++ b/base/res/shaders/diagnostic.frag
@@ -7,9 +7,11 @@
#define DISPLAY_DEPTH 0
#define DISPLAY_NORMAL 1
#define DISPLAY_POSITION 2
-#define DISPLAY_COLOR 3
+#define DISPLAY_DIFFUSE 3
#define DISPLAY_TOTAL 4
#define DISPLAY_LIGHTS 5
+#define DISPLAY_SPECULAR 6
+#define DISPLAY_BLOOM 7
/////////////////////////////////////
@@ -20,9 +22,11 @@ uniform mat4 u_Persp;
uniform sampler2D u_Depthtex;
uniform sampler2D u_Normaltex;
uniform sampler2D u_Positiontex;
-uniform sampler2D u_Colortex;
+uniform sampler2D u_DiffColortex;
+uniform sampler2D u_SpecColortex;
uniform sampler2D u_RandomNormaltex;
uniform sampler2D u_RandomScalartex;
+uniform sampler2D u_Bloomtex;
uniform float u_Far;
uniform float u_Near;
@@ -69,7 +73,12 @@ vec3 samplePos(vec2 texcoords) {
//Helper function to automicatlly sample and unpack positions
vec3 sampleCol(vec2 texcoords) {
- return texture(u_Colortex,texcoords).xyz;
+ return texture(u_DiffColortex,texcoords).xyz;
+}
+
+//Helper function to automicatlly sample and unpack positions
+vec3 sampleSpecCol(vec2 texcoords) {
+ return texture(u_SpecColortex,texcoords).xyz;
}
//Get a random normal vector given a screen-space texture coordinate
@@ -100,7 +109,9 @@ void main() {
vec3 normal = sampleNrm(fs_Texcoord);
vec3 position = samplePos(fs_Texcoord);
- vec3 color = sampleCol(fs_Texcoord);
+ vec4 diffTexel = texture(u_DiffColortex,fs_Texcoord);
+ vec3 color = diffTexel.rgb;
+ vec3 specColor = sampleSpecCol(fs_Texcoord);
vec3 light = u_Light.xyz;
float lightRadius = u_Light.w;
@@ -114,9 +125,16 @@ void main() {
case(DISPLAY_POSITION):
out_Color = vec4(abs(position) / u_Far,1.0f);
break;
- case(DISPLAY_COLOR):
- out_Color = vec4(color, 1.0);
+ case(DISPLAY_DIFFUSE):
+ out_Color = vec4(color, 1.0);
+ break;
+ case(DISPLAY_SPECULAR):
+ out_Color = vec4(specColor, 1.0);
break;
+ case (DISPLAY_BLOOM):
+ float bloom = texture(u_Bloomtex, fs_Texcoord);
+ out_Color = vec4(color, 1.0)*bloom;
+ break;
case(DISPLAY_LIGHTS):
case(DISPLAY_TOTAL):
break;
diff --git a/base/res/shaders/directional.frag b/base/res/shaders/directional.frag
index a34daab..ea881d7 100644
--- a/base/res/shaders/directional.frag
+++ b/base/res/shaders/directional.frag
@@ -20,7 +20,8 @@ uniform mat4 u_Persp;
uniform sampler2D u_Depthtex;
uniform sampler2D u_Normaltex;
uniform sampler2D u_Positiontex;
-uniform sampler2D u_Colortex;
+uniform sampler2D u_DiffColortex;
+uniform sampler2D u_SpecColortex;
uniform sampler2D u_RandomNormaltex;
uniform sampler2D u_RandomScalartex;
@@ -67,9 +68,10 @@ vec3 samplePos(vec2 texcoords) {
return texture(u_Positiontex,texcoords).xyz;
}
+
//Helper function to automicatlly sample and unpack positions
-vec3 sampleCol(vec2 texcoords) {
- return texture(u_Colortex,texcoords).xyz;
+vec3 sampleSpecCol(vec2 texcoords) {
+ return texture(u_SpecColortex,texcoords).xyz;
}
//Get a random normal vector given a screen-space texture coordinate
@@ -100,12 +102,15 @@ void main() {
vec3 normal = sampleNrm(fs_Texcoord);
vec3 position = samplePos(fs_Texcoord);
- vec3 color = sampleCol(fs_Texcoord);
+ vec4 diffTexel = texture(u_DiffColortex,fs_Texcoord);
+ vec3 color = diffTexel.rgb;
+ float bloom = diffTexel.a;
+
vec3 light = u_Light.xyz;
float lightRadius = u_Light.w;
float diffuse = max(0.0, dot(normalize(light),normal));
- out_Color = vec4(color*u_LightIl*diffuse,1.0f);
+ out_Color = vec4(color*u_LightIl*diffuse,bloom);
}
return;
diff --git a/base/res/shaders/pass.frag b/base/res/shaders/pass.frag
index e37dcbf..cbcc2aa 100644
--- a/base/res/shaders/pass.frag
+++ b/base/res/shaders/pass.frag
@@ -1,18 +1,118 @@
#version 330
+#extension GL_EXT_gpu_shader4: enable
+
+////////////////////////////
+// ENUMERATIONS
+////////////////////////////
+
+#define NO_CHANGE 0
+#define HASTEX_OVERLAY 1
+#define TEXCOORDS_AS_DIFFUSE 2
+#define BUMP_AS_DIFFUSE 3
+#define MASK_OVERLAY 4
+
uniform float u_Far;
-uniform vec3 u_Color;
+uniform vec3 u_Ka;
+uniform vec3 u_Kd;
+uniform vec3 u_Ks;
+uniform float u_specExp;
+
+uniform int u_PassthroughMode;
+
+//1 if true, 0 if texture is missing.
+uniform int u_hasDiffTex;
+uniform int u_hasSpecTex;
+uniform int u_hasBumpTex;
+uniform int u_hasMaskTex;
+
+///====Textures============
+uniform sampler2D u_DiffTex;
+uniform sampler2D u_SpecTex;
+uniform sampler2D u_BumpTex;
+uniform sampler2D u_MaskTex;
+///========================
in vec3 fs_Normal;
+in vec3 fs_Tangent;
+in vec3 fs_Binormal;
in vec4 fs_Position;
+in vec2 fs_Texcoord;
out vec4 out_Normal;
out vec4 out_Position;
-out vec4 out_Color;
+out vec4 out_Diff_Color;
+out vec4 out_Spec_Color;
+out vec3 out_Bloom;
void main(void)
{
out_Normal = vec4(normalize(fs_Normal),0.0f);
out_Position = vec4(fs_Position.xyz,1.0f); //Tuck position into 0 1 range
- out_Color = vec4(u_Color,1.0);
+
+ vec4 diffuseColor = vec4(u_Kd,1.0);
+
+ out_Bloom = vec3(0.0);
+ if(u_hasDiffTex > 0)
+ {
+ vec4 texel = texture(u_DiffTex,fs_Texcoord);
+ diffuseColor *= vec4(texel.rgb, 1.0);
+ out_Bloom = (1.0-texel.a)*texel.rgb;
+ }
+
+ //Pass through diffuse color
+ out_Diff_Color = vec4(diffuseColor.rgb, clamp(1.0-diffuseColor.a, 0.0, 1.0));
+
+
+ if(u_PassthroughMode == HASTEX_OVERLAY){
+ out_Diff_Color += 0.9*vec4(u_hasMaskTex,u_hasSpecTex,u_hasBumpTex,0.0);
+ }else if(u_PassthroughMode == TEXCOORDS_AS_DIFFUSE){
+ out_Diff_Color = vec4(fs_Texcoord.x, fs_Texcoord.y, 0.0, 1.0);
+ }
+
+
+ if(u_hasMaskTex > 0)
+ {
+ //Only discard samples if not in overlay mode
+ if(texture(u_MaskTex,fs_Texcoord).x < 1)
+ discard;
+ if(u_PassthroughMode == MASK_OVERLAY){
+ out_Diff_Color = vec4(texture(u_MaskTex,fs_Texcoord).rgb,1.0);
+ }
+
+ }
+
+ if(u_hasBumpTex > 0)
+ {
+ //TODO: Do Bump Mapping Here
+ ivec2 size = textureSize2D(u_BumpTex,0);
+ float scaling = 0.2;//Strength factor
+ const vec3 offsetDir = vec3(-1,0,1);
+ vec2 offset = 1.0/size;
+
+ float s11 = texture(u_BumpTex, fs_Texcoord).x;//Height at center
+ float s01 = texture(u_BumpTex, fs_Texcoord+offset*offsetDir.xy).x;//Left
+ float s21 = texture(u_BumpTex, fs_Texcoord+offset*offsetDir.zy).x;//Right
+ float s10 = texture(u_BumpTex, fs_Texcoord+offset*offsetDir.yx).x;//Down
+ float s12 = texture(u_BumpTex, fs_Texcoord+offset*offsetDir.yz).x;//Up
+ vec3 va = normalize(vec3(scaling,0.0,s21-s01));
+ vec3 vb = normalize(vec3(0.0,scaling,s12-s10));
+ vec4 bump = normalize(vec4( cross(va,vb), s11 ));
+ if(u_PassthroughMode == BUMP_AS_DIFFUSE){
+ out_Diff_Color = bump;
+ }
+
+ //Modify using
+ mat3 rotMat = mat3(fs_Tangent, fs_Binormal, fs_Normal);
+ out_Normal = vec4(rotMat*vec3(bump),0.0);
+ }
+
+
+ //Pass through specular color
+ out_Spec_Color = vec4(u_Ks, u_specExp);
+ if(u_hasSpecTex > 0)
+ {
+ out_Spec_Color *= vec4(texture(u_SpecTex,fs_Texcoord).rgb,1.0);
+ }
+
}
diff --git a/base/res/shaders/pass.vert b/base/res/shaders/pass.vert
index e36825f..700b449 100644
--- a/base/res/shaders/pass.vert
+++ b/base/res/shaders/pass.vert
@@ -8,14 +8,24 @@ uniform mat4x4 u_InvTrans;
in vec3 Position;
in vec3 Normal;
+in vec4 Tangent;
+in vec2 Texcoord;
out vec3 fs_Normal;
+out vec3 fs_Tangent;
+out vec3 fs_Binormal;
out vec4 fs_Position;
+out vec2 fs_Texcoord;
void main(void) {
- fs_Normal = (u_InvTrans*vec4(Normal,0.0f)).xyz;
+
+ fs_Normal =normalize((u_InvTrans*vec4(Normal,0.0f)).xyz);
+ fs_Tangent =normalize((u_InvTrans*vec4(Tangent.xyz,0.0f)).xyz);
+ fs_Binormal =normalize((u_InvTrans*vec4(normalize(cross(Normal, Tangent.xyz)*Tangent.w),0.0f)).xyz);
+
vec4 world = u_Model * vec4(Position, 1.0);
vec4 camera = u_View * world;
fs_Position = camera;
gl_Position = u_Persp * camera;
+ fs_Texcoord = Texcoord;
}
diff --git a/base/res/shaders/point.frag b/base/res/shaders/point.frag
index 98b90e0..e857281 100644
--- a/base/res/shaders/point.frag
+++ b/base/res/shaders/point.frag
@@ -20,7 +20,8 @@ uniform mat4 u_Persp;
uniform sampler2D u_Depthtex;
uniform sampler2D u_Normaltex;
uniform sampler2D u_Positiontex;
-uniform sampler2D u_Colortex;
+uniform sampler2D u_DiffColortex;
+uniform sampler2D u_SpecColortex;
uniform sampler2D u_RandomNormaltex;
uniform sampler2D u_RandomScalartex;
@@ -66,9 +67,10 @@ vec3 samplePos(vec2 texcoords) {
return texture(u_Positiontex,texcoords).xyz;
}
+
//Helper function to automicatlly sample and unpack positions
-vec3 sampleCol(vec2 texcoords) {
- return texture(u_Colortex,texcoords).xyz;
+vec3 sampleSpecCol(vec2 texcoords) {
+ return texture(u_SpecColortex,texcoords).xyz;
}
//Get a random normal vector given a screen-space texture coordinate
@@ -99,17 +101,43 @@ void main() {
vec3 normal = sampleNrm(fs_Texcoord);
vec3 position = samplePos(fs_Texcoord);
- vec3 color = sampleCol(fs_Texcoord);
+ vec4 diffTexel = texture(u_DiffColortex,fs_Texcoord);
+ vec3 color = diffTexel.rgb;
+
vec3 light = u_Light.xyz;
float lightRadius = u_Light.w;
out_Color = vec4(0,0,0,1.0);
if( u_DisplayType == DISPLAY_LIGHTS )
{
//Put some code here to visualize the fragment associated with this point light
+ out_Color = vec4(0.2,0.0,0.0,1.0);
}
else
{
//Put some code here to actually compute the light from the point light
+ vec3 lightDir = light-position;
+ float dist = length(lightDir);
+
+ float NdotL = max(dot(normal, normalize(lightDir)),0.0);
+
+ if(NdotL > 0.0)
+ {
+ float att = clamp((lightRadius-dist)/lightRadius, 0.0,1.0);
+ att *= att;
+
+ float kd = 0.60;
+ //diffuse
+ out_Color += att*vec4(color,1.0)*NdotL*u_LightIl;
+
+ //Specular
+ vec4 specColor = texture(u_SpecColortex,fs_Texcoord);
+ vec3 toReflectedLight = normalize(reflect((position-light), normal));
+ float specular = max(dot(toReflectedLight, normalize(-position)), 0.0);
+ specular = pow(specular, 50.0);
+
+ float ks = 1.0-kd;
+ out_Color += ks*specColor*specular;
+ }
}
return;
}
diff --git a/base/res/shaders/post.frag b/base/res/shaders/post.frag
index 2bf5afc..4bc79cc 100644
--- a/base/res/shaders/post.frag
+++ b/base/res/shaders/post.frag
@@ -18,9 +18,17 @@
uniform sampler2D u_Posttex;
uniform sampler2D u_RandomNormaltex;
uniform sampler2D u_RandomScalartex;
+uniform sampler2D u_Bloomtex;
+uniform sampler2D u_Depthtex;
+uniform sampler2D u_Normaltex;
uniform int u_ScreenWidth;
uniform int u_ScreenHeight;
+uniform int u_UseBloom;
+uniform int u_UseToon;
+uniform float u_Far;
+uniform float u_Near;
+
in vec2 fs_Texcoord;
@@ -38,6 +46,10 @@ uniform float falloff = 0.1f;
// UTILITY FUNCTIONS
/////////////////////////////////////
+float linearizeDepth(float exp_depth, float near, float far) {
+ return (2 * near) / (far + near - exp_depth * (far - near));
+}
+
//Helper function to automicatlly sample and unpack positions
vec3 sampleCol(vec2 texcoords) {
return texture(u_Posttex,texcoords).xyz;
@@ -60,15 +72,96 @@ float getRandomScalar(vec2 texcoords) {
texcoords.t*u_ScreenHeight/sz.y)).r;
}
+//Returns gradient squared
+vec3 sobel(sampler2D tex, vec2 texcoords) {
+ float xScale = 1.0/u_ScreenWidth;
+ float yScale = 1.0/u_ScreenHeight;
+
+ vec2 off = vec2(xScale,yScale);
+
+ vec3 ul = texture(tex, texcoords-vec2(-1.0, 1.0)*off).xyz;
+ vec3 u = texture(tex, texcoords-vec2( 0.0, 1.0)*off).xyz*2.0;
+ vec3 ur = texture(tex, texcoords-vec2( 1.0, 1.0)*off).xyz;
+ vec3 r = texture(tex, texcoords-vec2( 1.0, 0.0)*off).xyz*2.0;
+ vec3 dr = texture(tex, texcoords-vec2( 1.0,-1.0)*off).xyz;
+ vec3 d = texture(tex, texcoords-vec2( 1.0,-1.0)*off).xyz*2.0;
+ vec3 dl = texture(tex, texcoords-vec2( 0.0,-1.0)*off).xyz;
+ vec3 l = texture(tex, texcoords-vec2(-1.0, 0.0)*off).xyz*2.0;
+
+ vec3 horizontal = (ul+l+dl)-(ur+r+dr);
+ vec3 vertical = (ul+u+ur)-(dl+d+dr);
+
+ vec3 gradient_sq = horizontal*horizontal+vertical*vertical;
+
+ return gradient_sq;
+}
+
+vec4 quantize(vec4 color_in, int numBins)
+{
+ //Assume intial distribution between 0 and 1
+ color_in.rgb *= numBins;
+ color_in.rgb += vec3(.5,.5,.5);
+ ivec3 intrgb = ivec3(color_in.rgb);
+ color_in.rgb = vec3(intrgb)/numBins;
+ return color_in;
+}
+
+
+
+const int KERNEL_SIZE = 20;
+
+float boxFilter(float x, float y)
+{
+ //TODO: Find better weight function
+ int width = KERNEL_SIZE*2+1;
+ return 1.0/float(width*width);
+}
+
+
///////////////////////////////////
// MAIN
//////////////////////////////////
const float occlusion_strength = 1.5f;
void main() {
- vec3 color = sampleCol(fs_Texcoord);
- float gray = dot(color, vec3(0.2125, 0.7154, 0.0721));
- float vin = min(2*distance(vec2(0.5), fs_Texcoord), 1.0);
- out_Color = vec4(mix(pow(color,vec3(1.0/1.8)),vec3(gray),vin), 1.0);
+ vec4 texel = texture(u_Posttex,fs_Texcoord);
+ vec3 color = texel.rgb;
+
+ //Base color
+ out_Color = vec4(color, 1.0);
+
+
+ if(u_UseBloom > 0.0){
+ //Bloom color
+ float xScale = 1.0/u_ScreenWidth;
+ float yScale = 1.0/u_ScreenHeight;
+
+ vec3 bloomColor = vec3(0.0);
+ for(int x = -KERNEL_SIZE; x <= KERNEL_SIZE; x++)
+ {
+ for(int y = -KERNEL_SIZE; y <= KERNEL_SIZE; y++)
+ {
+ vec2 texCoord = fs_Texcoord + vec2(x*xScale,y*yScale);
+ bloomColor += 2.0*boxFilter(x,y)*texture(u_Bloomtex,texCoord).rgb;
+ }
+ }
+
+ out_Color += vec4(bloomColor,0.0);
+ }
+
+ if(u_UseToon > 0.0)
+ {
+ //Toon Shading
+ float exp_depth = texture(u_Depthtex, fs_Texcoord).r;
+ float lin_depth = linearizeDepth(exp_depth,u_Near,u_Far);
+
+ //Silouette
+ vec3 gradient_sq = sobel(u_Normaltex, fs_Texcoord);
+ if(length(gradient_sq) > 7.0){
+ out_Color = vec4(0.0);
+ }
+ //quantize colors
+ out_Color = quantize(out_Color,4);
+ }
return;
}
diff --git a/base/src/main.cpp b/base/src/main.cpp
index 9a0f6a0..f0970d1 100644
--- a/base/src/main.cpp
+++ b/base/src/main.cpp
@@ -17,6 +17,7 @@
#include
#include
#include
+#include