Lab 3 Shadow Mapping. Giuseppe Maggiore

Size: px
Start display at page:

Download "Lab 3 Shadow Mapping. Giuseppe Maggiore"

Transcription

1 Lab 3 Shadow Giuseppe Maggiore

2 Adding Shadows to the Scene

3 First we need to declare a very useful helper object that will allow us to draw textures to the screen without creating a quad vertex buffer // A sprite batch is an XNA helper for drawing textures on the screen; it // is very useful to visualize intermediate computations and implementing // simple viewports. SpriteBatch sprite_batch;

4 The sprite batch is initialized by passing it the graphics device // We initialize the sprite batch sprite_batch = new SpriteBatch(GraphicsDevice);

5 We need a place where we can store the rays we will cast from the light; since all the rays are parallel to the light direction, we just store their length in a texture // We need a render target, that is a texture that can be used as a destination for // a rendering operation. This way we can draw the scene from the POV of the light // and store the depth of each direction starting from the light. RenderTarget2D shadow_map; // A render target needs a depth-stencil buffer of the same size. Since our render // target has a different size than the screen, we cannot use the default depth // buffer. DepthStencilBuffer shadow_depth;

6 We can create the shadow map and its associated depth buffer by calling their constructors and specifying the desired size and format // We create a 1024x1024 render target and depth buffer. The two must have the same bit // depth: single (a float32) is 4 bytes, and Depth24Stencil8 is 4 bytes too int shadow_size = 1024; shadow_map = new RenderTarget2D(GraphicsDevice, shadow_size, shadow_size, 1, SurfaceFormat.Single); shadow_depth = new DepthStencilBuffer(GraphicsDevice, shadow_size, shadow_size, DepthFormat.Depth24Stencil8);

7 When creating the shadow map, we first save a reference to the previous depth buffer, and then we set our depth buffer and the shadow map as a render target: all subsequent rendering operations will write the shadow map pixels // We store the previous depth buffer var depth = GraphicsDevice.DepthStencilBuffer; // We set our render target and our depth buffer GraphicsDevice.DepthStencilBuffer = shadow_depth; GraphicsDevice.SetRenderTarget(0, shadow_map);

8 We create view and projection matrices for drawing the scene from the point of view of the light the view matrix is relatively straightforward to compute: Matrix.CreateLookAt will suffice the projection matrix should be treated with more care: it should fit the scene as tightly as possible; if the projection covers too much (zmin that is too small or zmax too big) then huge precision errors will occur

9

10 To draw the scene, we start by restoring the original depth buffer and render target (otherwise nothing will appear on the screen since rendering will fill the shadow map) // We restore the initial depth buffer and the default render target. GraphicsDevice.DepthStencilBuffer = depth; GraphicsDevice.SetRenderTarget(0, null);

11

12 We can also draw the shadow map itself to see what is going in it // We can draw the shadow map on top of the screen, for debugging // purposes. sprite_batch.begin(spriteblendmode.alphablend, SpriteSortMode.Immediate, SaveStateMode.SaveState); sprite_batch.draw(shadow_map.gettexture(), new Rectangle(200, 0, 200, 200), Color.White); sprite_batch.end();

13 The shaders parameters are various matrices (scene seen from the camera and from the light) // Regular world, view and projection matrices float4x4 World; float4x4 CameraView; float4x4 CameraProjection; // View and projection matrices that define the // scene seen from the POV of the light. float4x4 LightView; float4x4 LightProjection; float4 DiffuseColor;

14 Also, the shadow map as a texture is needed for accessing the depth data // Texture that stores the minimum z-distances // of various pixels from the light. texture ShadowMapTexture; // Sample to read values from ShadowMapTexture sampler shadow_map_sampler = sampler_state { Texture = <ShadowMapTexture>; MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = Clamp; AddressV = Clamp; };

15 We have two vertex shaders: one for outputting the depth of each pixel from the camera, and another for drawing with shadows; the two shaders outputs are: // Input vertex is just a position, so we don't need // to declare it as a struct. Output vertex for shadow // mapping contains the transformed position and the // original world position (which the pixel shader will // transform with the light view and projection). struct VS_OUTPUT { float4 Position : POSITION0; float4 vpos : TEXCOORD0; }; // Output vertex for shadow map construction: it // contains the transformed position and the depth of // the pixel. struct VS_SHADOW_OUTPUT { float4 Position : POSITION; float Depth : TEXCOORD0; };

16 A very useful function is the one which transforms a vertex by the light viewpoint: // Helper function that transforms a position by the // light viewpoint. float4 GetPositionFromLight(float4 position) { float4x4 wvp = mul(mul(world, LightView), LightProjection); return mul(position, wvp); }

17 One vertex shader simply outputs the position and the depth

18 The corresponding pixel shader simply outputs the depth: // When outputting the depth from the light, the // pixel shader returns a fake color which will // be ignored apart from the first component, // which will be stored in the single float // of our render target (the shadow map). float4 RenderShadowMapPS( VS_SHADOW_OUTPUT In ) : COLOR0 { return float4(in.depth.x,0,0,1); }

19 The vertex shader that outputs the position for computing the shadow is quite simple: // Vertex shader that outputs the transformed position // and the original position. VS_OUTPUT RenderShadowsVS(float4 position : POSITION0) { VS_OUTPUT Output; float4x4 wvp = mul(mul(world, CameraView), CameraProjection); Output.Position = mul(position, wvp); Output.vPos = position; return Output; }

20 The pixel shader that computes the shadow begins by transforming the original position by the light viewpoint

21 Then we read from the shadow map the depth of the shadow along the ray that goes from this vertex to the light

22 Now we compute our distance from the light and compare it with the shadow depth

23 Remember: two shaders require two techniques: technique ShadowRender { pass P0 { VertexShader = compile vs_2_0 RenderShadowsVS(); PixelShader= compile ps_2_0 RenderShadowsPS(); } } technique ShadowMapRender { pass P0 { VertexShader = compile vs_2_0 RenderShadowMapVS(); PixelShader= compile ps_2_0 RenderShadowMapPS(); } }

24 THAT S IT: GOOD LUCK!

DirectX Programming #4. Kang, Seongtae Computer Graphics, 2009 Spring

DirectX Programming #4. Kang, Seongtae Computer Graphics, 2009 Spring DirectX Programming #4 Kang, Seongtae Computer Graphics, 2009 Spring Programmable Shader For recent hardwares, vertex and pixel processing stage of the graphics pipeline is programmable Programmable Vertex

More information

Bloom effect - before. Bloom effect - after. Postprocessing. Motion blur in Valve s Portal - roll

Bloom effect - before. Bloom effect - after. Postprocessing. Motion blur in Valve s Portal - roll Bloom effect - before Postprocessing Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology 2 Bloom effect - after Motion blur in Valve s Portal - roll 3 http://www.valvesoftware.com/publications/2008/

More information

Lab 1 Sample Code. Giuseppe Maggiore

Lab 1 Sample Code. Giuseppe Maggiore Lab 1 Sample Code Giuseppe Maggiore Preliminaries using Vertex = VertexPositionColor; First we define a shortcut for the type VertexPositionColor. This way we could change the type of Vertices used without

More information

Shaders (some slides taken from David M. course)

Shaders (some slides taken from David M. course) Shaders (some slides taken from David M. course) Doron Nussbaum Doron Nussbaum COMP 3501 - Shaders 1 Traditional Rendering Pipeline Traditional pipeline (older graphics cards) restricts developer to texture

More information

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express Level: Intermediate Area: Graphics Programming Summary This document is an introduction to the series of samples,

More information

Shaders in Eve Online Páll Ragnar Pálsson

Shaders in Eve Online Páll Ragnar Pálsson Shaders in Eve Online Páll Ragnar Pálsson EVE Online Eve Online Trinity First released 2003 Proprietary graphics engine DirectX 9 (DX11 on its way) Shader Model 3 (4 & 5 in development) HLSL Turning this

More information

IWKS 3400 LAB 11 1 JK Bennett

IWKS 3400 LAB 11 1 JK Bennett IWKS 3400 LAB 11 1 JK Bennett This lab dives a little bit deeper into HLSL effects, particularly as they relate to lighting and shading. We will begin by reviewing some basic 3D principles, and then move

More information

Shader Programming and Graphics Hardware

Shader Programming and Graphics Hardware Shader Programming and Graphics Hardware Marries van de Hoef Graphics 2012/2013, 4 th quarter 1 Practicals The first assignment was about the basics What is going on behind the XNA functions? The second

More information

Sébastien Dominé, NVIDIA. CgFX

Sébastien Dominé, NVIDIA. CgFX Sébastien Dominé, NVIDIA CgFX Overview What is CgFX? CgFX runtime Production pipeline with CgFX CgFX Tools set Demo What is CgFX? Supports Microsoft.fx files Cg plus: Multi-pass Hardware fallbacks (techniques)

More information

Could you make the XNA functions yourself?

Could you make the XNA functions yourself? 1 Could you make the XNA functions yourself? For the second and especially the third assignment, you need to globally understand what s going on inside the graphics hardware. You will write shaders, which

More information

Shaders Part II. Traditional Rendering Pipeline

Shaders Part II. Traditional Rendering Pipeline Shaders Part II Doron Nussbaum Doron Nussbaum COMP 3501 - Shaders Part II 1 Traditional Rendering Pipeline Traditional pipeline (older graphics cards) restricts developer to texture and the 3-term lighting

More information

Shader Programming CgFX, OpenGL 2.0. Michael Haller 2003

Shader Programming CgFX, OpenGL 2.0. Michael Haller 2003 Shader Programming CgFX, OpenGL 2.0 Michael Haller 2003 Outline What is CgFX? CgFX runtime Production pipeline with CgFX CgFX Tools set OpenGL 2.0 What is CgFX? CgFX (C for Graphics Effekt File) Supports

More information

Understanding XNA Framework Performance. Shawn Hargreaves Software Development Engineer XNA Community Game Platform Microsoft

Understanding XNA Framework Performance. Shawn Hargreaves Software Development Engineer XNA Community Game Platform Microsoft Understanding XNA Framework Performance Shawn Hargreaves Software Development Engineer XNA Community Game Platform Microsoft Contents Graphics Offload to the GPU Understand Xbox 360 system calls SpriteBatch,

More information

Designing a Modern GPU Interface

Designing a Modern GPU Interface Designing a Modern GPU Interface Brooke Hodgman ( @BrookeHodgman) http://tiny.cc/gpuinterface How to make a wrapper for D3D9/11/12, GL2/3/4, GL ES2/3, Metal, Mantle, Vulkan, GNM & GCM without going (completely)

More information

SDK White Paper. Rainbows and Fogbows Adding Natural Phenomena

SDK White Paper. Rainbows and Fogbows Adding Natural Phenomena SDK White Paper Rainbows and Fogbows Adding Natural Phenomena WP-01410-001-v01 July 2004 Abstract This document describes a method to render rainbows, coronas, fogbows, and halos realistically with a 3D

More information

The Effects Framework. October 31, Composed of the following components:

The Effects Framework. October 31, Composed of the following components: Game Programming The Effects Framework October 31, 2005 Rendering Effect Composed of the following components: one ore more rendering passes a list of device states a vertex and/or pixel shader Effect

More information

Bringing AAA graphics to mobile platforms. Niklas Smedberg Senior Engine Programmer, Epic Games

Bringing AAA graphics to mobile platforms. Niklas Smedberg Senior Engine Programmer, Epic Games Bringing AAA graphics to mobile platforms Niklas Smedberg Senior Engine Programmer, Epic Games Who Am I A.k.a. Smedis Platform team at Epic Games Unreal Engine 15 years in the industry 30 years of programming

More information

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer Real-Time Rendering (Echtzeitgraphik) Michael Wimmer wimmer@cg.tuwien.ac.at Walking down the graphics pipeline Application Geometry Rasterizer What for? Understanding the rendering pipeline is the key

More information

Microsoft XNA 4.0 Game Development Cookbook

Microsoft XNA 4.0 Game Development Cookbook Microsoft XNA 4.0 Game Development Cookbook Over 35 intermediate-advanced recipes for taking your XNA development arsenal further Luke Drumm BIRMINGHAM - MUMBAI Microsoft XNA 4.0 Game Development Cookbook

More information

Blending Equation Blend Factors & Mode Transparency Creating an Alpha Channel Using DX Tex Tool Render Semi-Transparent Objects.

Blending Equation Blend Factors & Mode Transparency Creating an Alpha Channel Using DX Tex Tool Render Semi-Transparent Objects. Overview Blending Blend Factors & Mode Transparency Creating an Alpha Channel Using DX Tex Tool Render Semi-Transparent Objects 305890 Spring 2014 5/27/2014 Kyoung Shin Park Blending Allows us to blend

More information

The Application Stage. The Game Loop, Resource Management and Renderer Design

The Application Stage. The Game Loop, Resource Management and Renderer Design 1 The Application Stage The Game Loop, Resource Management and Renderer Design Application Stage Responsibilities 2 Set up the rendering pipeline Resource Management 3D meshes Textures etc. Prepare data

More information

Creating Real Shaders in FX Composer. Kevin Bjorke NVIDIA Corporation

Creating Real Shaders in FX Composer. Kevin Bjorke NVIDIA Corporation Creating Real Shaders in FX Composer Kevin Bjorke NVIDIA Corporation HLSL for both Artists and Programmers High-Level talk here at GDC Examples of what you can do in FX Composer Code details in these slides,

More information

Technical Report. Mesh Instancing

Technical Report. Mesh Instancing Technical Report Mesh Instancing Abstract What is Mesh Instancing? Before we talk about instancing, let s briefly talk about the way that most D3D applications work. In order to draw a polygonal object

More information

CS195V Week 9. GPU Architecture and Other Shading Languages

CS195V Week 9. GPU Architecture and Other Shading Languages CS195V Week 9 GPU Architecture and Other Shading Languages GPU Architecture We will do a short overview of GPU hardware and architecture Relatively short journey into hardware, for more in depth information,

More information

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane Rendering Pipeline Rendering Converting a 3D scene to a 2D image Rendering Light Camera 3D Model View Plane Rendering Converting a 3D scene to a 2D image Basic rendering tasks: Modeling: creating the world

More information

Geometry Shader - Silhouette edge rendering

Geometry Shader - Silhouette edge rendering Geometry Shader - Silhouette edge rendering Introduction This paper will describe the process of making an outline shader, using the Geometry Shader. The shader is designed for DirectX10 applications (and

More information

Shadows. Prof. George Wolberg Dept. of Computer Science City College of New York

Shadows. Prof. George Wolberg Dept. of Computer Science City College of New York Shadows Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce Shadow Algorithms Expand to projective textures 2 Flashlight in the Eye Graphics When do we not see

More information

Double-click on CS470_Lab09.zip and extract the contents of the archive into a subdirectory called CS470_Lab09

Double-click on CS470_Lab09.zip and extract the contents of the archive into a subdirectory called CS470_Lab09 Lab 9: Blending CS 470 Labs Lab 9 In our application thus far, we have used effects such as timers, user interaction, lighting, and textures. In this lab, we will combine all of these and introduce the

More information

XNA Climate Game Project

XNA Climate Game Project XNA Climate Game Project R.S.Corradin (1634496) Contents Introduction... 3 Purpose... 3 XNA... 3 Requirements... 3 The climate game - Hierarchy... 5 The basics working with models, terrain and sky... 6

More information

Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017

Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017 Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017 Abbott, Connor (cwa2112) Pan, Wendy (wp2213) Qinami, Klint (kq2129) Vaccaro, Jason (jhv2111) [System

More information

How to Work on Next Gen Effects Now: Bridging DX10 and DX9. Guennadi Riguer ATI Technologies

How to Work on Next Gen Effects Now: Bridging DX10 and DX9. Guennadi Riguer ATI Technologies How to Work on Next Gen Effects Now: Bridging DX10 and DX9 Guennadi Riguer ATI Technologies Overview New pipeline and new cool things Simulating some DX10 features in DX9 Experimental techniques Why This

More information

Working with Metal Overview

Working with Metal Overview Graphics and Games #WWDC14 Working with Metal Overview Session 603 Jeremy Sandmel GPU Software 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

Shadows & Decals: D3D10 techniques from Frostbite. Johan Andersson Daniel Johansson

Shadows & Decals: D3D10 techniques from Frostbite. Johan Andersson Daniel Johansson Shadows & Decals: D3D10 techniques from Frostbite Johan Andersson Daniel Johansson Single-pass Stable Cascaded Bounding Box Shadow Maps (SSCBBSM?!) Johan Andersson Overview» Basics» Shadowmap rendering»

More information

TentamensKod: (Ifylles av student) Tentamensdatum: Tid: 10:00 12:00. Hjälpmedel: Inga hjälpmedel

TentamensKod: (Ifylles av student) Tentamensdatum: Tid: 10:00 12:00. Hjälpmedel: Inga hjälpmedel Computer Graphics Provmoment: Ladokkod: Tentamen ges för: Teoretisk tentamen 21DG2B Systemarkitektprogrammet 7,5 högskolepoäng TentamensKod: (Ifylles av student) Tentamensdatum: 2017-05-29 Tid: 10:00 12:00

More information

Computer Graphics Shadow Algorithms

Computer Graphics Shadow Algorithms Computer Graphics Shadow Algorithms Computer Graphics Computer Science Department University of Freiburg WS 11 Outline introduction projection shadows shadow maps shadow volumes conclusion Motivation shadows

More information

Evolution of GPUs Chris Seitz

Evolution of GPUs Chris Seitz Evolution of GPUs Chris Seitz Overview Concepts: Real-time rendering Hardware graphics pipeline Evolution of the PC hardware graphics pipeline: 1995-1998: Texture mapping and z-buffer 1998: Multitexturing

More information

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today! Last Time? Real-Time Shadows Perspective-Correct Interpolation Texture Coordinates Procedural Solid Textures Other Mapping Bump Displacement Environment Lighting Textures can Alias Aliasing is the under-sampling

More information

Volume Shadows Tutorial Nuclear / the Lab

Volume Shadows Tutorial Nuclear / the Lab Volume Shadows Tutorial Nuclear / the Lab Introduction As you probably know the most popular rendering technique, when speed is more important than quality (i.e. realtime rendering), is polygon rasterization.

More information

Fur Shader GRAPHICS PROGRAMMING 2

Fur Shader GRAPHICS PROGRAMMING 2 Fur Shader GRAPHICS PROGRAMMING 2 2DAE5 - GAMEDEVELEPMENT Academiejaar : 2015-2016 Inhoudsopgave Introduction... 2 Shells... 2 Fins... 2 The process... 2 The shader... 3 General... 3 Matrices... 3 Light...

More information

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important?

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important? Last Time Modeling Transformations Illumination (Shading) Real-Time Shadows Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Graphics Pipeline Clipping Rasterization

More information

Shadows in Computer Graphics. by Björn Kühl im/ve University of Hamburg, Germany

Shadows in Computer Graphics. by Björn Kühl im/ve University of Hamburg, Germany Shadows in Computer Graphics by Björn Kühl im/ve University of Hamburg, Germany Importance of Shadows Shadows provide cues to the position of objects casting and receiving shadows to the position of the

More information

DH2323 DGI13 Lab 3 Rasterization

DH2323 DGI13 Lab 3 Rasterization DH2323 DGI13 Lab 3 Rasterization Raytracing is the simplest way of computing a 2D image of a 3D scene. It can be used to simulate all kinds of phenomena, much more than we implemented in the second lab.

More information

For example, could you make the XNA func8ons yourself?

For example, could you make the XNA func8ons yourself? 1 For example, could you make the XNA func8ons yourself? For the second assignment you need to know about the en8re process of using the graphics hardware. You will use shaders which play a vital role

More information

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality.

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality. Last Time Modeling Transformations Illumination (Shading) Real-Time Shadows Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Graphics Pipeline Clipping Rasterization

More information

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm 6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm In this assignment, you will add an interactive preview of the scene and solid

More information

XNA Game Studio 4.0.

XNA Game Studio 4.0. Getting Started XNA Game Studio 4.0 To download XNA Game Studio 4.0 itself, go to http://www.microsoft.com/download/en/details.aspx?id=23714 XNA Game Studio 4.0 needs the Microsoft Visual Studio 2010 development

More information

Shaders. Slide credit to Prof. Zwicker

Shaders. Slide credit to Prof. Zwicker Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?

More information

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting Last Time? Real-Time Shadows Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes Why are Shadows Important? Depth

More information

Programming Graphics Hardware

Programming Graphics Hardware Tutorial 5 Programming Graphics Hardware Randy Fernando, Mark Harris, Matthias Wloka, Cyril Zeller Overview of the Tutorial: Morning 8:30 9:30 10:15 10:45 Introduction to the Hardware Graphics Pipeline

More information

Deferred Rendering Due: Wednesday November 15 at 10pm

Deferred Rendering Due: Wednesday November 15 at 10pm CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 4 November 2, 2017 Deferred Rendering Due: Wednesday November 15 at 10pm 1 Summary This assignment uses the same application architecture

More information

XNA 4.0 RPG Tutorials. Part 5. The Tile Engine - Part 2

XNA 4.0 RPG Tutorials. Part 5. The Tile Engine - Part 2 XNA 4.0 RPG Tutorials Part 5 The Tile Engine - Part 2 I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of tutorials

More information

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image

More information

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system GRAPHICS PIPELINE 1 OUTLINE Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system 2 IMAGE FORMATION REVISITED Can we mimic the synthetic

More information

Next, we re going to specify some extra stuff related to our window such as its size and title. Add this code to the Initialize method:

Next, we re going to specify some extra stuff related to our window such as its size and title. Add this code to the Initialize method: IWKS 3400 LAB 7 1 JK Bennett This lab will introduce you to how to create terrain. We will first review some basic principles of 3D graphics, and will gradually add complexity until we have a reasonably

More information

Ch 10: Game Event Management. Quiz # 4 Discussion

Ch 10: Game Event Management. Quiz # 4 Discussion Ch 10: Game Event Management Quiz # 4 Discussion Moving the Camera Toggle between first and third person view Translate object Transformations ò Quaternion: rotation around arbitrary axis ò Advantages

More information

Blending. To blend (combine) the pixels. To render semi-transparent objects. Currently Rasterizing. Previous on the Back Buffer.

Blending. To blend (combine) the pixels. To render semi-transparent objects. Currently Rasterizing. Previous on the Back Buffer. Blending 4 th Week, 2009 Blending To blend (combine) the pixels To render semi-transparent objects Source Pixel p ij Currently Rasterizing Destination Pixel b ij Previous on the Back Buffer Opaque Teapot

More information

Getting fancy with texture mapping (Part 2) CS559 Spring Apr 2017

Getting fancy with texture mapping (Part 2) CS559 Spring Apr 2017 Getting fancy with texture mapping (Part 2) CS559 Spring 2017 6 Apr 2017 Review Skyboxes as backdrops Credits : Flipmode 3D Review Reflection maps Credits : NVidia Review Decal textures Credits : andreucabre.com

More information

Last Time. Reading for Today: Graphics Pipeline. Clipping. Rasterization

Last Time. Reading for Today: Graphics Pipeline. Clipping. Rasterization Last Time Modeling Transformations Illumination (Shading) Real-Time Shadows Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Visibility

More information

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Shadow Buffer Theory Observation:

More information

Visual C# 2010 Express

Visual C# 2010 Express Review of C# and XNA What is C#? C# is an object-oriented programming language developed by Microsoft. It is developed within.net environment and designed for Common Language Infrastructure. Visual C#

More information

Basics of GPU-Based Programming

Basics of GPU-Based Programming Module 1: Introduction to GPU-Based Methods Basics of GPU-Based Programming Overview Rendering pipeline on current GPUs Low-level languages Vertex programming Fragment programming High-level shading languages

More information

High-Precision Shading and Geometry. Kevin Bjorke NVIDIA Corporation

High-Precision Shading and Geometry. Kevin Bjorke NVIDIA Corporation High-Precision Shading and Geometry Kevin Bjorke NVIDIA Corporation CPU Power Drives GPU Tools Showing Today: Two NVIDIA Tools Melody Simplify Complex Geometry Calculate UV-coord charts Generate high-res

More information

Metal for OpenGL Developers

Metal for OpenGL Developers #WWDC18 Metal for OpenGL Developers Dan Omachi, Metal Ecosystem Engineer Sukanya Sudugu, GPU Software Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without

More information

Seminar: Assignment 1. Magnus Andersson

Seminar: Assignment 1. Magnus Andersson Seminar: Assignment 1 Magnus Andersson (magnusa@cs.lth.se) This seminar A lot of ground to cover... Assignment C++ crash course RenderChimp Assignment 1 1. Getting started 2. Building a Scene Graph 3.

More information

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský Real - Time Rendering Graphics pipeline Michal Červeňanský Juraj Starinský Overview History of Graphics HW Rendering pipeline Shaders Debugging 2 History of Graphics HW First generation Second generation

More information

Real-Time Shadows. MIT EECS 6.837, Durand and Cutler

Real-Time Shadows. MIT EECS 6.837, Durand and Cutler Real-Time Shadows Last Time? The graphics pipeline Clipping & rasterization of polygons Visibility the depth buffer (z-buffer) Schedule Quiz 2: Thursday November 20 th, in class (two weeks from Thursday)

More information

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y. COMP 4801 Final Year Project Ray Tracing for Computer Graphics Final Project Report FYP 15014 by Runjing Liu Advised by Dr. L.Y. Wei 1 Abstract The goal of this project was to use ray tracing in a rendering

More information

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics Why GPU? Chapter 1 Graphics Hardware Graphics Processing Unit (GPU) is a Subsidiary hardware With massively multi-threaded many-core Dedicated to 2D and 3D graphics Special purpose low functionality, high

More information

FX Composer 1.5. Chris Maughan

FX Composer 1.5. Chris Maughan FX Composer 1.5 Chris Maughan 1 NVIDIA FX Composer FX Composer empowers developers to create high performance shaders in an integrated development environment with real-time preview & optimization features

More information

HLSL Development Cookbook

HLSL Development Cookbook HLSL Development Cookbook Doron Feinstein Chapter No. 2 "Deferred Shading" In this package, you will find: A Biography of the author of the book A preview chapter from the book, Chapter NO.2 "Deferred

More information

Summed-Area Tables. And Their Application to Dynamic Glossy Environment Reflections Thorsten Scheuermann 3D Application Research Group

Summed-Area Tables. And Their Application to Dynamic Glossy Environment Reflections Thorsten Scheuermann 3D Application Research Group Summed-Area Tables And Their Application to Dynamic Glossy Environment Reflections Thorsten Scheuermann 3D Application Research Group Overview >Presenting work started by Justin Hensley, Ph.D. student

More information

Your logo here. October, 2017

Your logo here. October, 2017 October, 2017 Introduction Thomas Burnett CTO, founder, and primary investigator for FoVI3D. ~15 years experience developing rendering solutions and architectures for static and dynamic lightfield display

More information

Cg Toolkit. Cg 1.3 Release Notes. December 2004

Cg Toolkit. Cg 1.3 Release Notes. December 2004 Cg Toolkit Cg 1.3 Release Notes December 2004 Cg Toolkit Release Notes The Cg Toolkit allows developers to write and run Cg programs using a wide variety of hardware platforms and graphics APIs. Originally

More information

HARDWARE ACCELERATED 3D/2D RENDERING

HARDWARE ACCELERATED 3D/2D RENDERING HARDWARE ACCELERATED 3D/2D RENDERING Gergely Agnecz: agnegerg@gmail.com Norbert Zsolt Zentai: zenorbi@gmail.com Roland Takacs: rolland0208@hotmail.com WHERE WE CAME FROM HUNGARY (LOCATION) HUNGARY BUDAPEST,

More information

Computer Graphics - Treasure Hunter

Computer Graphics - Treasure Hunter Computer Graphics - Treasure Hunter CS 4830 Dr. Mihail September 16, 2015 1 Introduction In this assignment you will implement an old technique to simulate 3D scenes called billboarding, sometimes referred

More information

Lab 9 - Metal and Glass

Lab 9 - Metal and Glass Lab 9 - Metal and Glass Let the form of an object be what it may, light, shade, and perspective will always make it beautiful. -John Constable Prologue Support code: /course/cs1230/src/labs/lab09 This

More information

Real-Time Shadows. Last Time? Schedule. Questions? Today. Why are Shadows Important?

Real-Time Shadows. Last Time? Schedule. Questions? Today. Why are Shadows Important? Last Time? Real-Time Shadows The graphics pipeline Clipping & rasterization of polygons Visibility the depth buffer (z-buffer) Schedule Questions? Quiz 2: Thursday November 2 th, in class (two weeks from

More information

Heap Arrays and Linked Lists. Steven R. Bagley

Heap Arrays and Linked Lists. Steven R. Bagley Heap Arrays and Linked Lists Steven R. Bagley Recap Data is stored in variables Can be accessed by the variable name Or in an array, accessed by name and index Variables and arrays have a type Create our

More information

Soft Particles. Tristan Lorach

Soft Particles. Tristan Lorach Soft Particles Tristan Lorach tlorach@nvidia.com January 2007 Document Change History Version Date Responsible Reason for Change 1 01/17/07 Tristan Lorach Initial release January 2007 ii Abstract Before:

More information

Rendering Objects. Need to transform all geometry then

Rendering Objects. Need to transform all geometry then Intro to OpenGL Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform

More information

Low-Overhead Rendering with Direct3D. Evan Hart Principal Engineer - NVIDIA

Low-Overhead Rendering with Direct3D. Evan Hart Principal Engineer - NVIDIA Low-Overhead Rendering with Direct3D Evan Hart Principal Engineer - NVIDIA Ground Rules No DX9 Need to move fast Big topic in 30 minutes Assuming experienced audience Everything is a tradeoff These are

More information

Applications of Explicit Early-Z Z Culling. Jason Mitchell ATI Research

Applications of Explicit Early-Z Z Culling. Jason Mitchell ATI Research Applications of Explicit Early-Z Z Culling Jason Mitchell ATI Research Outline Architecture Hardware depth culling Applications Volume Ray Casting Skin Shading Fluid Flow Deferred Shading Early-Z In past

More information

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation Lecture 5 Vertex and Fragment Shaders-1 CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives The rendering pipeline and the shaders Data

More information

A Summoner's Tale MonoGame Tutorial Series. Chapter 3. Tile Engine and Game Play State

A Summoner's Tale MonoGame Tutorial Series. Chapter 3. Tile Engine and Game Play State A Summoner's Tale MonoGame Tutorial Series Chapter 3 Tile Engine and Game Play State This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The

More information

Rasterization Overview

Rasterization Overview Rendering Overview The process of generating an image given a virtual camera objects light sources Various techniques rasterization (topic of this course) raytracing (topic of the course Advanced Computer

More information

Interactive & Cross-platform development studio

Interactive & Cross-platform development studio Interactive & Cross-platform development studio Unity 2D Filters You're trying to create fancy effects for your Sprite 2D but don't know where to start? You heard about shaders but that's some dark magic

More information

CS452/552; EE465/505. Shadow Mapping in WebGL

CS452/552; EE465/505. Shadow Mapping in WebGL CS452/552; EE465/505 Shadow Mapping in WebGL 4-09 15 Outline! Shadow Mapping in WebGL Switching Shaders Framebuffer Objects (FBO) Read: Angel, Chapter 7: 7.12 Framebuffer Objects WebGL Programming Guide:

More information

CPSC 436D Video Game Programming

CPSC 436D Video Game Programming CPSC 436D Video Game Programming OpenGL/Shaders Opengl RENDERING PIPELINE Copyright: Alla Sheffer 1 Opengl RENDERING PIPELINE C/C++ OpenGL GLSL (automatic) (automatic) GLSL (automatic) opengl Low-level

More information

the gamedesigninitiative at cornell university Lecture 14 2D Sprite Graphics

the gamedesigninitiative at cornell university Lecture 14 2D Sprite Graphics Lecture 14 Drawing Images Graphics Lectures SpriteBatch interface Coordinates and Transforms Drawing Perspective Camera Projections Drawing Primitives Color and Textures Polygons 2 Drawing Images Graphics

More information

Optimizing DirectX Graphics. Richard Huddy European Developer Relations Manager

Optimizing DirectX Graphics. Richard Huddy European Developer Relations Manager Optimizing DirectX Graphics Richard Huddy European Developer Relations Manager Some early observations Bear in mind that graphics performance problems are both commoner and rarer than you d think The most

More information

OPENGL RENDERING PIPELINE

OPENGL RENDERING PIPELINE CPSC 314 03 SHADERS, OPENGL, & JS UGRAD.CS.UBC.CA/~CS314 Textbook: Appendix A* (helpful, but different version of OpenGL) Alla Sheffer Sep 2016 OPENGL RENDERING PIPELINE 1 OPENGL RENDERING PIPELINE Javascript

More information

Session 5.1. Writing Text

Session 5.1. Writing Text 1 Session 5.1 Writing Text Chapter 5.1: Writing Text 2 Session Overview Show how fonts are managed in computers Discover the difference between bitmap fonts and vector fonts Find out how to create font

More information

The Graphics Pipeline

The Graphics Pipeline The Graphics Pipeline Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel But you really want shadows, reflections, global illumination, antialiasing

More information

!" "!#$!"%!&% ' ( )) * ) )+( ( ))+ ))(, ) ( - +,./ )) ) ) $( -( 1), , ) ( -)) ') 5 ' +) 67 4 ) ' 8, ( ) ( 9 :! ; $) ) ; 5<4,4$6 ( =) >

! !#$!%!&% ' ( )) * ) )+( ( ))+ ))(, ) ( - +,./ )) ) ) $( -( 1), , ) ( -)) ') 5 ' +) 67 4 ) ' 8, ( ) ( 9 :! ; $) ) ; 5<4,4$6 ( =) > !" "!#$!"%!&% ' ( )) * ) )+( ( ))+ ))(, ) ( - +,./ )) ) ) ( ))) 0 $( -( 1),2, ) ( -))+- 3 4 ') 5 ' +) 67 4 ) ' 8, ( ) ( 9 :! ; $) ) ; 5 " + ) &)) >( ))( -*( /( *( 1 =?/+) *( : == ) + /))(

More information

DECLARATIVE AR IN THE WEB WITH XML3D & XFLOW. By Felix Klein

DECLARATIVE AR IN THE WEB WITH XML3D & XFLOW. By Felix Klein DECLARATIVE AR IN THE WEB WITH XML3D & XFLOW By Felix Klein 1 THE WEB IS READY FOR AR Fast JavaScript WebGL, WebCL getusermedia, WebRTC Geolocation, Orientation, Motion > Any Problem? WEBGL: POWERFUL AND

More information

Graphics Hardware. Instructor Stephen J. Guy

Graphics Hardware. Instructor Stephen J. Guy Instructor Stephen J. Guy Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability! Programming Examples Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability!

More information

Cg 2.0. Mark Kilgard

Cg 2.0. Mark Kilgard Cg 2.0 Mark Kilgard What is Cg? Cg is a GPU shading language C/C++ like language Write vertex-, geometry-, and fragmentprocessing kernels that execute on massively parallel GPUs Productivity through a

More information

CS 465 Program 5: Ray II

CS 465 Program 5: Ray II CS 465 Program 5: Ray II out: Friday 2 November 2007 due: Saturday 1 December 2007 Sunday 2 December 2007 midnight 1 Introduction In the first ray tracing assignment you built a simple ray tracer that

More information

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed 6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, 2003 2:40-4pm One hand-written sheet of notes allowed Name: 1 2 3 4 5 6 7 / 4 / 15 / 5 / 5 / 12 / 2 / 7 Total / 50 1 Animation [ /4]

More information

Multi-View Soft Shadows. Louis Bavoil

Multi-View Soft Shadows. Louis Bavoil Multi-View Soft Shadows Louis Bavoil lbavoil@nvidia.com Document Change History Version Date Responsible Reason for Change 1.0 March 16, 2011 Louis Bavoil Initial release Overview The Multi-View Soft Shadows

More information