Skip to content

cboots/Deferred-Shading

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Deferred Shader

Fall 2013

fullscene

Youtube Video of Rendering:

Youtube Video of Rendering Process

NOTE:

This project requires any graphics card with support for a modern OpenGL pipeline. Any AMD, NVIDIA, or Intel card from the past few years should work fine, and every machine in the SIG Lab and Moore 100 is capable of running this project.


INTRODUCTION:

This project implements a three stage deffered shader pipeline. Stage 1 renders geometry and samples model textures. Stage 2 performs point and ambient lighting calculations Stage 3 does any post processing effects


CONTENTS:

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.

CODE TOUR/CONTROLS

Stage 1 samples model textures renders the scene geometry to the G-Buffer

  • pass.vert
  • pass.frag

Stage 2 renders the lighting passes and accumulates to the P-Buffer

  • shade.vert
  • ambient.frag
  • point.frag
  • diagnostic.frag

Stage 3 renders the post processing

  • post.vert
  • post.frag

Keyboard controls keyboard: This is a good reference for the key mappings in the program. WASDQZ - Movement X - Toggle scissor test R - Reload shaders 1 - View depth 2 - View eye space normals 3 - View Diffuse color 4 - View eye space positions 5 - View lighting debug mode 6 - View Specular Mapping 7 - View Only Bloomed Geometry 0 - Standard view

x - Toggle Scissor Test r - Reload Shaders p - Print camera position to console j - Toggle timing measurements to console (averaged since last reset) SPACE - Reset timing averages

Shift-L - Toggle Bloom Shift-T - Toggle Toon Shading Shift-D - Toggle Diffuse Mapping Shift-S - Toggle Specular Mapping Shift-B - Toggle Bump Mapping Shift-M - Toggle Transparency Masking

c - Reset diffuse color to default t - Change diffuse color to texture coordinate visualization h - Overlay diffuse color with visualization of available textures b - Change diffuse color to bump map visualization if available m - Change diffuse color to white if mask texture is available


Features:

  • Renders .obj files with support for .mtl files with

    • Diffuse Textures
    • Specular Textures
    • Height Maps (Bump Mapping)
    • Texture Masking
  • Bloom (Not seperable, very inefficient) NoBloom Bloom

  • "Toon" Shading (with basic silhouetting and color quantization) Toon Toon

  • Point light sources with specular

Point Specular

SCREENSHOTS

No special features enabled. Just Point lighting: Baseline

Diffuse Texture: Diffuse Map

Specular Texture: Specular Map

Bump Mapping: Bump Map Bump Map Bump Map

Masking: Mask No Mask With Mask

All Textures: All Textures Map

Scissor Test Specular Bug: ScissorNo Scissor


PERFORMANCE EVALUATION

I measured the synchronized time to complete each stage of the pipeline with various features enabled. Two test scenes were used, a wide shot of the entire hall and a closeup of the lion sculpture (see above). Bloom was so inefficient that I removed it from some charts for scale

Full Hall Metrics:

TimingFH TimingFHB

Lion Closeup Metrics:

TimingLC TimingLCB

Clearly the non-seperated convolution involved in the bloom effect has a huge impact on performance. Most of the other effects had only minimal impact on performance. The scissor test gave a huge boost to stage 2 performance but as shown above it results in visual artifacts. Another takeaway of this data is the second stage (lighting calculation) is the most intensive part of the process.


ACKNOWLEDGEMENTS

This project makes use of tinyobjloader and SOIL

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 74.7%
  • C++ 22.1%
  • Objective-C 1.2%
  • CSS 1.1%
  • XSLT 0.9%