diff --git a/README.md b/README.md
index 919af39..38967f6 100644
--- a/README.md
+++ b/README.md
@@ -7,136 +7,148 @@ Due Friday 11/15/2013
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-NOTE:
+INTRODUCTION
-------------------------------------------------------------------------------
-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 is about deferred shading using glsl. In this deferred shading, the first-path shader is just as a common shader: the input is the meshes. When calculating the output, it do not shade the things like
+ambient light, specular light or sth. Instead, it will output the normal, color, position and emission of the point that the pixel is shading on.
--------------------------------------------------------------------------------
-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.
+And on the second-path is the true shader(so it is deferred), where use these information, to calculation the final fragment color of each pixel. It is somewhat similar to ray-tracing, but using rasterization to
+replace the ray intersection with the scene.
+
+In the project, as required, I implemented both Toon shading and Blooming effect(actually more likely to be a glowing effect).
-------------------------------------------------------------------------------
-CONTENTS:
+HOW TO USE
-------------------------------------------------------------------------------
-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.
+
+To turn on and off toon shading, uncomment/comment the #define USETOONSHADE in the ambient.frag
+
+To turn on and off SSAO, uncomment/comment the #define USESSAO in the ambient.frag
+
+To turn on and off pointlight, uncomment/comment the #define USEPOINTLIGHT in the point.frag
+
+The bloom shader is default on. I thus fork the cornell_box into 2 versions: cornell_box_notglow.obj and cornell_box_glow.obj. Changing the input argument will work.
+
+By the way, I used "Ka" in the mtl file as the emission of a material. So if you want something shiny, just change it!
+
-------------------------------------------------------------------------------
-REQUIREMENTS:
+TOON SHADING
-------------------------------------------------------------------------------
+The toon shading happen in the shader, instead of post-shading processing. The toon shading is simple: So for each dot(light,normal), I do not use it directly. Instead, it will be clamped to the threshold above it.
+So in my program,
+0.00-0.05->0.00
-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
+0.05-0.25->0.25
-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
+0.25-0.50->0.50
-**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.
+0.50-0.75->0.75
-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).
+0.75-1.00->1.00
+Another tricky part of the toon shading is the edge detection. If using post-shading process, it can be done easily with Sobel matrix(just multiply the Sobel operator with the pixel color.) Instead, I introduced my own
+ way to detect edge: compare the depth and the normal between itself and the G-Buffer around it. If an obvious difference is detected, than it will be shaded as the edge(color=0,0,0,1)
+
+ And below is the Toon shading result
+ 
+ 
-------------------------------------------------------------------------------
-README
+BLOOM SHADING
-------------------------------------------------------------------------------
-All students must replace or augment the contents of this Readme.md in a clear
-manner with the following:
+The Bloom shading is not that successful, and more likely to be a glow shading.
-* 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).
+I implement the bloom shading in the post-shading process: in the post fragment shader. So to implement this, I add a slot in the G-Buffer: the emission of the objects. I notice that the Ka(ambient) of the material
+ is the light that the object's emitting. (If it is a light or glowing object, then it is greater than (0,0,0), otherwise for normal object it is (0,0,0)). So in the pass shader, I put this emission information into
+ another texture(G Buffer slot). And I retrieve this information in 2 places:
+
+ 1. In toon-shader, if a pixel is a light source, then it will take the edge test.
+
+ 2. In the post shader: I applied the Gaussian Blur function to make this effect. Gaussian Function is easy:
+
+ float sigma=...; //tweak this number will tweak the sharpness of the Gaussian Blur
+
+ g=exp(-(dx*dx+dy*dy)/2.0f/sigma/sigma)/(2/PI/sigma/sigma)
+
+ One of the problem with Gaussian function is that it have to sample a lot of pixels around it, if the blur radius is large. To settle this problem, I increase the step size of the sampling so that the blurring
+ effect can expand to further place, and the sample rate per pixel was 21*21, in my program.
+
+Below is the blooming effect. I set the walls and blocks to be the light sources
+
-------------------------------------------------------------------------------
-PERFORMANCE EVALUATION
+SSAO
-------------------------------------------------------------------------------
-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.
+The SSAO, Screen-Space-Ambient-Occlusion, is a kind of algorithm that can shade the ambient shadow. The standard way of doing SSAO is like below:
+
+1. Sample a point in hemisphere around the normal. The radius is flexible
+
+2. Cast this point into the eye-coordination
+
+3. Calculate the screen-position of this point
+
+4. Compare the Z-value with the Z-buffer on this pixel. If it is closer, thats fine. Otherwise it is occluded, record it.
+
+5. Loop the above steps(1-4) for several times(8-32), sum the total occluded amount.
+
+6. Attenuate the color according to this occluded amount.
+
+I hack it a little bit:
+
+1. Sample the pixels around the pixel I'm calculating
+
+2. Get the Z-depth and the position of that point
+
+3. If that Z-depth is further than my z-depth, no occlusion happen.
-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.
+4. If our distance is too far away, no occlusion happen
+
+5. Otherwise I'm occluded by this point, record it.
+
+6. Loop the above steps for each sample point in a certain radius, sum the total occluded amount
+
+7. Attenuate the color according to this occluded amount.
+
+This process is handled in the ambient.frag, before the diffuse happens.
+
+Below are 2 comparison of the result of crytek-sponza's scene. The first one without SSAO, the second one with SSAO
+
+
+
+
+
+Below are something interesting: when I increase the scope of the SSAO, it turns out sth like a stone carve effect
+
+
-------------------------------------------------------------------------------
-THIRD PARTY CODE POLICY
+POINTLIGHT
-------------------------------------------------------------------------------
-* 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.
+
+The point light is straight forward. It can be better seen in the cornell_box_notglow.obj scene.
+
+You should turn off the scissors test to make sure that the point light is working correctly.
+
+result is as below
+
+
-------------------------------------------------------------------------------
-SELF-GRADING
+Setting Up the project
-------------------------------------------------------------------------------
-* 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.
+It took a while to figure out the problem with the project settings. To make this project work,
+1. Project settings->configuration properties->linker->input->add "..\release\SOIL.lib" in it.
----
-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.
+2. Project settings->debugging->add mesh="..\..\..\res\cornell\cube.obj"
+
+3. In the main.cpp file, for each directory of those shaders file, add ../../ before it so that it can approach the file correctly.
+
+-------------------------------------------------------------------------------
+PERFORMANCE EVALUATION
+-------------------------------------------------------------------------------
+With more sample in blurring and SSAO, it become slower....
---
ACKNOWLEDGEMENTS
diff --git a/README.md.bak b/README.md.bak
new file mode 100644
index 0000000..fa6414f
--- /dev/null
+++ b/README.md.bak
@@ -0,0 +1,156 @@
+-------------------------------------------------------------------------------
+CIS565: Project 6: Deferred Shader
+-------------------------------------------------------------------------------
+Fall 2013
+-------------------------------------------------------------------------------
+Due Friday 11/15/2013
+-------------------------------------------------------------------------------
+
+-------------------------------------------------------------------------------
+INTRODUCTION
+-------------------------------------------------------------------------------
+This project is about deferred shading using glsl. In this deferred shading, the first-path shader is just as a common shader: the input is the meshes. When calculating the output, it do not shade the things like
+ambient light, specular light or sth. Instead, it will output the normal, color, position and emission of the point that the pixel is shading on.
+
+And on the second-path is the true shader(so it is deferred), where use these information, to calculation the final fragment color of each pixel. It is somewhat similar to ray-tracing, but using rasterization to
+replace the ray intersection with the scene.
+
+In the project, as required, I implemented both Toon shading and Blooming effect(actually more likely to be a glowing effect).
+
+-------------------------------------------------------------------------------
+HOW TO USE
+-------------------------------------------------------------------------------
+
+To turn on and off toon shading, uncomment/comment the #define USETOONSHADE in the ambient.frag
+
+To turn on and off SSAO, uncomment/comment the #define USESSAO in the ambient.frag
+
+To turn on and off pointlight, uncomment/comment the #define USEPOINTLIGHT in the point.frag
+
+The bloom shader is default on. I thus fork the cornell_box into 2 versions: cornell_box_notglow.obj and cornell_box_glow.obj. Changing the input argument will work.
+
+By the way, I used "Ka" in the mtl file as the emission of a material. So if you want something shiny, just change it!
+
+
+-------------------------------------------------------------------------------
+TOON SHADING
+-------------------------------------------------------------------------------
+The toon shading happen in the shader, instead of post-shading processing. The toon shading is simple: So for each dot(light,normal), I do not use it directly. Instead, it will be clamped to the threshold above it.
+So in my program,
+0.00-0.05->0.00
+
+0.05-0.25->0.25
+
+0.25-0.50->0.50
+
+0.50-0.75->0.75
+
+0.75-1.00->1.00
+
+Another tricky part of the toon shading is the edge detection. If using post-shading process, it can be done easily with Sobel matrix(just multiply the Sobel operator with the pixel color.) Instead, I introduced my own
+ way to detect edge: compare the depth and the normal between itself and the G-Buffer around it. If an obvious difference is detected, than it will be shaded as the edge(color=0,0,0,1)
+
+ And below is the Toon shading result
+ 
+ 
+-------------------------------------------------------------------------------
+BLOOM SHADING
+-------------------------------------------------------------------------------
+The Bloom shading is not that successful, and more likely to be a glow shading.
+
+I implement the bloom shading in the post-shading process: in the post fragment shader. So to implement this, I add a slot in the G-Buffer: the emission of the objects. I notice that the Ka(ambient) of the material
+ is the light that the object's emitting. (If it is a light or glowing object, then it is greater than (0,0,0), otherwise for normal object it is (0,0,0)). So in the pass shader, I put this emission information into
+ another texture(G Buffer slot). And I retrieve this information in 2 places:
+
+ 1. In toon-shader, if a pixel is a light source, then it will take the edge test.
+
+ 2. In the post shader: I applied the Gaussian Blur function to make this effect. Gaussian Function is easy:
+
+ float sigma=...; //tweak this number will tweak the sharpness of the Gaussian Blur
+
+ g=exp(-(dx*dx+dy*dy)/2.0f/sigma/sigma)/(2/PI/sigma/sigma)
+
+ One of the problem with Gaussian function is that it have to sample a lot of pixels around it, if the blur radius is large. To settle this problem, I increase the step size of the sampling so that the blurring
+ effect can expand to further place, and the sample rate per pixel was 21*21, in my program.
+
+Below is the blooming effect. I set the walls and blocks to be the light sources
+
+
+-------------------------------------------------------------------------------
+SSAO
+-------------------------------------------------------------------------------
+
+The SSAO, Screen-Space-Ambient-Occlusion, is a kind of algorithm that can shade the ambient shadow. The standard way of doing SSAO is like below:
+
+1. Sample a point in hemisphere around the normal. The radius is flexible
+
+2. Cast this point into the eye-coordination
+
+3. Calculate the screen-position of this point
+
+4. Compare the Z-value with the Z-buffer on this pixel. If it is closer, thats fine. Otherwise it is occluded, record it.
+
+5. Loop the above steps(1-4) for several times(8-32), sum the total occluded amount.
+
+6. Attenuate the color according to this occluded amount.
+
+I hack it a little bit:
+
+1. Sample the pixels around the pixel I'm calculating
+
+2. Get the Z-depth and the position of that point
+
+3. If that Z-depth is further than my z-depth, no occlusion happen.
+
+4. If our distance is too far away, no occlusion happen
+
+5. Otherwise I'm occluded by this point, record it.
+
+6. Loop the above steps for each sample point in a certain radius, sum the total occluded amount
+
+7. Attenuate the color according to this occluded amount.
+
+This process is handled in the ambient.frag, before the diffuse happens.
+
+Below are 2 comparison of the result of crytek-sponza's scene. The first one without SSAO, the second one with SSAO
+
+
+
+
+
+Below are something interesting: when I increase the scope of the SSAO, it turns out sth like a stone carve effect
+
+
+
+-------------------------------------------------------------------------------
+POINTLIGHT
+-------------------------------------------------------------------------------
+
+The point light is straight forward. It can be better seen in the cornell_box_notglow.obj scene.
+
+You should turn off the scissors test to make sure that the point light is working correctly.
+
+result is as below
+
+
+
+-------------------------------------------------------------------------------
+Setting Up the project
+-------------------------------------------------------------------------------
+It took a while to figure out the problem with the project settings. To make this project work,
+
+1. Project settings->configuration properties->linker->input->add "..\release\SOIL.lib" in it.
+
+2. Project settings->debugging->add mesh="..\..\..\res\cornell\cube.obj"
+
+3. In the main.cpp file, for each directory of those shaders file, add ../../ before it so that it can approach the file correctly.
+
+-------------------------------------------------------------------------------
+PERFORMANCE EVALUATION
+-------------------------------------------------------------------------------
+With more sample in blurring and SSAO, it become slower....
+
+---
+ACKNOWLEDGEMENTS
+---
+This project makes use of [tinyobjloader](http://syoyo.github.io/tinyobjloader/) and [SOIL](http://lonesock.net/soil.html)
diff --git a/base/PROJ_WIN/P6/P6/P6.vcxproj b/base/PROJ_WIN/P6/P6/P6.vcxproj
index 2d1749c..97f7f8d 100644
--- a/base/PROJ_WIN/P6/P6/P6.vcxproj
+++ b/base/PROJ_WIN/P6/P6/P6.vcxproj
@@ -42,7 +42,7 @@
- Level3
+ TurnOffAllWarnings
Disabled
..\..\..\src\SOIL;..\..\..\src\tiny_obj_loader;..\..\..\..\shared32\freeglut\include;..\..\..\..\shared32\glew\include;..\..\..\..\shared32\glm;%(AdditionalIncludeDirectories)
WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -50,13 +50,13 @@
true
..\..\..\..\shared32\glew\lib;..\..\..\..\shared32\freeglut\lib;%(AdditionalLibraryDirectories)
- freeglut.lib;glew32.lib;%(AdditionalDependencies)
+ ..\debug\SOIL.lib;freeglut.lib;glew32.lib;%(AdditionalDependencies)
Console
- Level3
+ TurnOffAllWarnings
MaxSpeed
true
true
@@ -67,7 +67,7 @@
true
true
..\..\..\..\shared32\glew\lib;..\..\..\..\shared32\freeglut\lib;%(AdditionalLibraryDirectories)
- freeglut.lib;glew32.lib;%(AdditionalDependencies)
+ ..\release\SOIL.lib;freeglut.lib;glew32.lib;%(AdditionalDependencies)
Console
diff --git a/base/res/cornell/cornell_box.mtl b/base/res/cornell/cornell_box.mtl
index aae8474..1a4771f 100644
--- a/base/res/cornell/cornell_box.mtl
+++ b/base/res/cornell/cornell_box.mtl
@@ -1,6 +1,6 @@
newmtl white
-Ka 0 0 0
-Kd 0.9 0.9 0.9
+Ka 0.0 0.0 0.0
+Kd 1 1 1
Ks 0 0 0
newmtl red
@@ -18,7 +18,42 @@ Ka 0 0 0
Kd 0 0 1
Ks 0 0 0
+newmtl purple
+Ka 0 0 0
+Kd 0.519 0.161 0.84
+Ks 0 0 0
+
newmtl light
Ka 20 20 20
Kd 1 1 1
Ks 0 0 0
+
+newmtl lightyellow
+Ka 2.21 1.86 0.23
+Kd 1 1 1
+Ks 0 0 0
+
+newmtl lightblue
+Ka 0.92 1.07 1.49
+Kd 1 1 1
+Ks 0 0 0
+
+newmtl lightpurple
+Ka 0.84 0.26 1.36
+Kd 1 1 1
+Ks 0 0 0
+
+newmtl lightred
+Ka 1 0 0
+Kd 1 0 0
+Ks 0 0 0
+
+newmtl lightgreen
+Ka 0 1 0
+Kd 0 1 0
+Ks 0 0 0
+
+newmtl lightblue
+Ka 0 0 1
+Kd 0 0 1
+Ks 0 0 0
diff --git a/base/res/cornell/cornell_box.mtl.bak b/base/res/cornell/cornell_box.mtl.bak
new file mode 100644
index 0000000..63199c6
--- /dev/null
+++ b/base/res/cornell/cornell_box.mtl.bak
@@ -0,0 +1,59 @@
+newmtl white
+Ka 0.0 0.0 0.0
+Kd 0.9 0.9 0.9
+Ks 0 0 0
+
+newmtl red
+Ka 0 0 0
+Kd 1 0 0
+Ks 0 0 0
+
+newmtl green
+Ka 0 0 0
+Kd 0 1 0
+Ks 0 0 0
+
+newmtl blue
+Ka 0 0 0
+Kd 0 0 1
+Ks 0 0 0
+
+newmtl purple
+Ka 0 0 0
+Kd 0.519 0.161 0.84
+Ks 0 0 0
+
+newmtl light
+Ka 20 20 20
+Kd 1 1 1
+Ks 0 0 0
+
+newmtl lightyellow
+Ka 2.21 1.86 0.23
+Kd 1 1 1
+Ks 0 0 0
+
+newmtl lightblue
+Ka 0.92 1.07 1.49
+Kd 1 1 1
+Ks 0 0 0
+
+newmtl lightpurple
+Ka 0.84 0.26 1.36
+Kd 1 1 1
+Ks 0 0 0
+
+newmtl lightred
+Ka 1 0 0
+Kd 1 0 0
+Ks 0 0 0
+
+newmtl lightgreen
+Ka 0 1 0
+Kd 0 1 0
+Ks 0 0 0
+
+newmtl lightblue
+Ka 0 0 1
+Kd 0 0 1
+Ks 0 0 0
diff --git a/base/res/cornell/cornell_box.obj.bak b/base/res/cornell/cornell_box.obj.bak
new file mode 100644
index 0000000..8741ab9
--- /dev/null
+++ b/base/res/cornell/cornell_box.obj.bak
@@ -0,0 +1,145 @@
+# cornell_box.obj and cornell_box.mtl are grabbed from Intel's embree project.
+# original cornell box data
+ # comment
+
+# empty line including some space
+
+
+mtllib cornell_box.mtl
+
+o floor
+usemtl lightpurple
+v 552.8 0.0 0.0
+v 0.0 0.0 0.0
+v 0.0 0.0 559.2
+v 549.6 0.0 559.2
+
+v 130.0 0.0 65.0
+v 82.0 0.0 225.0
+v 240.0 0.0 272.0
+v 290.0 0.0 114.0
+
+v 423.0 0.0 247.0
+v 265.0 0.0 296.0
+v 314.0 0.0 456.0
+v 472.0 0.0 406.0
+
+f 1 2 3 4
+f 8 7 6 5
+f 12 11 10 9
+
+o light
+usemtl light
+v 343.0 548.0 227.0
+v 343.0 548.0 332.0
+v 213.0 548.0 332.0
+v 213.0 548.0 227.0
+f -4 -3 -2 -1
+
+o ceiling
+usemtl white
+v 556.0 548.8 0.0
+v 556.0 548.8 559.2
+v 0.0 548.8 559.2
+v 0.0 548.8 0.0
+f -4 -3 -2 -1
+
+o back_wall
+usemtl white
+v 549.6 0.0 559.2
+v 0.0 0.0 559.2
+v 0.0 548.8 559.2
+v 556.0 548.8 559.2
+f -4 -3 -2 -1
+
+o front_wall
+usemtl blue
+v 549.6 0.0 0
+v 0.0 0.0 0
+v 0.0 548.8 0
+v 556.0 548.8 0
+#f -1 -2 -3 -4
+
+o green_wall
+usemtl lightgreen
+v 0.0 0.0 559.2
+v 0.0 0.0 0.0
+v 0.0 548.8 0.0
+v 0.0 548.8 559.2
+f -4 -3 -2 -1
+
+o red_wall
+usemtl lightred
+v 552.8 0.0 0.0
+v 549.6 0.0 559.2
+v 556.0 548.8 559.2
+v 556.0 548.8 0.0
+f -4 -3 -2 -1
+
+o short_block
+usemtl lightyellow
+
+v 130.0 165.0 65.0
+v 82.0 165.0 225.0
+v 240.0 165.0 272.0
+v 290.0 165.0 114.0
+f -4 -3 -2 -1
+
+v 290.0 0.0 114.0
+v 290.0 165.0 114.0
+v 240.0 165.0 272.0
+v 240.0 0.0 272.0
+f -4 -3 -2 -1
+
+v 130.0 0.0 65.0
+v 130.0 165.0 65.0
+v 290.0 165.0 114.0
+v 290.0 0.0 114.0
+f -4 -3 -2 -1
+
+v 82.0 0.0 225.0
+v 82.0 165.0 225.0
+v 130.0 165.0 65.0
+v 130.0 0.0 65.0
+f -4 -3 -2 -1
+
+v 240.0 0.0 272.0
+v 240.0 165.0 272.0
+v 82.0 165.0 225.0
+v 82.0 0.0 225.0
+f -4 -3 -2 -1
+
+o tall_block
+usemtl lightblue
+
+v 423.0 330.0 247.0
+v 265.0 330.0 296.0
+v 314.0 330.0 456.0
+v 472.0 330.0 406.0
+f -4 -3 -2 -1
+
+usemtl lightblue
+v 423.0 0.0 247.0
+v 423.0 330.0 247.0
+v 472.0 330.0 406.0
+v 472.0 0.0 406.0
+f -4 -3 -2 -1
+
+v 472.0 0.0 406.0
+v 472.0 330.0 406.0
+v 314.0 330.0 456.0
+v 314.0 0.0 456.0
+f -4 -3 -2 -1
+
+v 314.0 0.0 456.0
+v 314.0 330.0 456.0
+v 265.0 330.0 296.0
+v 265.0 0.0 296.0
+f -4 -3 -2 -1
+
+v 265.0 0.0 296.0
+v 265.0 330.0 296.0
+v 423.0 330.0 247.0
+v 423.0 0.0 247.0
+f -4 -3 -2 -1
+
diff --git a/base/res/cornell/cornell_box_glow.obj b/base/res/cornell/cornell_box_glow.obj
new file mode 100644
index 0000000..fa7267f
--- /dev/null
+++ b/base/res/cornell/cornell_box_glow.obj
@@ -0,0 +1,145 @@
+# cornell_box.obj and cornell_box.mtl are grabbed from Intel's embree project.
+# original cornell box data
+ # comment
+
+# empty line including some space
+
+
+mtllib cornell_box.mtl
+
+o floor
+usemtl purple
+v 552.8 0.0 0.0
+v 0.0 0.0 0.0
+v 0.0 0.0 559.2
+v 549.6 0.0 559.2
+
+v 130.0 0.0 65.0
+v 82.0 0.0 225.0
+v 240.0 0.0 272.0
+v 290.0 0.0 114.0
+
+v 423.0 0.0 247.0
+v 265.0 0.0 296.0
+v 314.0 0.0 456.0
+v 472.0 0.0 406.0
+
+f 1 2 3 4
+f 8 7 6 5
+f 12 11 10 9
+
+o light
+usemtl light
+v 343.0 548.0 227.0
+v 343.0 548.0 332.0
+v 213.0 548.0 332.0
+v 213.0 548.0 227.0
+f -4 -3 -2 -1
+
+o ceiling
+usemtl blue
+v 556.0 548.8 0.0
+v 556.0 548.8 559.2
+v 0.0 548.8 559.2
+v 0.0 548.8 0.0
+f -4 -3 -2 -1
+
+o back_wall
+usemtl white
+v 549.6 0.0 559.2
+v 0.0 0.0 559.2
+v 0.0 548.8 559.2
+v 556.0 548.8 559.2
+f -4 -3 -2 -1
+
+o front_wall
+usemtl blue
+v 549.6 0.0 0
+v 0.0 0.0 0
+v 0.0 548.8 0
+v 556.0 548.8 0
+#f -1 -2 -3 -4
+
+o green_wall
+usemtl lightgreen
+v 0.0 0.0 559.2
+v 0.0 0.0 0.0
+v 0.0 548.8 0.0
+v 0.0 548.8 559.2
+f -4 -3 -2 -1
+
+o red_wall
+usemtl lightred
+v 552.8 0.0 0.0
+v 549.6 0.0 559.2
+v 556.0 548.8 559.2
+v 556.0 548.8 0.0
+f -4 -3 -2 -1
+
+o short_block
+usemtl lightyellow
+
+v 130.0 165.0 65.0
+v 82.0 165.0 225.0
+v 240.0 165.0 272.0
+v 290.0 165.0 114.0
+f -4 -3 -2 -1
+
+v 290.0 0.0 114.0
+v 290.0 165.0 114.0
+v 240.0 165.0 272.0
+v 240.0 0.0 272.0
+f -4 -3 -2 -1
+
+v 130.0 0.0 65.0
+v 130.0 165.0 65.0
+v 290.0 165.0 114.0
+v 290.0 0.0 114.0
+f -4 -3 -2 -1
+
+v 82.0 0.0 225.0
+v 82.0 165.0 225.0
+v 130.0 165.0 65.0
+v 130.0 0.0 65.0
+f -4 -3 -2 -1
+
+v 240.0 0.0 272.0
+v 240.0 165.0 272.0
+v 82.0 165.0 225.0
+v 82.0 0.0 225.0
+f -4 -3 -2 -1
+
+o tall_block
+usemtl lightblue
+
+v 423.0 330.0 247.0
+v 265.0 330.0 296.0
+v 314.0 330.0 456.0
+v 472.0 330.0 406.0
+f -4 -3 -2 -1
+
+usemtl lightblue
+v 423.0 0.0 247.0
+v 423.0 330.0 247.0
+v 472.0 330.0 406.0
+v 472.0 0.0 406.0
+f -4 -3 -2 -1
+
+v 472.0 0.0 406.0
+v 472.0 330.0 406.0
+v 314.0 330.0 456.0
+v 314.0 0.0 456.0
+f -4 -3 -2 -1
+
+v 314.0 0.0 456.0
+v 314.0 330.0 456.0
+v 265.0 330.0 296.0
+v 265.0 0.0 296.0
+f -4 -3 -2 -1
+
+v 265.0 0.0 296.0
+v 265.0 330.0 296.0
+v 423.0 330.0 247.0
+v 423.0 0.0 247.0
+f -4 -3 -2 -1
+
diff --git a/base/res/cornell/cornell_box_glow.obj.bak b/base/res/cornell/cornell_box_glow.obj.bak
new file mode 100644
index 0000000..1bad908
--- /dev/null
+++ b/base/res/cornell/cornell_box_glow.obj.bak
@@ -0,0 +1,145 @@
+# cornell_box.obj and cornell_box.mtl are grabbed from Intel's embree project.
+# original cornell box data
+ # comment
+
+# empty line including some space
+
+
+mtllib cornell_box.mtl
+
+o floor
+usemtl lightpurple
+v 552.8 0.0 0.0
+v 0.0 0.0 0.0
+v 0.0 0.0 559.2
+v 549.6 0.0 559.2
+
+v 130.0 0.0 65.0
+v 82.0 0.0 225.0
+v 240.0 0.0 272.0
+v 290.0 0.0 114.0
+
+v 423.0 0.0 247.0
+v 265.0 0.0 296.0
+v 314.0 0.0 456.0
+v 472.0 0.0 406.0
+
+f 1 2 3 4
+f 8 7 6 5
+f 12 11 10 9
+
+o light
+usemtl light
+v 343.0 548.0 227.0
+v 343.0 548.0 332.0
+v 213.0 548.0 332.0
+v 213.0 548.0 227.0
+f -4 -3 -2 -1
+
+o ceiling
+usemtl blue
+v 556.0 548.8 0.0
+v 556.0 548.8 559.2
+v 0.0 548.8 559.2
+v 0.0 548.8 0.0
+f -4 -3 -2 -1
+
+o back_wall
+usemtl white
+v 549.6 0.0 559.2
+v 0.0 0.0 559.2
+v 0.0 548.8 559.2
+v 556.0 548.8 559.2
+f -4 -3 -2 -1
+
+o front_wall
+usemtl blue
+v 549.6 0.0 0
+v 0.0 0.0 0
+v 0.0 548.8 0
+v 556.0 548.8 0
+#f -1 -2 -3 -4
+
+o green_wall
+usemtl lightgreen
+v 0.0 0.0 559.2
+v 0.0 0.0 0.0
+v 0.0 548.8 0.0
+v 0.0 548.8 559.2
+f -4 -3 -2 -1
+
+o red_wall
+usemtl lightred
+v 552.8 0.0 0.0
+v 549.6 0.0 559.2
+v 556.0 548.8 559.2
+v 556.0 548.8 0.0
+f -4 -3 -2 -1
+
+o short_block
+usemtl lightyellow
+
+v 130.0 165.0 65.0
+v 82.0 165.0 225.0
+v 240.0 165.0 272.0
+v 290.0 165.0 114.0
+f -4 -3 -2 -1
+
+v 290.0 0.0 114.0
+v 290.0 165.0 114.0
+v 240.0 165.0 272.0
+v 240.0 0.0 272.0
+f -4 -3 -2 -1
+
+v 130.0 0.0 65.0
+v 130.0 165.0 65.0
+v 290.0 165.0 114.0
+v 290.0 0.0 114.0
+f -4 -3 -2 -1
+
+v 82.0 0.0 225.0
+v 82.0 165.0 225.0
+v 130.0 165.0 65.0
+v 130.0 0.0 65.0
+f -4 -3 -2 -1
+
+v 240.0 0.0 272.0
+v 240.0 165.0 272.0
+v 82.0 165.0 225.0
+v 82.0 0.0 225.0
+f -4 -3 -2 -1
+
+o tall_block
+usemtl lightblue
+
+v 423.0 330.0 247.0
+v 265.0 330.0 296.0
+v 314.0 330.0 456.0
+v 472.0 330.0 406.0
+f -4 -3 -2 -1
+
+usemtl lightblue
+v 423.0 0.0 247.0
+v 423.0 330.0 247.0
+v 472.0 330.0 406.0
+v 472.0 0.0 406.0
+f -4 -3 -2 -1
+
+v 472.0 0.0 406.0
+v 472.0 330.0 406.0
+v 314.0 330.0 456.0
+v 314.0 0.0 456.0
+f -4 -3 -2 -1
+
+v 314.0 0.0 456.0
+v 314.0 330.0 456.0
+v 265.0 330.0 296.0
+v 265.0 0.0 296.0
+f -4 -3 -2 -1
+
+v 265.0 0.0 296.0
+v 265.0 330.0 296.0
+v 423.0 330.0 247.0
+v 423.0 0.0 247.0
+f -4 -3 -2 -1
+
diff --git a/base/res/cornell/cornell_box.obj b/base/res/cornell/cornell_box_notglow.obj
similarity index 99%
rename from base/res/cornell/cornell_box.obj
rename to base/res/cornell/cornell_box_notglow.obj
index 43e021f..466585b 100644
--- a/base/res/cornell/cornell_box.obj
+++ b/base/res/cornell/cornell_box_notglow.obj
@@ -29,7 +29,7 @@ f 8 7 6 5
f 12 11 10 9
o light
-usemtl light
+usemtl white
v 343.0 548.0 227.0
v 343.0 548.0 332.0
v 213.0 548.0 332.0
@@ -118,7 +118,7 @@ v 314.0 330.0 456.0
v 472.0 330.0 406.0
f -4 -3 -2 -1
-usemtl white
+usemtl blue
v 423.0 0.0 247.0
v 423.0 330.0 247.0
v 472.0 330.0 406.0
diff --git a/base/res/cornell/cornell_box_notglow.obj.bak b/base/res/cornell/cornell_box_notglow.obj.bak
new file mode 100644
index 0000000..c39f10b
--- /dev/null
+++ b/base/res/cornell/cornell_box_notglow.obj.bak
@@ -0,0 +1,145 @@
+# cornell_box.obj and cornell_box.mtl are grabbed from Intel's embree project.
+# original cornell box data
+ # comment
+
+# empty line including some space
+
+
+mtllib cornell_box.mtl
+
+o floor
+usemtl white
+v 552.8 0.0 0.0
+v 0.0 0.0 0.0
+v 0.0 0.0 559.2
+v 549.6 0.0 559.2
+
+v 130.0 0.0 65.0
+v 82.0 0.0 225.0
+v 240.0 0.0 272.0
+v 290.0 0.0 114.0
+
+v 423.0 0.0 247.0
+v 265.0 0.0 296.0
+v 314.0 0.0 456.0
+v 472.0 0.0 406.0
+
+f 1 2 3 4
+f 8 7 6 5
+f 12 11 10 9
+
+o light
+usemtl light
+v 343.0 548.0 227.0
+v 343.0 548.0 332.0
+v 213.0 548.0 332.0
+v 213.0 548.0 227.0
+f -4 -3 -2 -1
+
+o ceiling
+usemtl white
+v 556.0 548.8 0.0
+v 556.0 548.8 559.2
+v 0.0 548.8 559.2
+v 0.0 548.8 0.0
+f -4 -3 -2 -1
+
+o back_wall
+usemtl white
+v 549.6 0.0 559.2
+v 0.0 0.0 559.2
+v 0.0 548.8 559.2
+v 556.0 548.8 559.2
+f -4 -3 -2 -1
+
+o front_wall
+usemtl blue
+v 549.6 0.0 0
+v 0.0 0.0 0
+v 0.0 548.8 0
+v 556.0 548.8 0
+#f -1 -2 -3 -4
+
+o green_wall
+usemtl green
+v 0.0 0.0 559.2
+v 0.0 0.0 0.0
+v 0.0 548.8 0.0
+v 0.0 548.8 559.2
+f -4 -3 -2 -1
+
+o red_wall
+usemtl red
+v 552.8 0.0 0.0
+v 549.6 0.0 559.2
+v 556.0 548.8 559.2
+v 556.0 548.8 0.0
+f -4 -3 -2 -1
+
+o short_block
+usemtl white
+
+v 130.0 165.0 65.0
+v 82.0 165.0 225.0
+v 240.0 165.0 272.0
+v 290.0 165.0 114.0
+f -4 -3 -2 -1
+
+v 290.0 0.0 114.0
+v 290.0 165.0 114.0
+v 240.0 165.0 272.0
+v 240.0 0.0 272.0
+f -4 -3 -2 -1
+
+v 130.0 0.0 65.0
+v 130.0 165.0 65.0
+v 290.0 165.0 114.0
+v 290.0 0.0 114.0
+f -4 -3 -2 -1
+
+v 82.0 0.0 225.0
+v 82.0 165.0 225.0
+v 130.0 165.0 65.0
+v 130.0 0.0 65.0
+f -4 -3 -2 -1
+
+v 240.0 0.0 272.0
+v 240.0 165.0 272.0
+v 82.0 165.0 225.0
+v 82.0 0.0 225.0
+f -4 -3 -2 -1
+
+o tall_block
+usemtl white
+
+v 423.0 330.0 247.0
+v 265.0 330.0 296.0
+v 314.0 330.0 456.0
+v 472.0 330.0 406.0
+f -4 -3 -2 -1
+
+usemtl blue
+v 423.0 0.0 247.0
+v 423.0 330.0 247.0
+v 472.0 330.0 406.0
+v 472.0 0.0 406.0
+f -4 -3 -2 -1
+
+v 472.0 0.0 406.0
+v 472.0 330.0 406.0
+v 314.0 330.0 456.0
+v 314.0 0.0 456.0
+f -4 -3 -2 -1
+
+v 314.0 0.0 456.0
+v 314.0 330.0 456.0
+v 265.0 330.0 296.0
+v 265.0 0.0 296.0
+f -4 -3 -2 -1
+
+v 265.0 0.0 296.0
+v 265.0 330.0 296.0
+v 423.0 330.0 247.0
+v 423.0 0.0 247.0
+f -4 -3 -2 -1
+
diff --git a/base/res/crytek-sponza/sponza.mtl b/base/res/crytek-sponza/sponza.mtl
index 168ec79..919086f 100644
--- a/base/res/crytek-sponza/sponza.mtl
+++ b/base/res/crytek-sponza/sponza.mtl
@@ -8,15 +8,15 @@ newmtl leaf
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
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_bump textures\sponza_thorn_bump.png
- bump textures\sponza_thorn_bump.png
+ map_Ka .\textures\sponza_thorn_diff.tga
+ map_Kd .\textures\sponza_thorn_diff.tga
+ map_d .\textures\sponza_thorn_mask.tga
+ map_bump .\textures\sponza_thorn_bump.png
+ bump .\textures\sponza_thorn_bump.png
newmtl vase_round
Ns 10.0000
@@ -25,14 +25,14 @@ newmtl vase_round
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\vase_round.tga
- map_Kd textures\vase_round.tga
- map_bump textures\vase_round_bump.png
- bump textures\vase_round_bump.png
+ map_Ka .\textures\vase_round.tga
+ map_Kd .\textures\vase_round.tga
+ map_bump .\textures\vase_round_bump.png
+ bump .\textures\vase_round_bump.png
newmtl Material__57
Ns 10.0000
@@ -41,13 +41,13 @@ newmtl Material__57
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
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_Ka .\textures\vase_plant.tga
+ map_Kd .\textures\vase_plant.tga
+ map_d .\textures\vase_plant_mask.tga
newmtl Material__298
Ns 10.0000
@@ -56,14 +56,14 @@ newmtl Material__298
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\background.tga
- map_Kd textures\background.tga
- map_bump textures\background_bump.png
- bump textures\background_bump.png
+ map_Ka .\textures\background.tga
+ map_Kd .\textures\background.tga
+ map_bump .\textures\background_bump.png
+ bump .\textures\background_bump.png
newmtl 16___Default
Ns 10.0000
@@ -72,12 +72,12 @@ newmtl 16___Default
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\gi_flag.tga
- map_Kd textures\gi_flag.tga
+ map_Ka .\textures\gi_flag.tga
+ map_Kd .\textures\gi_flag.tga
newmtl bricks
Ns 10.0000
@@ -86,14 +86,14 @@ newmtl bricks
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
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
- bump textures\spnza_bricks_a_bump.png
+ map_Ka .\textures\spnza_bricks_a_diff.tga
+ map_Kd .\textures\spnza_bricks_a_diff.tga
+ map_bump .\textures\spnza_bricks_a_diff.tga
+ bump .\textures\spnza_bricks_a_bump.png
newmtl arch
Ns 10.0000
@@ -102,12 +102,12 @@ newmtl arch
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_arch_diff.tga
- map_Kd textures\sponza_arch_diff.tga
+ map_Ka .\textures\sponza_arch_diff.tga
+ map_Kd .\textures\sponza_arch_diff.tga
newmtl ceiling
Ns 10.0000
@@ -116,12 +116,12 @@ newmtl ceiling
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_ceiling_a_diff.tga
- map_Kd textures\sponza_ceiling_a_diff.tga
+ map_Ka .\textures\sponza_ceiling_a_diff.tga
+ map_Kd .\textures\sponza_ceiling_a_diff.tga
newmtl column_a
Ns 10.0000
@@ -130,14 +130,14 @@ newmtl column_a
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_column_a_diff.tga
- map_Kd textures\sponza_column_a_diff.tga
- map_bump textures\sponza_column_a_bump.png
- bump textures\sponza_column_a_bump.png
+ map_Ka .\textures\sponza_column_a_diff.tga
+ map_Kd .\textures\sponza_column_a_diff.tga
+ map_bump .\textures\sponza_column_a_bump.png
+ bump .\textures\sponza_column_a_bump.png
newmtl floor
Ns 10.0000
@@ -146,12 +146,12 @@ newmtl floor
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_floor_a_diff.tga
- map_Kd textures\sponza_floor_a_diff.tga
+ map_Ka .\textures\sponza_floor_a_diff.tga
+ map_Kd .\textures\sponza_floor_a_diff.tga
newmtl column_c
Ns 10.0000
@@ -160,14 +160,14 @@ newmtl column_c
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_column_c_diff.tga
- map_Kd textures\sponza_column_c_diff.tga
- map_bump textures\sponza_column_c_bump.png
- bump textures\sponza_column_c_bump.png
+ map_Ka .\textures\sponza_column_c_diff.tga
+ map_Kd .\textures\sponza_column_c_diff.tga
+ map_bump .\textures\sponza_column_c_bump.png
+ bump .\textures\sponza_column_c_bump.png
newmtl details
Ns 10.0000
@@ -176,12 +176,12 @@ newmtl details
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_details_diff.tga
- map_Kd textures\sponza_details_diff.tga
+ map_Ka .\textures\sponza_details_diff.tga
+ map_Kd .\textures\sponza_details_diff.tga
newmtl column_b
Ns 10.0000
@@ -190,14 +190,14 @@ newmtl column_b
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_column_b_diff.tga
- map_Kd textures\sponza_column_b_diff.tga
- map_bump textures\sponza_column_b_bump.png
- bump textures\sponza_column_b_bump.png
+ map_Ka .\textures\sponza_column_b_diff.tga
+ map_Kd .\textures\sponza_column_b_diff.tga
+ map_bump .\textures\sponza_column_b_bump.png
+ bump .\textures\sponza_column_b_bump.png
newmtl Material__47
Ns 10.0000
@@ -206,7 +206,7 @@ newmtl Material__47
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
@@ -218,12 +218,12 @@ newmtl flagpole
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_flagpole_diff.tga
- map_Kd textures\sponza_flagpole_diff.tga
+ map_Ka .\textures\sponza_flagpole_diff.tga
+ map_Kd .\textures\sponza_flagpole_diff.tga
newmtl fabric_e
Ns 10.0000
@@ -232,12 +232,12 @@ newmtl fabric_e
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_fabric_green_diff.tga
- map_Kd textures\sponza_fabric_green_diff.tga
+ map_Ka .\textures\sponza_fabric_green_diff.tga
+ map_Kd .\textures\sponza_fabric_green_diff.tga
newmtl fabric_d
Ns 10.0000
@@ -246,12 +246,12 @@ newmtl fabric_d
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_fabric_blue_diff.tga
- map_Kd textures\sponza_fabric_blue_diff.tga
+ map_Ka .\textures\sponza_fabric_blue_diff.tga
+ map_Kd .\textures\sponza_fabric_blue_diff.tga
newmtl fabric_a
Ns 10.0000
@@ -260,12 +260,12 @@ newmtl fabric_a
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_fabric_diff.tga
- map_Kd textures\sponza_fabric_diff.tga
+ map_Ka .\textures\sponza_fabric_diff.tga
+ map_Kd .\textures\sponza_fabric_diff.tga
newmtl fabric_g
Ns 10.0000
@@ -274,12 +274,12 @@ newmtl fabric_g
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_curtain_blue_diff.tga
- map_Kd textures\sponza_curtain_blue_diff.tga
+ map_Ka .\textures\sponza_curtain_blue_diff.tga
+ map_Kd .\textures\sponza_curtain_blue_diff.tga
newmtl fabric_c
Ns 10.0000
@@ -288,12 +288,12 @@ newmtl fabric_c
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_curtain_diff.tga
- map_Kd textures\sponza_curtain_diff.tga
+ map_Ka .\textures\sponza_curtain_diff.tga
+ map_Kd .\textures\sponza_curtain_diff.tga
newmtl fabric_f
Ns 10.0000
@@ -302,12 +302,12 @@ newmtl fabric_f
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_curtain_green_diff.tga
- map_Kd textures\sponza_curtain_green_diff.tga
+ map_Ka .\textures\sponza_curtain_green_diff.tga
+ map_Kd .\textures\sponza_curtain_green_diff.tga
newmtl chain
Ns 10.0000
@@ -316,15 +316,15 @@ newmtl chain
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
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_bump textures\chain_texture_bump.png
- bump textures\chain_texture_bump.png
+ map_Ka .\textures\chain_texture.tga
+ map_Kd .\textures\chain_texture.tga
+ map_d .\textures\chain_texture_mask.tga
+ map_bump .\textures\chain_texture_bump.png
+ bump .\textures\chain_texture_bump.png
newmtl vase_hanging
Ns 10.0000
@@ -333,12 +333,12 @@ newmtl vase_hanging
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\vase_hanging.tga
- map_Kd textures\vase_hanging.tga
+ map_Ka .\textures\vase_hanging.tga
+ map_Kd .\textures\vase_hanging.tga
newmtl vase
Ns 10.0000
@@ -347,14 +347,14 @@ newmtl vase
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\vase_dif.tga
- map_Kd textures\vase_dif.tga
- map_bump textures\vase_bump.png
- bump textures\vase_bump.png
+ map_Ka .\textures\vase_dif.tga
+ map_Kd .\textures\vase_dif.tga
+ map_bump .\textures\vase_bump.png
+ bump .\textures\vase_bump.png
newmtl Material__25
Ns 10.0000
@@ -363,14 +363,14 @@ newmtl Material__25
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 0 0 0
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\lion.tga
- map_Kd textures\lion.tga
- map_bump textures\lion_bump.png
- bump textures\lion_bump.png
+ map_Ka .\textures\lion.tga
+ map_Kd .\textures\lion.tga
+ map_bump .\textures\lion_bump.png
+ bump .\textures\lion_bump.png
newmtl roof
Ns 10.0000
@@ -379,9 +379,9 @@ newmtl roof
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
- Ka 0.5880 0.5880 0.5880
+ Ka 2 2 2
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
- map_Ka textures\sponza_roof_diff.tga
- map_Kd textures\sponza_roof_diff.tga
+ map_Ka .\textures\sponza_roof_diff.tga
+ map_Kd .\textures\sponza_roof_diff.tga
diff --git a/base/res/crytek-sponza/sponza.mtl.bak b/base/res/crytek-sponza/sponza.mtl.bak
new file mode 100644
index 0000000..48bf46b
--- /dev/null
+++ b/base/res/crytek-sponza/sponza.mtl.bak
@@ -0,0 +1,387 @@
+# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
+# File Created: 20.08.2010 18:13:43
+
+newmtl leaf
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ 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_bump .\textures\sponza_thorn_bump.png
+ bump .\textures\sponza_thorn_bump.png
+
+newmtl vase_round
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\vase_round.tga
+ map_Kd .\textures\vase_round.tga
+ map_bump .\textures\vase_round_bump.png
+ bump .\textures\vase_round_bump.png
+
+newmtl Material__57
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ 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
+
+newmtl Material__298
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\background.tga
+ map_Kd .\textures\background.tga
+ map_bump .\textures\background_bump.png
+ bump .\textures\background_bump.png
+
+newmtl 16___Default
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\gi_flag.tga
+ map_Kd .\textures\gi_flag.tga
+
+newmtl bricks
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ 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
+ bump .\textures\spnza_bricks_a_bump.png
+
+newmtl arch
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_arch_diff.tga
+ map_Kd .\textures\sponza_arch_diff.tga
+
+newmtl ceiling
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_ceiling_a_diff.tga
+ map_Kd .\textures\sponza_ceiling_a_diff.tga
+
+newmtl column_a
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_column_a_diff.tga
+ map_Kd .\textures\sponza_column_a_diff.tga
+ map_bump .\textures\sponza_column_a_bump.png
+ bump .\textures\sponza_column_a_bump.png
+
+newmtl floor
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_floor_a_diff.tga
+ map_Kd .\textures\sponza_floor_a_diff.tga
+
+newmtl column_c
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_column_c_diff.tga
+ map_Kd .\textures\sponza_column_c_diff.tga
+ map_bump .\textures\sponza_column_c_bump.png
+ bump .\textures\sponza_column_c_bump.png
+
+newmtl details
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_details_diff.tga
+ map_Kd .\textures\sponza_details_diff.tga
+
+newmtl column_b
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_column_b_diff.tga
+ map_Kd .\textures\sponza_column_b_diff.tga
+ map_bump .\textures\sponza_column_b_bump.png
+ bump .\textures\sponza_column_b_bump.png
+
+newmtl Material__47
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+
+newmtl flagpole
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_flagpole_diff.tga
+ map_Kd .\textures\sponza_flagpole_diff.tga
+
+newmtl fabric_e
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_fabric_green_diff.tga
+ map_Kd .\textures\sponza_fabric_green_diff.tga
+
+newmtl fabric_d
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_fabric_blue_diff.tga
+ map_Kd .\textures\sponza_fabric_blue_diff.tga
+
+newmtl fabric_a
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_fabric_diff.tga
+ map_Kd .\textures\sponza_fabric_diff.tga
+
+newmtl fabric_g
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_curtain_blue_diff.tga
+ map_Kd .\textures\sponza_curtain_blue_diff.tga
+
+newmtl fabric_c
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_curtain_diff.tga
+ map_Kd .\textures\sponza_curtain_diff.tga
+
+newmtl fabric_f
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_curtain_green_diff.tga
+ map_Kd .\textures\sponza_curtain_green_diff.tga
+
+newmtl chain
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ 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_bump .\textures\chain_texture_bump.png
+ bump .\textures\chain_texture_bump.png
+
+newmtl vase_hanging
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\vase_hanging.tga
+ map_Kd .\textures\vase_hanging.tga
+
+newmtl vase
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\vase_dif.tga
+ map_Kd .\textures\vase_dif.tga
+ map_bump .\textures\vase_bump.png
+ bump .\textures\vase_bump.png
+
+newmtl Material__25
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0 0 0
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\lion.tga
+ map_Kd .\textures\lion.tga
+ map_bump .\textures\lion_bump.png
+ bump .\textures\lion_bump.png
+
+newmtl roof
+ Ns 10.0000
+ Ni 1.5000
+ d 1.0000
+ Tr 0.0000
+ Tf 1.0000 1.0000 1.0000
+ illum 2
+ Ka 0.5880 0.5880 0.5880
+ Kd 0.5880 0.5880 0.5880
+ Ks 0.0000 0.0000 0.0000
+ Ke 0.0000 0.0000 0.0000
+ map_Ka .\textures\sponza_roof_diff.tga
+ map_Kd .\textures\sponza_roof_diff.tga
diff --git a/base/res/shaders/ambient.frag b/base/res/shaders/ambient.frag
index 69b878c..8c7a4a1 100644
--- a/base/res/shaders/ambient.frag
+++ b/base/res/shaders/ambient.frag
@@ -11,6 +11,8 @@
#define DISPLAY_TOTAL 4
#define DISPLAY_LIGHTS 5
+//#define USETOONSHADE
+#define USESSAO
/////////////////////////////////////
// Uniforms, Attributes, and Outputs
@@ -21,6 +23,7 @@ uniform sampler2D u_Depthtex;
uniform sampler2D u_Normaltex;
uniform sampler2D u_Positiontex;
uniform sampler2D u_Colortex;
+uniform sampler2D u_Lightmaptex;
uniform sampler2D u_RandomNormaltex;
uniform sampler2D u_RandomScalartex;
@@ -38,6 +41,7 @@ uniform float u_LightIl;
in vec2 fs_Texcoord;
out vec4 out_Color;
+out vec4 out_postlight;
///////////////////////////////////////
@@ -93,14 +97,75 @@ float getRandomScalar(vec2 texcoords) {
// MAIN
//////////////////////////////////
const float occlusion_strength = 1.5f;
+
+vec3 colorProduct(vec3 c1, vec3 c2)
+{
+ return vec3(c1.x*c2.x,c1.y*c2.y,c1.z*c2.z);
+}
+
+
+vec3 getSSAO(sampler2D zTex, sampler2D positionTex, vec2 v_texCoord, int u_ScreenWidth, int u_ScreenHeight)
+{
+
+ float dx=1.0f/float(u_ScreenWidth);
+ float dy=1.0f/float(u_ScreenHeight);
+ vec2 tmpTexcord=v_texCoord;
+ vec3 totalcolor=vec3(1,1,1);
+
+
+ float sampleradius=3.0f;
+ float sampledelta=1.0f;
+
+ float myDepth=texture(zTex,v_texCoord);
+ vec3 myPosition=texture(positionTex,v_texCoord).xyz;
+ vec3 tmpPosition;
+
+ for(float i=-sampleradius;i<=sampleradius+0.1f;i+=sampledelta) for(float j=-sampleradius;j<=sampleradius+0.1f;j+=sampledelta)
+ {
+ if(i*i+j*j>sampleradius*sampleradius)continue;
+ tmpTexcord=v_texCoord+vec2(i*dx,j*dy);
+
+
+ float tmpDepth=texture(zTex,tmpTexcord);
+ tmpPosition=texture(positionTex,tmpTexcord).xyz;
+
+ float thedist=tmpDepth-myDepth;
+
+ if(thedist>0) continue;
+ //if(length(tmpPosition-myPosition)>0.01f) continue;
+ float weight=0.020;
+
+ totalcolor-=vec3(1.0f)*weight;
+ }
+ return totalcolor;
+}
+
void main() {
float exp_depth = texture(u_Depthtex, fs_Texcoord).r;
float lin_depth = linearizeDepth(exp_depth,u_Near,u_Far);
-
vec3 normal = sampleNrm(fs_Texcoord);
vec3 position = samplePos(fs_Texcoord);
vec3 color = sampleCol(fs_Texcoord);
+
+ #ifdef USESSAO
+ color=colorProduct(color,getSSAO(u_Depthtex,u_Positiontex,fs_Texcoord,u_ScreenWidth, u_ScreenHeight));
+ #endif
+
+ vec3 lightcolor=texture(u_Lightmaptex,fs_Texcoord).xyz;
+
+ vec2 tempTex;
+ tempTex=fs_Texcoord+vec2(1.0f/float(u_ScreenWidth),0.0f); float depth1=texture(u_Depthtex,tempTex).r; float angle1=dot(sampleNrm(tempTex),normal); vec3 lightcolor1=texture(u_Lightmaptex,tempTex).xyz;
+ tempTex=fs_Texcoord-vec2(1.0f/float(u_ScreenWidth),0.0f); float depth2=texture(u_Depthtex,tempTex).r; float angle2=dot(sampleNrm(tempTex),normal); vec3 lightcolor2=texture(u_Lightmaptex,tempTex).xyz;
+ tempTex=fs_Texcoord+vec2(0.0f,1.0f/float(u_ScreenHeight)); float depth3=texture(u_Depthtex,tempTex).r; float angle3=dot(sampleNrm(tempTex),normal);vec3 lightcolor3=texture(u_Lightmaptex,tempTex).xyz;
+ tempTex=fs_Texcoord-vec2(0.0f,1.0f/float(u_ScreenHeight)); float depth4=texture(u_Depthtex,tempTex).r; float angle4=dot(sampleNrm(tempTex),normal);vec3 lightcolor4=texture(u_Lightmaptex,tempTex).xyz;
+
+ depth1=linearizeDepth(depth1,u_Near,u_Far);
+ depth2=linearizeDepth(depth2,u_Near,u_Far);
+ depth3=linearizeDepth(depth3,u_Near,u_Far);
+ depth4=linearizeDepth(depth4,u_Near,u_Far);
+
+
vec3 light = u_Light.xyz;
float strength = u_Light.w;
if (lin_depth > 0.99f) {
@@ -108,7 +173,29 @@ void main() {
} else {
float ambient = u_LightIl;
float diffuse = max(0.0, dot(normalize(light),normal));
+
+ #ifdef USETOONSHADE
+ if(diffuse<0.05f) diffuse=0.0f;
+ else if(diffuse<0.25f) diffuse=0.25f;
+ else if(diffuse<0.5f) diffuse=0.5f;
+ else if(diffuse<0.75f) diffuse=0.75f;
+ else if(diffuse<1.0f) diffuse=1.0f;
+
+ #endif
+
+
out_Color = vec4(color*(strength*diffuse + ambient),1.0f);
+ #ifdef USETOONSHADE
+ if(length(lightcolor)>0.01f || length(lightcolor1)>0.01f || length(lightcolor2)>0.01f || length(lightcolor3)>0.01f || length(lightcolor4)>0.01f ) return;
+
+
+ if(depth1>1.05f*lin_depth || depth1<0.95f*lin_depth || angle1<0.7f||
+ depth2>1.05f*lin_depth || depth2<0.95f*lin_depth ||angle2<0.7f||
+ depth3>1.05f*lin_depth || depth3<0.95f*lin_depth ||angle3<0.7f||
+ depth4>1.05f*lin_depth || depth4<0.95f*lin_depth ||angle4<0.7f)
+ out_Color=vec4(0,0,0,1)
+ ;
+ #endif
}
return;
}
diff --git a/base/res/shaders/diagnostic.frag b/base/res/shaders/diagnostic.frag
index ac73727..25a88b4 100644
--- a/base/res/shaders/diagnostic.frag
+++ b/base/res/shaders/diagnostic.frag
@@ -21,6 +21,7 @@ uniform sampler2D u_Depthtex;
uniform sampler2D u_Normaltex;
uniform sampler2D u_Positiontex;
uniform sampler2D u_Colortex;
+uniform sampler2D u_Lightmaptex;
uniform sampler2D u_RandomNormaltex;
uniform sampler2D u_RandomScalartex;
@@ -101,6 +102,7 @@ void main() {
vec3 normal = sampleNrm(fs_Texcoord);
vec3 position = samplePos(fs_Texcoord);
vec3 color = sampleCol(fs_Texcoord);
+ vec3 lightmap=texture(u_Lightmaptex,fs_Texcoord).xyz;
vec3 light = u_Light.xyz;
float lightRadius = u_Light.w;
@@ -115,7 +117,7 @@ void main() {
out_Color = vec4(abs(position) / u_Far,1.0f);
break;
case(DISPLAY_COLOR):
- out_Color = vec4(color, 1.0);
+ out_Color = vec4(lightmap, 1.0);
break;
case(DISPLAY_LIGHTS):
case(DISPLAY_TOTAL):
diff --git a/base/res/shaders/directional.frag b/base/res/shaders/directional.frag
index a34daab..4336191 100644
--- a/base/res/shaders/directional.frag
+++ b/base/res/shaders/directional.frag
@@ -104,7 +104,7 @@ void main() {
vec3 light = u_Light.xyz;
float lightRadius = u_Light.w;
- float diffuse = max(0.0, dot(normalize(light),normal));
+ float diffuse = max(0.0, dot(normalize(light),normal));
out_Color = vec4(color*u_LightIl*diffuse,1.0f);
}
diff --git a/base/res/shaders/pass.frag b/base/res/shaders/pass.frag
index e37dcbf..902993b 100644
--- a/base/res/shaders/pass.frag
+++ b/base/res/shaders/pass.frag
@@ -2,6 +2,7 @@
uniform float u_Far;
uniform vec3 u_Color;
+uniform vec3 u_Emit;
in vec3 fs_Normal;
in vec4 fs_Position;
@@ -9,10 +10,12 @@ in vec4 fs_Position;
out vec4 out_Normal;
out vec4 out_Position;
out vec4 out_Color;
+out vec4 out_Lightmap;
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);
+ out_Lightmap=vec4(u_Emit,1.0);
}
diff --git a/base/res/shaders/pass.vert b/base/res/shaders/pass.vert
index e36825f..bc6ddeb 100644
--- a/base/res/shaders/pass.vert
+++ b/base/res/shaders/pass.vert
@@ -18,4 +18,5 @@ void main(void) {
vec4 camera = u_View * world;
fs_Position = camera;
gl_Position = u_Persp * camera;
+ //fs_Position=gl_Position;
}
diff --git a/base/res/shaders/point.frag b/base/res/shaders/point.frag
index 98b90e0..4f82418 100644
--- a/base/res/shaders/point.frag
+++ b/base/res/shaders/point.frag
@@ -11,6 +11,7 @@
#define DISPLAY_TOTAL 4
#define DISPLAY_LIGHTS 5
+//#define USEPOINTLIGHT
/////////////////////////////////////
// Uniforms, Attributes, and Outputs
@@ -37,6 +38,7 @@ uniform float u_LightIl;
in vec2 fs_Texcoord;
out vec4 out_Color;
+out vec3 light_Color;
///////////////////////////////////////
@@ -103,14 +105,36 @@ void main() {
vec3 light = u_Light.xyz;
float lightRadius = u_Light.w;
out_Color = vec4(0,0,0,1.0);
+ float lightnormdot=dot(normal,normalize(light-position));
+#ifdef USEPOINTLIGHT
if( u_DisplayType == DISPLAY_LIGHTS )
{
+ float dist=length(position-light)/lightRadius;
+ if(dist<1.0f) out_Color=vec4(1,1,1,1);
+ else if(dist<2.0f)
+ {
+ float trans=dist-1.0f;
+ out_Color=vec4(1,1,1,1)*(1-trans)*(1-trans);
+ }
+ light_Color=out_Color.rgb;
//Put some code here to visualize the fragment associated with this point light
}
else
{
+
+ float dist=length(position-light)/lightRadius;
+ if(dist<1.0f) out_Color=vec4(1,1,1,1);
+ else if(dist<2.0f)
+ {
+ float trans=dist-1.0f;
+ out_Color=vec4(1,1,1,1)*(1-trans)*(1-trans)*(1-trans);
+ }
+
+ out_Color+=vec4(color*max(0,lightnormdot),1.0f);
+
//Put some code here to actually compute the light from the point light
}
+ #endif
return;
}
diff --git a/base/res/shaders/post.frag b/base/res/shaders/post.frag
index 2bf5afc..d40a363 100644
--- a/base/res/shaders/post.frag
+++ b/base/res/shaders/post.frag
@@ -19,6 +19,8 @@ uniform sampler2D u_Posttex;
uniform sampler2D u_RandomNormaltex;
uniform sampler2D u_RandomScalartex;
+uniform sampler2D u_Lightmaptex;
+
uniform int u_ScreenWidth;
uniform int u_ScreenHeight;
@@ -63,12 +65,59 @@ float getRandomScalar(vec2 texcoords) {
///////////////////////////////////
// MAIN
//////////////////////////////////
+
+
+vec3 getBlurredLightMap(sampler2D lightTex, vec2 v_texCoord, int u_ScreenWidth, int u_ScreenHeight)
+{
+
+ float dx=2.0f/float(u_ScreenWidth);
+ float dy=2.0f/float(u_ScreenHeight);
+ vec2 tmpTexcord=v_texCoord;
+ float totalweight=0.0f;
+ float weight=0.0f;
+ vec3 totalcolor=vec3(0,0,0);
+
+
+ float blurradius=10.0f;
+ float blurdelta=1.0f;
+ float sigma=blurradius*1.24089642;
+ for(float i=-blurradius;i<=blurradius+0.1f;i+=blurdelta) for(float j=-blurradius;j<=blurradius+0.1f;j+=blurdelta)
+ {
+ if(i*i+j*j>blurradius*blurradius)continue;
+ tmpTexcord=v_texCoord+vec2(i*dx,j*dy);
+ float thedist=i*dx*i*dx+j*dy*j*dy;
+ vec3 tmpColor=texture(lightTex,tmpTexcord).xyz;
+
+
+ weight=exp(-pow(thedist,1.0f)/2.0f/sigma/sigma)/(2*3.1415926*sigma*sigma);
+ totalweight+=weight;
+ //if(tmpColor.r<0.2f) continue;
+ totalcolor+=tmpColor*weight;
+ }
+ if(totalweight<0.0001f) return vec3(0,0,0);
+ return totalcolor;///totalweight;
+}
+
+
const float occlusion_strength = 1.5f;
void main() {
- vec3 color = sampleCol(fs_Texcoord);
+
+ vec3 color = sampleCol(fs_Texcoord);
+ vec3 lightmap=getBlurredLightMap(u_Lightmaptex,fs_Texcoord,u_ScreenWidth, u_ScreenHeight);
+
+ vec2 tempTex;
+ tempTex=fs_Texcoord+vec2(1.0f/float(u_ScreenWidth),0.0f); vec3 color1=sampleCol(tempTex);
+ tempTex=fs_Texcoord-vec2(1.0f/float(u_ScreenWidth),0.0f); vec3 color2=sampleCol(tempTex);
+ tempTex=fs_Texcoord+vec2(0.0f,1.0f/float(u_ScreenHeight)); vec3 color3=sampleCol(tempTex);
+ tempTex=fs_Texcoord-vec2(0.0f,1.0f/float(u_ScreenHeight)); vec3 color4=sampleCol(tempTex);
+
float gray = dot(color, vec3(0.2125, 0.7154, 0.0721));
+ gray=1.0f;
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);
+ //out_Color=vec4((color*0.0f+(color1+color2+color3+color4)*0.25f),1.0);
+ out_Color=vec4(color*0.5f+lightmap*3.5f,1.0f);
+ //out_Color=vec4(color,1.0f);
return;
}
diff --git a/base/res/shaders/textures/background.tga b/base/res/shaders/textures/background.tga
new file mode 100644
index 0000000..19da1d3
Binary files /dev/null and b/base/res/shaders/textures/background.tga differ
diff --git a/base/res/shaders/textures/backgroundBGR.tga b/base/res/shaders/textures/backgroundBGR.tga
new file mode 100644
index 0000000..31b9741
Binary files /dev/null and b/base/res/shaders/textures/backgroundBGR.tga differ
diff --git a/base/res/shaders/textures/background_bump.png b/base/res/shaders/textures/background_bump.png
new file mode 100644
index 0000000..2e7688c
Binary files /dev/null and b/base/res/shaders/textures/background_bump.png differ
diff --git a/base/res/shaders/textures/chain_texture.tga b/base/res/shaders/textures/chain_texture.tga
new file mode 100644
index 0000000..b30b202
Binary files /dev/null and b/base/res/shaders/textures/chain_texture.tga differ
diff --git a/base/res/shaders/textures/chain_texture_bump.png b/base/res/shaders/textures/chain_texture_bump.png
new file mode 100644
index 0000000..a36909c
Binary files /dev/null and b/base/res/shaders/textures/chain_texture_bump.png differ
diff --git a/base/res/shaders/textures/chain_texture_mask.png b/base/res/shaders/textures/chain_texture_mask.png
new file mode 100644
index 0000000..0f71fd0
Binary files /dev/null and b/base/res/shaders/textures/chain_texture_mask.png differ
diff --git a/base/res/shaders/textures/gi_flag.tga b/base/res/shaders/textures/gi_flag.tga
new file mode 100644
index 0000000..9a565d7
Binary files /dev/null and b/base/res/shaders/textures/gi_flag.tga differ
diff --git a/base/res/shaders/textures/lion.tga b/base/res/shaders/textures/lion.tga
new file mode 100644
index 0000000..acb9546
Binary files /dev/null and b/base/res/shaders/textures/lion.tga differ
diff --git a/base/res/shaders/textures/lion2_bump.png b/base/res/shaders/textures/lion2_bump.png
new file mode 100644
index 0000000..117515a
Binary files /dev/null and b/base/res/shaders/textures/lion2_bump.png differ
diff --git a/base/res/shaders/textures/lion_bump.png b/base/res/shaders/textures/lion_bump.png
new file mode 100644
index 0000000..b2071a2
Binary files /dev/null and b/base/res/shaders/textures/lion_bump.png differ
diff --git a/base/res/shaders/textures/spnza_bricks_a_bump.png b/base/res/shaders/textures/spnza_bricks_a_bump.png
new file mode 100644
index 0000000..1108850
Binary files /dev/null and b/base/res/shaders/textures/spnza_bricks_a_bump.png differ
diff --git a/base/res/shaders/textures/spnza_bricks_a_diff.tga b/base/res/shaders/textures/spnza_bricks_a_diff.tga
new file mode 100644
index 0000000..2124b32
Binary files /dev/null and b/base/res/shaders/textures/spnza_bricks_a_diff.tga differ
diff --git a/base/res/shaders/textures/spnza_bricks_a_spec.tga b/base/res/shaders/textures/spnza_bricks_a_spec.tga
new file mode 100644
index 0000000..df946a2
Binary files /dev/null and b/base/res/shaders/textures/spnza_bricks_a_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_arch_bump.png b/base/res/shaders/textures/sponza_arch_bump.png
new file mode 100644
index 0000000..d849d39
Binary files /dev/null and b/base/res/shaders/textures/sponza_arch_bump.png differ
diff --git a/base/res/shaders/textures/sponza_arch_diff.tga b/base/res/shaders/textures/sponza_arch_diff.tga
new file mode 100644
index 0000000..01c425e
Binary files /dev/null and b/base/res/shaders/textures/sponza_arch_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_arch_spec.tga b/base/res/shaders/textures/sponza_arch_spec.tga
new file mode 100644
index 0000000..302a9dd
Binary files /dev/null and b/base/res/shaders/textures/sponza_arch_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_ceiling_a_diff.tga b/base/res/shaders/textures/sponza_ceiling_a_diff.tga
new file mode 100644
index 0000000..16cfc25
Binary files /dev/null and b/base/res/shaders/textures/sponza_ceiling_a_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_ceiling_a_spec.tga b/base/res/shaders/textures/sponza_ceiling_a_spec.tga
new file mode 100644
index 0000000..9deae8e
Binary files /dev/null and b/base/res/shaders/textures/sponza_ceiling_a_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_column_a_bump.png b/base/res/shaders/textures/sponza_column_a_bump.png
new file mode 100644
index 0000000..ea4df82
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_a_bump.png differ
diff --git a/base/res/shaders/textures/sponza_column_a_diff.tga b/base/res/shaders/textures/sponza_column_a_diff.tga
new file mode 100644
index 0000000..ba10c95
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_a_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_column_a_spec.tga b/base/res/shaders/textures/sponza_column_a_spec.tga
new file mode 100644
index 0000000..68dc6ea
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_a_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_column_b_bump.png b/base/res/shaders/textures/sponza_column_b_bump.png
new file mode 100644
index 0000000..d265893
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_b_bump.png differ
diff --git a/base/res/shaders/textures/sponza_column_b_diff.tga b/base/res/shaders/textures/sponza_column_b_diff.tga
new file mode 100644
index 0000000..8478671
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_b_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_column_b_spec.tga b/base/res/shaders/textures/sponza_column_b_spec.tga
new file mode 100644
index 0000000..f8c3a88
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_b_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_column_c_bump.png b/base/res/shaders/textures/sponza_column_c_bump.png
new file mode 100644
index 0000000..b580a62
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_c_bump.png differ
diff --git a/base/res/shaders/textures/sponza_column_c_diff.tga b/base/res/shaders/textures/sponza_column_c_diff.tga
new file mode 100644
index 0000000..61ea0c0
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_c_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_column_c_spec.tga b/base/res/shaders/textures/sponza_column_c_spec.tga
new file mode 100644
index 0000000..6155a5b
Binary files /dev/null and b/base/res/shaders/textures/sponza_column_c_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_curtain_blue_diff.tga b/base/res/shaders/textures/sponza_curtain_blue_diff.tga
new file mode 100644
index 0000000..6cd4c52
Binary files /dev/null and b/base/res/shaders/textures/sponza_curtain_blue_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_curtain_diff.tga b/base/res/shaders/textures/sponza_curtain_diff.tga
new file mode 100644
index 0000000..af23d3e
Binary files /dev/null and b/base/res/shaders/textures/sponza_curtain_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_curtain_green_diff.tga b/base/res/shaders/textures/sponza_curtain_green_diff.tga
new file mode 100644
index 0000000..d8f9a28
Binary files /dev/null and b/base/res/shaders/textures/sponza_curtain_green_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_details_diff.tga b/base/res/shaders/textures/sponza_details_diff.tga
new file mode 100644
index 0000000..31b67d8
Binary files /dev/null and b/base/res/shaders/textures/sponza_details_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_details_spec.tga b/base/res/shaders/textures/sponza_details_spec.tga
new file mode 100644
index 0000000..e6519ac
Binary files /dev/null and b/base/res/shaders/textures/sponza_details_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_fabric_blue_diff.tga b/base/res/shaders/textures/sponza_fabric_blue_diff.tga
new file mode 100644
index 0000000..7a37c26
Binary files /dev/null and b/base/res/shaders/textures/sponza_fabric_blue_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_fabric_diff.tga b/base/res/shaders/textures/sponza_fabric_diff.tga
new file mode 100644
index 0000000..c9f933a
Binary files /dev/null and b/base/res/shaders/textures/sponza_fabric_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_fabric_green_diff.tga b/base/res/shaders/textures/sponza_fabric_green_diff.tga
new file mode 100644
index 0000000..7693da3
Binary files /dev/null and b/base/res/shaders/textures/sponza_fabric_green_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_fabric_spec.tga b/base/res/shaders/textures/sponza_fabric_spec.tga
new file mode 100644
index 0000000..004ed65
Binary files /dev/null and b/base/res/shaders/textures/sponza_fabric_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_flagpole_diff.tga b/base/res/shaders/textures/sponza_flagpole_diff.tga
new file mode 100644
index 0000000..8600a6b
Binary files /dev/null and b/base/res/shaders/textures/sponza_flagpole_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_flagpole_spec.tga b/base/res/shaders/textures/sponza_flagpole_spec.tga
new file mode 100644
index 0000000..c4e22a3
Binary files /dev/null and b/base/res/shaders/textures/sponza_flagpole_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_floor_a_diff.tga b/base/res/shaders/textures/sponza_floor_a_diff.tga
new file mode 100644
index 0000000..e9587e3
Binary files /dev/null and b/base/res/shaders/textures/sponza_floor_a_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_floor_a_spec.tga b/base/res/shaders/textures/sponza_floor_a_spec.tga
new file mode 100644
index 0000000..e5d849c
Binary files /dev/null and b/base/res/shaders/textures/sponza_floor_a_spec.tga differ
diff --git a/base/res/shaders/textures/sponza_roof_diff.tga b/base/res/shaders/textures/sponza_roof_diff.tga
new file mode 100644
index 0000000..a8fd321
Binary files /dev/null and b/base/res/shaders/textures/sponza_roof_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_thorn_bump.png b/base/res/shaders/textures/sponza_thorn_bump.png
new file mode 100644
index 0000000..d1c93f8
Binary files /dev/null and b/base/res/shaders/textures/sponza_thorn_bump.png differ
diff --git a/base/res/shaders/textures/sponza_thorn_diff.tga b/base/res/shaders/textures/sponza_thorn_diff.tga
new file mode 100644
index 0000000..0f17a89
Binary files /dev/null and b/base/res/shaders/textures/sponza_thorn_diff.tga differ
diff --git a/base/res/shaders/textures/sponza_thorn_mask.png b/base/res/shaders/textures/sponza_thorn_mask.png
new file mode 100644
index 0000000..1c8407f
Binary files /dev/null and b/base/res/shaders/textures/sponza_thorn_mask.png differ
diff --git a/base/res/shaders/textures/sponza_thorn_spec.tga b/base/res/shaders/textures/sponza_thorn_spec.tga
new file mode 100644
index 0000000..043ba85
Binary files /dev/null and b/base/res/shaders/textures/sponza_thorn_spec.tga differ
diff --git a/base/res/shaders/textures/vase_bump.png b/base/res/shaders/textures/vase_bump.png
new file mode 100644
index 0000000..6285632
Binary files /dev/null and b/base/res/shaders/textures/vase_bump.png differ
diff --git a/base/res/shaders/textures/vase_dif.tga b/base/res/shaders/textures/vase_dif.tga
new file mode 100644
index 0000000..c147b37
Binary files /dev/null and b/base/res/shaders/textures/vase_dif.tga differ
diff --git a/base/res/shaders/textures/vase_hanging.tga b/base/res/shaders/textures/vase_hanging.tga
new file mode 100644
index 0000000..8954561
Binary files /dev/null and b/base/res/shaders/textures/vase_hanging.tga differ
diff --git a/base/res/shaders/textures/vase_plant.tga b/base/res/shaders/textures/vase_plant.tga
new file mode 100644
index 0000000..0c449aa
Binary files /dev/null and b/base/res/shaders/textures/vase_plant.tga differ
diff --git a/base/res/shaders/textures/vase_plant_mask.png b/base/res/shaders/textures/vase_plant_mask.png
new file mode 100644
index 0000000..ce570a9
Binary files /dev/null and b/base/res/shaders/textures/vase_plant_mask.png differ
diff --git a/base/res/shaders/textures/vase_plant_spec.tga b/base/res/shaders/textures/vase_plant_spec.tga
new file mode 100644
index 0000000..0fb9ff1
Binary files /dev/null and b/base/res/shaders/textures/vase_plant_spec.tga differ
diff --git a/base/res/shaders/textures/vase_round.tga b/base/res/shaders/textures/vase_round.tga
new file mode 100644
index 0000000..6f83f61
Binary files /dev/null and b/base/res/shaders/textures/vase_round.tga differ
diff --git a/base/res/shaders/textures/vase_round_bump.png b/base/res/shaders/textures/vase_round_bump.png
new file mode 100644
index 0000000..10e82da
Binary files /dev/null and b/base/res/shaders/textures/vase_round_bump.png differ
diff --git a/base/res/shaders/textures/vase_round_spec.tga b/base/res/shaders/textures/vase_round_spec.tga
new file mode 100644
index 0000000..ed4a42e
Binary files /dev/null and b/base/res/shaders/textures/vase_round_spec.tga differ
diff --git a/base/src/SOIL/SOIL.c b/base/src/SOIL/SOIL.c
index 93a1995..a86e0ab 100644
--- a/base/src/SOIL/SOIL.c
+++ b/base/src/SOIL/SOIL.c
@@ -105,6 +105,7 @@ unsigned int
);
/* and the code magic begins here [8^) */
+
unsigned int
SOIL_load_OGL_texture
(
diff --git a/base/src/SOIL/SOIL.h b/base/src/SOIL/SOIL.h
index 43f634f..334d224 100644
--- a/base/src/SOIL/SOIL.h
+++ b/base/src/SOIL/SOIL.h
@@ -36,7 +36,6 @@
* Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts
* everybody at gamedev.net
**/
-
#ifndef HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY
#define HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY
@@ -156,7 +155,7 @@ unsigned int
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags
- );
+ );
/**
Loads 6 images from disk into an OpenGL cubemap texture.
diff --git a/base/src/SOIL/SOIL.vcxproj b/base/src/SOIL/SOIL.vcxproj
index 9c1f384..ea169c9 100644
--- a/base/src/SOIL/SOIL.vcxproj
+++ b/base/src/SOIL/SOIL.vcxproj
@@ -46,7 +46,7 @@
Disabled
- C:\user\Project6-DeferredShader\shared32\glew\include;..\..\..\shared32\glew\include;%(AdditionalIncludeDirectories)
+ E:\gitprojects\Project6-DeferredShader\shared32\glew\include;..\..\..\shared32\glew\include;%(AdditionalIncludeDirectories)
WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
true
EnableFastChecks
diff --git a/base/src/main.cpp b/base/src/main.cpp
index 88aa6bb..6c7fba2 100644
--- a/base/src/main.cpp
+++ b/base/src/main.cpp
@@ -80,6 +80,7 @@ device_mesh_t uploadMesh(const mesh_t & mesh) {
out.texname = mesh.texname;
out.color = mesh.color;
+ out.emitlight=mesh.emitlight;
return out;
}
@@ -161,6 +162,7 @@ void initMesh() {
mesh.color = vec3(shape.material.diffuse[0],
shape.material.diffuse[1],
shape.material.diffuse[2]);
+ mesh.emitlight=vec3(shape.material.ambient[0],shape.material.ambient[1],shape.material.ambient[2]);
mesh.texname = shape.material.diffuse_texname;
draw_meshes.push_back(uploadMesh(mesh));
f=f+process;
@@ -211,7 +213,9 @@ GLuint depthTexture = 0;
GLuint normalTexture = 0;
GLuint positionTexture = 0;
GLuint colorTexture = 0;
+GLuint lightmapTexture = 0;
GLuint postTexture = 0;
+GLuint postlightTexture = 0;
GLuint FBO[2] = {0, 0};
@@ -221,7 +225,7 @@ GLuint ambient_prog;
GLuint diagnostic_prog;
GLuint post_prog;
void initShader() {
- Utility::shaders_t shaders = Utility::loadShaders("../res/shaders/pass.vert", "../res/shaders/pass.frag");
+ Utility::shaders_t shaders = Utility::loadShaders("../../../res/shaders/pass.vert", "../../../res/shaders/pass.frag");
pass_prog = glCreateProgram();
@@ -231,7 +235,7 @@ void initShader() {
Utility::attachAndLinkProgram(pass_prog,shaders);
- shaders = Utility::loadShaders("../res/shaders/shade.vert", "../res/shaders/diagnostic.frag");
+ shaders = Utility::loadShaders("../../../res/shaders/shade.vert", "../../../res/shaders/diagnostic.frag");
diagnostic_prog = glCreateProgram();
@@ -240,7 +244,7 @@ void initShader() {
Utility::attachAndLinkProgram(diagnostic_prog, shaders);
- shaders = Utility::loadShaders("../res/shaders/shade.vert", "../res/shaders/ambient.frag");
+ shaders = Utility::loadShaders("../../../res/shaders/shade.vert", "../../../res/shaders/ambient.frag");
ambient_prog = glCreateProgram();
@@ -249,7 +253,7 @@ void initShader() {
Utility::attachAndLinkProgram(ambient_prog, shaders);
- shaders = Utility::loadShaders("../res/shaders/shade.vert", "../res/shaders/point.frag");
+ shaders = Utility::loadShaders("../../../res/shaders/shade.vert", "../../../res/shaders/point.frag");
point_prog = glCreateProgram();
@@ -258,7 +262,7 @@ void initShader() {
Utility::attachAndLinkProgram(point_prog, shaders);
- shaders = Utility::loadShaders("../res/shaders/post.vert", "../res/shaders/post.frag");
+ shaders = Utility::loadShaders("../../../res/shaders/post.vert", "../../../res/shaders/post.frag");
post_prog = glCreateProgram();
@@ -273,7 +277,9 @@ void freeFBO() {
glDeleteTextures(1,&normalTexture);
glDeleteTextures(1,&positionTexture);
glDeleteTextures(1,&colorTexture);
+ glDeleteTextures(1,&lightmapTexture);
glDeleteTextures(1,&postTexture);
+ glDeleteTextures(1,&postlightTexture);
glDeleteFramebuffers(1,&FBO[0]);
glDeleteFramebuffers(1,&FBO[1]);
}
@@ -311,8 +317,8 @@ void checkFramebufferStatus(GLenum framebufferStatus) {
GLuint random_normal_tex;
GLuint random_scalar_tex;
-void initNoise() {
- random_normal_tex = (unsigned int)SOIL_load_OGL_texture("../res/random_normal.png",0,0,0);
+void initNoise1() {
+ random_normal_tex = (unsigned int)SOIL_load_OGL_texture("../../../res/random_normal.png",0,0,0);
glBindTexture(GL_TEXTURE_2D, random_normal_tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -320,7 +326,7 @@ void initNoise() {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glBindTexture(GL_TEXTURE_2D, 0);
- random_scalar_tex = (unsigned int)SOIL_load_OGL_texture("../res/random.png",0,0,0);
+ random_scalar_tex = (unsigned int)SOIL_load_OGL_texture("../../../res/random.png",0,0,0);
glBindTexture(GL_TEXTURE_2D, random_scalar_tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -338,6 +344,7 @@ void initFBO(int w, int h) {
glGenTextures(1, &normalTexture);
glGenTextures(1, &positionTexture);
glGenTextures(1, &colorTexture);
+ glGenTextures(1, &lightmapTexture);
//Set up depth FBO
glBindTexture(GL_TEXTURE_2D, depthTexture);
@@ -384,6 +391,17 @@ void initFBO(int w, int h) {
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB32F , w, h, 0, GL_RGBA, GL_FLOAT,0);
+ //Bind Lightmap FBO
+ glBindTexture(GL_TEXTURE_2D, lightmapTexture);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB32F , w, h, 0, GL_RGBA, GL_FLOAT,0);
+
// creatwwe a framebuffer object
glGenFramebuffers(1, &FBO[0]);
glBindFramebuffer(GL_FRAMEBUFFER, FBO[0]);
@@ -393,11 +411,14 @@ void initFBO(int w, int h) {
GLint normal_loc = glGetFragDataLocation(pass_prog,"out_Normal");
GLint position_loc = glGetFragDataLocation(pass_prog,"out_Position");
GLint color_loc = glGetFragDataLocation(pass_prog,"out_Color");
- GLenum draws [3];
+ GLint lightmap_loc = glGetFragDataLocation(pass_prog,"out_Lightmap");
+
+ GLenum draws [4];
draws[normal_loc] = GL_COLOR_ATTACHMENT0;
draws[position_loc] = GL_COLOR_ATTACHMENT1;
draws[color_loc] = GL_COLOR_ATTACHMENT2;
- glDrawBuffers(3, draws);
+ draws[lightmap_loc] = GL_COLOR_ATTACHMENT3;
+ glDrawBuffers(4, draws);
// attach the texture to FBO depth attachment point
int test = GL_COLOR_ATTACHMENT0;
@@ -409,6 +430,8 @@ void initFBO(int w, int h) {
glFramebufferTexture(GL_FRAMEBUFFER, draws[position_loc], positionTexture, 0);
glBindTexture(GL_TEXTURE_2D, colorTexture);
glFramebufferTexture(GL_FRAMEBUFFER, draws[color_loc], colorTexture, 0);
+ glBindTexture(GL_TEXTURE_2D, lightmapTexture);
+ glFramebufferTexture(GL_FRAMEBUFFER, draws[lightmap_loc], lightmapTexture, 0);
// check FBO status
FBOstatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
@@ -449,6 +472,8 @@ void initFBO(int w, int h) {
glBindTexture(GL_TEXTURE_2D, postTexture);
glFramebufferTexture(GL_FRAMEBUFFER, draw[color_loc], postTexture, 0);
+
+
// check FBO status
FBOstatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if(FBOstatus != GL_FRAMEBUFFER_COMPLETE) {
@@ -540,7 +565,7 @@ mat4x4 get_mesh_world() {
return tilt_mat * scale_mat; //translate_mat;
}
-
+
float FARP;
float NEARP;
void draw_mesh() {
@@ -563,6 +588,7 @@ void draw_mesh() {
for(int i=0; i NEARP)
- {
- return;
- }
+ //if( light.z > NEARP)
+ //{
+ // return;
+ //}
light.w = radius;
glUniform4fv(glGetUniformLocation(point_prog, "u_Light"), 1, &(light[0]));
glUniform1f(glGetUniformLocation(point_prog, "u_LightIl"), strength);
@@ -740,14 +770,28 @@ void display(void)
0.0, 0.0, 1.0, 0.0,
0.5, 0.5, 0.0, 1.0);
- draw_light(vec3(2.5, -2.5, 5.0), 0.50, sc, vp, NEARP);
+ float downthreshold=-2.5f;
+ float upthreshode=2.5f;
+ float deltad=0.5f;
+ float num1d=(upthreshode-downthreshold)/deltad;
+
+ //for(float dx=-2.5f;dx<=2.5f;dx+=0.5f)draw_light(vec3(2.5+dx, -2.5, 5.0), 1.10/num1d, sc, vp, NEARP);
+ //for(float dy=-2.5f;dy<=2.5f;dy+=0.5f)
+ // for(float dz=-5.0f;dz<=0.0f;dz+=0.5f)
+ //{
+ // draw_light(vec3(2.5+downthreshold, -2.5+dy, 5.0+dz), 1.10/num1d, sc, vp, NEARP);
+ // draw_light(vec3(2.5+upthreshode, -2.5+dy, 5.0+dz), 1.10/num1d, sc, vp, NEARP);
+ //}
+ //draw_light(vec3(2.5, -2.5, 5.0+dz), 1.10/num1d, sc, vp, NEARP);
+
+ draw_light(vec3(2.5f, -2.5f, 5.0f), 0.5f, sc, vp, NEARP);
glDisable(GL_SCISSOR_TEST);
vec4 dir_light(0.1, 1.0, 1.0, 0.0);
dir_light = cam.get_view() * dir_light;
dir_light = normalize(dir_light);
- dir_light.w = 0.3;
- float strength = 0.09;
+ dir_light.w = 0.9;
+ float strength = 0.39;
setup_quad(ambient_prog);
glUniform4fv(glGetUniformLocation(ambient_prog, "u_Light"), 1, &(dir_light[0]));
glUniform1f(glGetUniformLocation(ambient_prog, "u_LightIl"), strength);
@@ -769,6 +813,10 @@ void display(void)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, postTexture);
glUniform1i(glGetUniformLocation(post_prog, "u_Posttex"),0);
+
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D, lightmapTexture);
+ glUniform1i(glGetUniformLocation(post_prog, "u_Lightmaptex"),1);
glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, random_normal_tex);
@@ -927,7 +975,7 @@ int main (int argc, char* argv[])
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
- width = 1280;
+ width = 960;
height = 720;
glutInitWindowSize(width,height);
glutCreateWindow("CIS565 OpenGL Frame");
@@ -942,7 +990,7 @@ int main (int argc, char* argv[])
cout << "Status: Using GLEW " << glewGetString(GLEW_VERSION) << endl;
cout << "OpenGL version " << glGetString(GL_VERSION) << " supported" << endl;
- initNoise();
+ initNoise1();
initShader();
initFBO(width,height);
init();
diff --git a/base/src/main.h b/base/src/main.h
index 0a96a3a..ccdfc32 100644
--- a/base/src/main.h
+++ b/base/src/main.h
@@ -1,3 +1,5 @@
+#pragma once
+
#ifndef MAIN_H
#define MAIN_H
@@ -37,6 +39,7 @@ typedef struct {
std::vector indices;
std::string texname;
glm::vec3 color;
+ glm::vec3 emitlight;
} mesh_t;
typedef struct {
@@ -48,6 +51,7 @@ typedef struct {
unsigned int vbo_texcoords;
glm::vec3 color;
std::string texname;
+ glm::vec3 emitlight;
} device_mesh_t;
typedef struct {
@@ -91,7 +95,7 @@ void printShaderInfoLog(GLint shader);
void printLinkInfoLog(GLint prog);
void initShade();
void initPass();
-
+void initNoise1();
void initMesh();
device_mesh_t uploadMesh(const mesh_t & mesh);
diff --git a/img/SSAO-compare.jpg b/img/SSAO-compare.jpg
new file mode 100644
index 0000000..2f2e2f4
Binary files /dev/null and b/img/SSAO-compare.jpg differ
diff --git a/img/SSAO-compare2.jpg b/img/SSAO-compare2.jpg
new file mode 100644
index 0000000..d881699
Binary files /dev/null and b/img/SSAO-compare2.jpg differ
diff --git a/img/bloom.jpg b/img/bloom.jpg
new file mode 100644
index 0000000..7948fbb
Binary files /dev/null and b/img/bloom.jpg differ
diff --git a/img/large-radius-SSAO.jpg b/img/large-radius-SSAO.jpg
new file mode 100644
index 0000000..4ab15f2
Binary files /dev/null and b/img/large-radius-SSAO.jpg differ
diff --git a/img/pointlight.jpg b/img/pointlight.jpg
new file mode 100644
index 0000000..1eef504
Binary files /dev/null and b/img/pointlight.jpg differ
diff --git a/img/toonshade.jpg b/img/toonshade.jpg
new file mode 100644
index 0000000..0060380
Binary files /dev/null and b/img/toonshade.jpg differ
diff --git a/img/toonshade2.jpg b/img/toonshade2.jpg
new file mode 100644
index 0000000..e97eb5a
Binary files /dev/null and b/img/toonshade2.jpg differ