Skip to content

foxking0416/Project6-DeferredShader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Deferred Shader This project is about implementing the deferred shader by using WebGL.
The features I implemented including

  • Diffuse and Bling shading
  • Bloom shading with separable convolution
  • Toon shading
  • Screen space ambient occlusion

User could use number keys to switch between different shading effects.

  • '0': Diffuse and bling shading
  • '9': Toon shading
  • '8': Ambient occlusion
  • '7': Bloom shading with separable convolution
  • '6': Bloom shading without separable convolution
  • '5': Silhouette image

#Diffuse and bling shading Title Image

#Toon shading What I did in toon shading is that I tried to create the boundaries or silhouette by finding the place where the normal has enormous change.
In addition, instead of using the continuous RGB to shade the color, I divided the RGB into 5 segments to make the toon like shading. toon shading result

#Bloom Because the bloom shading needs the alpha value to mark the place where we want to make it glow. However, our model here lacks the alpha information. Therefore, I use the silhouettes which I created for toon shading to be my alpha value. The belowing image shows the silhouette which I used to glow my first diffuse_bling shading.
What different between the white glow image and green glow image is that I used separable convolution to do the bloom for white glow one. bloom result with convolution bloom result with convolution bloom result without convolution

#Screen space ambient occlusion I followed the tutorial of http://john-chapman-graphics.blogspot.co.uk/2013/01/ssao-tutorial.html to implemente my SSAO. What difficult here is to find the appropriate radius to cast our samples. ssao result

#Depth value debug depth

#Performance Analysis

When I am doing the experiment, I found something interesting. Because initially I wrote the bloom shaders with and without separable convolution in the same shader file and using number keys to switch to different code pathes by passing in the uniform integer, and the FPS of these two methods are the same. It's weird for me because the code path without using separable convolution should have much more computation loading than the other one. After I asked Cheng-Tso Lin, he told me that what I found is possible because of the WebGL compiling issue. Anyway, in order to finish this experiment, I eventually wrote the bloom shaders with and without separable convolution in two different shader file.
From the belowing chart we could obviously found that using separable convolution to do the bloom shading has huge benefit on performance. The benefit will become huger when the number of samples become larger.
performance result performance result #Video http://youtu.be/U8ZvzvczlKc

#Reference Bloom: http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html
SSAO: http://john-chapman-graphics.blogspot.co.uk/2013/01/ssao-tutorial.html

About

WebGL Deferred Shading Engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.6%
  • C 1.4%