0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)
24 Ansichten13 Seiten
The document discusses shadow mapping and the GLM library. It explains that shadow mapping is a technique for dynamic shadows that uses two rendering passes - one from the light's point of view to generate a shadow map, and another from the camera's point of view to test pixels for shadows using the shadow map. It also introduces the GLM library, which is a header-only C++ math library that implements similar functions and naming conventions as GLSL for working with matrices, vectors, and other common graphics math operations. GLM handles column-major matrices and can be used to build common matrices like model, view, projection, and MVP matrices for transforming and rendering 3D scenes.
The document discusses shadow mapping and the GLM library. It explains that shadow mapping is a technique for dynamic shadows that uses two rendering passes - one from the light's point of view to generate a shadow map, and another from the camera's point of view to test pixels for shadows using the shadow map. It also introduces the GLM library, which is a header-only C++ math library that implements similar functions and naming conventions as GLSL for working with matrices, vectors, and other common graphics math operations. GLM handles column-major matrices and can be used to build common matrices like model, view, projection, and MVP matrices for transforming and rendering 3D scenes.
The document discusses shadow mapping and the GLM library. It explains that shadow mapping is a technique for dynamic shadows that uses two rendering passes - one from the light's point of view to generate a shadow map, and another from the camera's point of view to test pixels for shadows using the shadow map. It also introduces the GLM library, which is a header-only C++ math library that implements similar functions and naming conventions as GLSL for working with matrices, vectors, and other common graphics math operations. GLM handles column-major matrices and can be used to build common matrices like model, view, projection, and MVP matrices for transforming and rendering 3D scenes.
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 1
OpenGL Spaces
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 2
Modeling Transform
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 3
Viewing Transform
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 4
Projection and Perspective Divide
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 5
Shadowing Techniques • Light maps don’t deal with movable lights. • You bake it just once, then use it as a texture. • Extensively use for the sunlight or indoor scenes.
• There are various methods used for dynamic shadows.
• Shadow Volume • Project a ray from the light source through each shadow casting object. • SHADOW MAPPING
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 6
Shadow Mapping • Algorithm consists of two passes. •In the first pass, scene is rendered from viewpoint of the light. • In the HW, light is directional. Therefore ortographic projection should be used.
•In the second pass scene is rendered from viewpoint of the camera. • But you should do an extra test to understand whether a pixel in shadow.
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 7
Shadow Mapping
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 8
Shadowed Scene
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 9
Shadow Texture
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 10
OpenGL Mathematics (GLM) • Is a header only C++ mathematics library based on GLSL specifications. • Most importantly matrices are in column-major order.
• Naming conventions and functionalities are same with GLSL.
•It is a header only library. • You don’t need to build to use it. • You only have to include <glm/[headerName].hpp>
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 11
GLM Datatypes • Matrix-Stack is deprecated with OpenGL 3.0 • In order understand space transformations, it is suggested to use GLM in your HW. • glm::vec4 pos = glm::vec4(1.0f, 1.0f, 0.0f, 1.0f) • glm::mat4 viewMatrix = glm::lookAt(camPos, centerPos, upVec) • glm::mat4 modelMatrix = glm::mat4(1.0f) // Load Identity model = glm::rotate(model, ...) • glm::mat4 mvMatrix = view x model • glm::mat4 projMatrix = glm::perspective(fovy, aspect, near, far) • glm::mat4 lightProjMatrix = glm::ortho(left, right, bottom, top) • Glm::mat4 mvpMatrix = projMatrix(or lightProjMatrix) x mvMatrix
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 12
QUESTIONS ?
12/22/2014 IMAGE IS TAKEN FROM HTTP://GOO.GL/AHNRYT 13