Giter Club home page Giter Club logo

tsbk03-shadow-volumes's Introduction

TSBK03-Shadow-volumes

OpenGL implementation of stencil shadow volumes using the geometry shader. Project in the course TSBK03 - Advanced Game Programming. Shadow volumes is a robust method for dynamic, real-time, shadows that supports point light sources and self-shadowing nicely.

The scene is rendered in three passes:

  • An ambient pass, that results in ambient lightning in shadowed fragments and updates the z-buffer.
  • A volume creation pass, in which the shadow volumes are created and rendered to the stencil buffer.
  • A final pass, in which the scene is rendered with lightning, using the stencil buffer as a mask.

The shadow volume creation is done using the geometry shader (see shaders/shadowVolume.geom) and triangles with adjacency information. A better way to do this would be to use a half-edge mesh represenation of the geometry, which enables a more efficient way to identify the adjacent indices. This is, however, beyond the scope of this project, but might be implemented in the future to add the possiblity of including more complex objects (with a lot of triangles) in the scene.

Below is some result images of the project at 2019-01-23. What is not visible in these is that the shadows are dynamic. The orage object is rotating and the light source can be moved using the arrow keys.

Some result images:

demo image 1


demo image 2


Notice how the occluders cast shadows on other objects in the scene, but also on themselves (second image, with torus-like object).


demo image 3


The image above shows the final result, including the shadow volume in wireframe. Notice how the self-shadow on the torus occurs due to intersection of the shadow volume with the object itself.

tsbk03-shadow-volumes's People

Contributors

weirdrubberduck avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.