GAM532 DPS932 – Week 8 Texture Shadow Implementation.

Slides:



Advertisements
Similar presentations
Exploration of advanced lighting and shading techniques
Advertisements

POST-PROCESSING SET09115 Intro Graphics Programming.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L (Wreckless)
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Graphics Pipeline.
GAM532 DPS932 – Week 7 Introduction to shadows. Shadow Effects Light Surface No Shadows Shadows.
The Art and Technology Behind Bioshock’s Special Effects
Projective Texture Mapping
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
9/25/2001CS 638, Fall 2001 Today Shadow Volume Algorithms Vertex and Pixel Shaders.
CS 4363/6353 INTRODUCTION TO COMPUTER GRAPHICS. WHAT YOU’LL SEE Interactive 3D computer graphics Real-time 2D, but mostly 3D OpenGL C/C++ (if you don’t.
Skin Rendering GPU Graphics Gary J. Katz University of Pennsylvania CIS 665 Adapted from David Gosselin’s Power Point and article, Real-time skin rendering,
Status – Week 277 Victor Moya.
1 Lecture 9 Lighting Light Sources Reflectance Camera Models.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
GAM531 DPS931 – Week 5 The Scene. Reviewing the Engine Engine DX11 Device GL 4.3 Device ControllerManagerModel DX11 Object GL 4.3 Object DX 11 API GL.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
Foundations of Computer Graphics (Fall 2012) CS 184, Lectures 13,14: Reviews Transforms, OpenGL
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Real-time Shadow Mapping. Shadow Mapping Shadow mapping uses two-pass rendering - render depth texture from the light ’ s point-of-view - render from.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
GAM532 DPS932 – Week 2 Vertex Shaders. The Shader Pipeline Vertex Processing Primitive Assembly / Processing Rasterization Fragment Process Pixel Output.
Shadows. Shadows is important in scenes, consolidating spatial relationships “Geometric shadows”: the shape of an area in shadow Early days, just pasted.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Hardware-accelerated Rendering of Antialiased Shadows With Shadow Maps Stefan Brabec and Hans-Peter Seidel Max-Planck-Institut für Informatik Saarbrücken,
CS418 Computer Graphics John C. Hart
Advanced Computer Graphics Shadow Techniques CO2409 Computer Graphics Week 20.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
2009 GRAPHICS : PROJECT 1 BASED ON DX9 BASICS. Documented by Dongjoon Kim SNU CS Ph.D Course Student Contact : NOTE.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
The Graphics Pipeline Revisited Real Time Rendering Instructor: David Luebke.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Revision Sheet Computer Graphics and Human Interaction By Dr. HANY ELSALAMONY1.
Introduction to Computer Graphics
Computer Graphics Overview
Reflective Shadow Mapping By: Mitchell Allen.
Programmable Pipelines
Deferred Lighting.
Robust Shadow Maps for Large Environments
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
Models and Architectures
Introduction to Computer Graphics with WebGL
Lighting.
Real-time Rendering Shadow Maps
UMBC Graphics for Games
UMBC Graphics for Games
ICG 2018 Fall Homework1 Guidance
with Applications in Computer Graphics
Chapter XV Shadow Mapping
Frame Buffer Applications
Frame Buffers Fall 2018 CS480/680.
Presentation transcript:

GAM532 DPS932 – Week 8 Texture Shadow Implementation

Depth Texture Shadows Basics Render scene depth from each light Render Scene from main camera for each light Compare depth from light’s depth target to each fragment

Binding Light Camera Values Render scene depth from each light Bind each shadow camera to a depth target (no color needed) struct Light { float4 diffuse; float4 specular; float3 attenuation; float3 spot; }; Texture2D shadowTex : register(t0); SamplerState shadowSamp : register(s0); Bind each depth target to a slot in the shader

Bridging the Gap Rendering scene from the main camera Read from texture bound to shadow camera Must find a way to transform from one space to the next Main Camera’s View Space Shadow Camera’s Clip-To-Texture Space

What We Need To Find Main Camera’s View Space Fragment Position Shadow Camera’s View Space Fragment Position Main Camera’s View Space Fragment Position Main Camera’s View Space Light Transformation Inverse FragPos * InvLightMat

Inversion of Orthographic Matrices Origin Orthographic Matrix | | | | | | | | | | | | | | | | Inverse Translation Matrix Inverse Translation + Identity * | | | | | | | | Inverse Orthographic Matrix = | | | | | | | | Inverse Rotational Matrix Transpose Rotation - Translation

From View Space to Clip Space struct Light { float4x4 shadowProjection; float4 diffuse; float4 specular; float3 attenuation; float3 spot; }; Texture2D shadowTex : register(t0); SamplerState shadowSamp : register(s0); Shadow Camera’s View Space Fragment Position Shadow Camera Projection Transformation FragPos * shadowProjection

Clip Space To Texture Coordinate Shadow Camera’s Clip Space Fragment Position [ ] [ x/w y/w z/w w/w] [ ] 1 1 Screen Coordinates Texture Coordinates [ ] X Y Depth U V Depth Screen Coordinates of Fragment with Depth [ ] [ x/2+0.5 y/2+0.5 z ] [ ] Texture Coordinates of Fragment with Depth

Testing Depth [ ] U V Depth Texture Coordinates of Fragment with Depth Sample Depth from Shadow Texture Is sampled depth lower than the calculated depth of the fragment? Yes No The light hit a different object first, shadow casted on fragment, fragment is not lit The light hit the surface of the object, no shadow casted on fragment, fragment is lit

Adding All Lights Together ++ = Each light contributes to an object Shadows only block one light Single object can project many shadows

Final Result Translucency effects easily added Expensive (re-render scene for each light) Self Shadowing Dynamically changing Shadow Detail limited by texture size High Detail (texture limited) Point lights are very expensive to cast shadows from (6 renders per light)

Shadow Texture Notes Point lights require up to 6 shadow textures to map out (don’t do it) Point and spot lights radiate light in many directions Directional lights work in one direct and require an orthographic camera

Depth Fighting Shadow Acne Shadow AcneNo Acne Floating point precision issue > > ??? > ??? ??? > ???

Alias Reduction Texture resolution can cause aliasing Sampling adjacent texels and blending can soften shadows float2 poissonDisk[4] = { float2( , ), float2( , ), float2( , ), float2( , ) ); for (int i=0; i<4; i++) { if(texture2D(shadowTex, shadow.xy + poissonDisk[i]/700.0).z<ShadowCoord.z-bias ){ visibility-=0.2; }

Graphics Section Complete Audio Next…

To Do Begin work on your enhancement Begin work on OpenGL labs Prepare for Mid-term (for real this time, I’m not pushing back again)