Giter Club home page Giter Club logo

cs452-lab6's Introduction

CS452-LAB6

Due Tuesday April 15

There are many ways to create shadows with opengl. One way is with "shadow mapping."

Shadow mapping with one directional light goes as follows:

  • Set up a texture which will hold the depth data from our lights point of view
  • Set up a basic MVP matrix which will be used to render the scene from the point of view of the light
  • The shaders for rendering here are very simple, since all we have to do is render a black and white texture
  • The lighting texture is then used by the main vertex shader and fragment shader. These shaders use the matricies from earlier to determine where a fragment lies on the lighting texture.
  • Anything that is not 'visible' on the lighting textue is considered to be in a shadow, and therefore its color is multiplied by 0.5 (or some other fraction, based on programmers taste)

The technique described above is used for directional lighting, where all light rays are considered to run parallel to one another. There are also ways of creating other light types, like spot lights and point lights.

A spot light is very similar, but a perspective projection matrix is used instead of an orthographic projection matrix.

A point light is also similar, however instead of one texture for the depth map, a cube map s used. This means that a texture is rendered so that depth is known from all directions around the point light.

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.