Postprocessing and Deferred Rendering. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

Size: px
Start display at page:

Download "Postprocessing and Deferred Rendering. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology"

Transcription

1 Postprocessing and Deferred Rendering Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

2 Bloom effect - before 2

3 Bloom effect - after 3

4 Motion blur in Valve s Portal - roll GDC2008_PostProcessingInTheOrangeBox.pdf 4

5 Motion blur in Valve s Portal - falling GDC2008_PostProcessingInTheOrangeBox.pdf 5

6 Setup for Postprocessing struct appdata_img { float4 vertex : POSITION; half2 texcoord : TEXCOORD0; }; struct v2f_img { float4 pos : SV_POSITION; half2 uv : TEXCOORD0; }; v2f_img vert_img( appdata_img v ) { v2f_img o; o.pos = mul (UNITY_MATRIX_MVP, v.vertex); o.uv = v.texcoord; return o; } In UnityCG.cginc

7 Outline Shader (1) Shader "GPUXXOutlinerShader" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Speed ("Speed", float) = 1 } SubShader { Pass { ZTest Always Cull Off ZWrite Off CGPROGRAM #pragma vertex vert_img #pragma fragment frag #include "UnityCG.cginc" uniform sampler2d _MainTex; uniform float _Speed;

8 Outline Shader (2) float4 frag (v2f_img i) : COLOR { float4 original = tex2d(_maintex, i.uv); // original.r *= 0.5*(sin(_Speed * _Time.w) + 1); // original.b *= 0.5*(cos(_Speed * _Time.w) + 1); // return original.brga; float4 original_left = tex2d(_maintex, i.uv - float2(1.0 / _ScreenParams.x,0)); float4 original_right = tex2d(_maintex, i.uv + float2(1.0 / _ScreenParams.x,0)); float4 original_up = tex2d(_maintex, i.uv - float2(0,1.0 / _ScreenParams.y)); float4 original_down = tex2d(_maintex, i.uv + float2(0,1.0 / _ScreenParams.y)); float3 horiz_diff = original_left.rgb - original_right.rgb; float3 vert_diff = original_up.rgb - original_down.rgb; float3 outline = abs(horiz_diff) + abs(vert_diff); return(float4(lerp(outline,original, 0.5*(cos(_Speed * _Time.y) + 1)),1)); }

9 Outline Camera Script using UnityEngine; using System.Collections; [ExecuteInEditMode] [AddComponentMenu("GPUXX Effects/GPUXXOutliner")] [RequireComponent (typeof(camera))] public class GPUXXOutliner : MonoBehaviour { private Shader postprocshader; private Material postprocmat; public float speed; void Start() { postprocshader = Shader.Find("GPUXXOutlinerShader"); postprocmat = new Material(postprocShader); } void Update() { postprocmat.setfloat("_speed",speed); } void OnRenderImage (RenderTexture source, RenderTexture destination) { Graphics.Blit(source, destination, postprocmat); } }

10 DepthNormal Shader (1) Shader "GPUXXDepthNormalShader" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Speed ("Speed", float) = 1 } SubShader { Pass { ZTest Always Cull Off ZWrite Off CGPROGRAM #pragma vertex vert_img #pragma fragment frag #include "UnityCG.cginc" uniform sampler2d _CameraDepthNormalsTexture; uniform sampler2d _MainTex; uniform float _Speed;

11 DepthNormal Shader (2) float4 frag (v2f_img i) : COLOR { float4 original = tex2d(_maintex, i.uv); float4 enc = tex2d(_cameradepthnormalstexture, i.uv); float depth; float3 n, display_n; DecodeDepthNormal(enc, /* out */ depth, /* out */ n); display_n = 0.5 * (1 + n); return(float4(lerp(display_n,float3(1,1,1)* depth, 0.5*(cos(_Speed * _Time.y) + 1)),1)); }

12 DecodeDepthNormal inline void DecodeDepthNormal( float4 enc, out float depth, out float3 normal ) { depth = DecodeFloatRG (enc.zw); normal = DecodeViewNormalStereo (enc); } inline float DecodeFloatRG( float2 enc ) { float2 kdecodedot = float2(1.0, 1/255.0); return dot( enc, kdecodedot ); } inline float3 DecodeViewNormalStereo( float4 enc4 ) { float kscale = ; float3 nn = enc4.xyz*float3(2*kscale,2*kscale,0) + float3(-kscale,-kscale,1); float g = 2.0 / dot(nn.xyz,nn.xyz); float3 n; n.xy = g*nn.xy; n.z = g-1; return n; } In UnityCG.cginc

13 DecodeDepthNormal (1) #define DECODE_EYEDEPTH(i) LinearEyeDepth(i) // Z buffer to linear depth inline float LinearEyeDepth( float z ) { return 1.0 / (_ZBufferParams.z * z + _ZBufferParams.w); } In UnityCG.cginc

14 DepthNormal Camera Script public class GPUXXDepthNormalDemo : MonoBehaviour { private Shader postprocshader; private Material postprocmat; private Camera mycamera; public float speed; void Start() { postprocshader = Shader.Find("GPUXXDepthNormalShader"); postprocmat = new Material(postprocShader); mycamera = GetComponent<Camera> (); mycamera.depthtexturemode = DepthTextureMode.DepthNormals; if (speed <= 0) speed = 1; } void Update() { postprocmat.setfloat("_speed",speed); } void OnRenderImage(RenderTexture source, RenderTexture destination) { Graphics.Blit(source, destination, postprocmat); } }

15 Deferred Rendering Shader (1) Shader "GPUXXHackedDRShader" { Properties { // We don't really need these to be Properties since // they re set by a script _DiffColor ("Diff Color", Color) = (1,1,1,1) _SpecColor ("Spec Color", Color) = (1,1,1,1) _Shininess ("Shininess", Range(0.01,1)) = 0.7 _CameraData ("Camera Data", Vector) = (0,0,0,0) _lightposvs0 ("Light Position 0", Vector) = (0,0,0,0) _lightposvs1 ("Light Position 1", Vector) = (0,0,0,0) _lightposvs2 ("Light Position 2", Vector) = (0,0,0,0) _lightposvs3 ("Light Position 3", Vector) = (0,0,0,0) _lightposvs4 ("Light Position 4", Vector) = (0,0,0,0) _lightposvs5 ("Light Position 5", Vector) = (0,0,0,0) }

16 Deferred Rendering Shader (2) SubShader { Tags { "RenderType"="Opaque" } LOD 300 Pass { CGPROGRAM #include "UnityCG.cginc" #pragma target 3.0 #pragma vertex vert_img #pragma fragment frag uniform float4 _CameraData; uniform float4 _DiffColor, _SpecColor; uniform float _Shininess; uniform float4 _lightposvs0, _lightposvs1, _lightposvs2, _lightposvs3, _lightposvs4, _lightposvs5; uniform sampler2d _CameraDepthNormalsTexture;

17 Deferred Rendering Shader (3) float4 frag(v2f_img i) : COLOR { float3 normalvs; float4 enc = tex2d(_cameradepthnormalstexture, i.uv); float depth; float3 n; DecodeDepthNormal(enc, /* out */ depth, /* out */ normalvs); normalvs.z = -normalvs.z; normalvs = normalize(normalvs); float zrecon = DECODE_EYEDEPTH(depth); float2 xy_minus1to1 = (2 * i.uv ) - 1; float2 xyrecon = xy_minus1to1 * zrecon * _CameraData.xy; float3 posvs = float3(xyrecon,zrecon); // eye is at origin float3 eyedir = normalize(-posvs);

18 Deferred Rendering Shader (4) } // I hardcoded the light colors, which is a bad idea float3 lightdir = normalize(_lightposvs0.xyz - posvs); float3 halfdir = normalize(lightdir + eyedir); float diff = max(0,dot(normalvs, lightdir)); float spec = max(0,pow(dot(normalvs, halfdir),_shininess*128.0)); float4 col = float4(0.25,0,0.25,1) * (_SpecColor * spec + _DiffColor * diff); lightdir = normalize(_lightposvs1.xyz - posvs); halfdir = normalize(lightdir + eyedir); diff = max(0,dot(normalvs, lightdir)); spec = max(0,pow(dot(normalvs, halfdir),_shininess*128.0)); col += float4(0.25,0,0,1) * (_SpecColor * spec + _DiffColor * diff); return(float4(col.rgb,1));

19 Deferred Rendering Camera Script (1) [ExecuteInEditMode] [AddComponentMenu( "GPUXX Effects/GPUXXHackedDR")] [RequireComponent (typeof(camera))] public class GPUXXHackedDR : MonoBehaviour { public Material postmat; public Shader postshader; private Camera mycamera; private Vector4[] mylightposvs; Vector4 cameradata;

20 Deferred Rendering Camera Script (2) Start() { postshader = Shader.Find("GPUXXHackedDRShader"); postmat = new Material(postShader); mycamera = GetComponent<Camera> (); mycamera.depthtexturemode = DepthTextureMode.DepthNormals; mylightposvs = new Vector4[6]; }

21 Deferred Rendering Camera Script (3) void OnPreRender() { cameradata.y = Mathf.Tan(Mathf.Deg2Rad * mycamera.fieldofview / 2); cameradata.x = cameradata.y * mycamera.aspect; cameradata.z = mycamera.farclipplane - mycamera.nearclipplane; cameradata.w = mycamera.nearclipplane; postmat.setvector ("_CameraData", cameradata); postmat.setvector("_diffcolor",0.2f * Vector4.one); postmat.setvector("_speccolor",vector4.one); postmat.setfloat("_shininess",0.9f); }

22 Deferred Rendering Camera Script (4) void Update() { // an assortment of wandering lights // don't look for any logic here, you will find none... mylightposvs[0].z = 20 * Mathf.Sin (0.5f*Time.time); mylightposvs[1].y = * Mathf.Cos (0.6f*Time.time + 0.5f); mylightposvs[1].z = -2; mylightposvs[2].x = * Mathf.Sin (0.7f*Time.time); mylightposvs[2].y = * Mathf.Cos (0.4f*Time.time - 1f); mylightposvs[2].z = -2; mylightposvs[3].x = * Mathf.Cos (0.9f*Time.time f); mylightposvs[3].y = -1.5f + 20 * Mathf.Sin (0.3f*Time.time); mylightposvs[3].z = -2; mylightposvs[4].x = * Mathf.Cos (0.8f*Time.time f); mylightposvs[4].y = 4 + mylightposvs[4].x; mylightposvs[4].z = -2; mylightposvs[5].x = * Mathf.Sin (Time.time + 5f); mylightposvs[5].y = -3 + mylightposvs[5].x; mylightposvs[5].z = -2; }

23 Deferred Rendering Camera Script (5) void OnRenderImage (RenderTexture source, RenderTexture destination) { postmat.setvector("_lightposvs0",mylightposvs[0]); postmat.setvector("_lightposvs1",mylightposvs[1]); postmat.setvector("_lightposvs2",mylightposvs[2]); postmat.setvector("_lightposvs3",mylightposvs[3]); postmat.setvector("_lightposvs4",mylightposvs[4]); postmat.setvector("_lightposvs5",mylightposvs[5]); postmat.setvector("_cameradata",cameradata); Graphics.Blit(source, destination, postmat); }

Projective Textures & Shadow Mapping. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

Projective Textures & Shadow Mapping. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology Projective Textures & Shadow Mapping Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology What is projective texturing? An intuition for projective texturing

More information

Forward rendering. Unity 5's rendering paths. Which lights get what treatment?

Forward rendering. Unity 5's rendering paths. Which lights get what treatment? Unity 5's rendering paths Introduction to Surface Shaders Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology Deferred Shading: Deferred pass Forward Rendering:

More information

Learn the fundamentals of shader writing in unity in this complete tutorial series.

Learn the fundamentals of shader writing in unity in this complete tutorial series. Learn the fundamentals of shader writing in unity in this complete tutorial series. In this Unity tutorial series we will be giving you a basic introduction to shader scripting, showing you how to write

More information

Rendering 5 Multiple Lights

Rendering 5 Multiple Lights Catlike Coding Unity C# Tutorials Rendering 5 Multiple Lights Render multiple lights per object. Support different light types. Use light cookies. Compute vertex lights. Include spherical harmonics. This

More information

Surface Displacement moving vertices

Surface Displacement moving vertices Catlike Coding Unity C# Tutorials Surface Displacement moving vertices Adjust vertex positions on the GPU. Tessellate shadow geometry. Skip tessellating unseen triangles. This tutorial follow Tessellation

More information

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Shader Languages Currently 3 major shader languages Cg (Nvidia) HLSL (Microsoft) Derived from Cg GLSL (OpenGL) Main influences

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

Rendering 2 Shader Fundamentals

Rendering 2 Shader Fundamentals Catlike Coding Unity Tutorials Rendering Rendering 2 Shader Fundamentals Transform vertices. Color pixels. Use shader properties. Pass data from vertices to fragments. Inspect compiled shader code. Sample

More information

Computer Graphics Coursework 1

Computer Graphics Coursework 1 Computer Graphics Coursework 1 Deadline Deadline: 4pm, 24/10/2016 4pm 23/10/2015 Outline The aim of the coursework is to modify the vertex and fragment shaders in the provided OpenGL framework to implement

More information

Greeting I like to give you a Introduction to Shader Scripting within Unity Show how the shaders you use and how to adapt to your project Give you

Greeting I like to give you a Introduction to Shader Scripting within Unity Show how the shaders you use and how to adapt to your project Give you Greeting I like to give you a Introduction to Shader Scripting within Unity Show how the shaders you use and how to adapt to your project Give you basic understanding how they works Hope you can start

More information

OUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction

OUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction TEXTURE MAPPING 1 OUTLINE Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction 2 BASIC STRAGEGY Three steps to applying a texture 1. specify the texture

More information

Shader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures

Shader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures Shader Programming 1 Examples Daniel Wesslén, dwn@hig.se Per-pixel lighting Texture convolution filtering Post-processing, animated procedural textures Vertex displacement mapping Daniel Wesslén 1 Fragment

More information

CS179: GPU Programming

CS179: GPU Programming CS179: GPU Programming Lecture 4: Textures Original Slides by Luke Durant, Russel McClellan, Tamas Szalay Today Recap Textures What are textures? Traditional uses Alternative uses Recap Our data so far:

More information

rendering rasterization based rendering pipelined architecture, parallel mostly triangles (lines and points possible too)

rendering rasterization based rendering pipelined architecture, parallel mostly triangles (lines and points possible too) Rendering Scena 3D rendering Immagine screen buffer ( array 2D di pixel ) Rendering in games Real-time (20 or) 30 or 60 FPS Algorithm: rasterization based rendering Hardware based pipelined architecture,

More information

Computer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima.

Computer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima. Computer Graphics Lecture 02 Graphics Pipeline Edirlei Soares de Lima What is the graphics pipeline? The Graphics Pipeline is a special software/hardware subsystem

More information

Rendering 17 Mixed Lighting

Rendering 17 Mixed Lighting Catlike Coding Unity C# Tutorials Rendering 17 Mixed Lighting Bake only indirect light. Mix baked and realtime shadows. Deal with code changes and bugs. Support subtractive lighting. This is part 17 of

More information

3D Authoring Tool BS Content Studio supports Deferred Rendering for improved visual quality

3D Authoring Tool BS Content Studio supports Deferred Rendering for improved visual quality 3D Authoring Tool BS Content Studio supports Deferred Rendering for improved visual quality Oliver Neubauer Project Manager 02.07.2013 BS Content Studio BS Content Studio manages hundreds of lights WYSIWYG

More information

Specular Reflection. Lecture 19. Robb T. Koether. Hampden-Sydney College. Wed, Oct 4, 2017

Specular Reflection. Lecture 19. Robb T. Koether. Hampden-Sydney College. Wed, Oct 4, 2017 Specular Reflection Lecture 19 Robb T. Koether Hampden-Sydney College Wed, Oct 4, 2017 Robb T. Koether (Hampden-Sydney College) Specular Reflection Wed, Oct 4, 2017 1 / 22 Outline 1 Specular Reflection

More information

Computer Graphics with OpenGL ES (J. Han) Chapter 6 Fragment shader

Computer Graphics with OpenGL ES (J. Han) Chapter 6 Fragment shader Computer Graphics with OpenGL ES (J. Han) Chapter 6 Fragment shader Vertex and Fragment Shaders The inputs to the fragment shader Varyings: The per-vertex output variables produced by the vertex shader

More information

Opaque. Flowmap Generator 3

Opaque. Flowmap Generator   3 Flowmap Shaders Table of Contents Opaque... 3 FlowmapGenerator/Opaque/Water... 4 FlowmapGenerator /Opaque/Water Foam... 6 FlowmapGenerator /Opaque/Solid... 8 Edge Fade... 9 Depth Fog... 12 Opaque The opaque

More information

Sign up for crits! Announcments

Sign up for crits! Announcments Sign up for crits! Announcments Reading for Next Week FvD 16.1-16.3 local lighting models GL 5 lighting GL 9 (skim) texture mapping Modern Game Techniques CS248 Lecture Nov 13 Andrew Adams Overview The

More information

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Normal Mapping Store normals in texture

More information

Geometry Shaders. And how to use them

Geometry Shaders. And how to use them Geometry Shaders And how to use them OpenGL Pipeline (part of it) Vertex data Vertex shader Vertices Primitives Geometry shader Primitives Fragments Fragment shader Color Depth Stencil Vertex Data Attributes

More information

The Rasterization Pipeline

The Rasterization Pipeline Lecture 5: The Rasterization Pipeline Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2016 What We ve Covered So Far z x y z x y (0, 0) (w, h) Position objects and the camera in the world

More information

GUERRILLA DEVELOP CONFERENCE JULY 07 BRIGHTON

GUERRILLA DEVELOP CONFERENCE JULY 07 BRIGHTON Deferred Rendering in Killzone 2 Michal Valient Senior Programmer, Guerrilla Talk Outline Forward & Deferred Rendering Overview G-Buffer Layout Shader Creation Deferred Rendering in Detail Rendering Passes

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

XNA: The Big Picture Initialization phase

XNA: The Big Picture Initialization phase XNA: The Big Picture Initialization phase Initialize() Camera setup LoadContent() Texture load Model load Content Pipeline XNA 3-D API Basics Prof. Aaron Lanterman (Based on slides by Prof. Hsien-Hsin

More information

Efficient and Scalable Shading for Many Lights

Efficient and Scalable Shading for Many Lights Efficient and Scalable Shading for Many Lights 1. GPU Overview 2. Shading recap 3. Forward Shading 4. Deferred Shading 5. Tiled Deferred Shading 6. And more! First GPU Shaders Unified Shaders CUDA OpenCL

More information

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015 WebGL and GLSL Basics CS559 Fall 2015 Lecture 10 October 6, 2015 Last time Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33

More information

Game Design From Concepts To Implementation

Game Design From Concepts To Implementation Game Design From Concepts To Implementation Giacomo Cappellini - g.cappellini@mixelweb.it Why Unity - Scheme Unity Editor + Scripting API (C#)! Unity API (C/C++)! Unity Core! Drivers / O.S. API! O.S.!

More information

-=Bui Tuong Phong's Lighting=- University of Utah, but with shaders. Anton Gerdelan Trinity College Dublin

-=Bui Tuong Phong's Lighting=- University of Utah, but with shaders. Anton Gerdelan Trinity College Dublin -=Bui Tuong Phong's Lighting=- University of Utah, 1973 but with shaders Anton Gerdelan Trinity College Dublin Before we do anything - normals Q. What does a normal do? Q. How do we usually calculate them?

More information

Ambient Occlusion. Ambient Occlusion (AO) "shadowing of ambient light "darkening of the ambient shading contribution

Ambient Occlusion. Ambient Occlusion (AO) shadowing of ambient light darkening of the ambient shading contribution Slides modified from: Patrick Cozzi University of Pennsylvania CIS 565 - Fall 2013 (AO) "shadowing of ambient light "darkening of the ambient shading contribution "the crevices of the model are realistically

More information

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Programmable Shaders //per vertex inputs from main attribute aposition; attribute anormal; //outputs to frag. program varying

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

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI Tutorial on GPU Programming #2 Joong-Youn Lee Supercomputing Center, KISTI Contents Graphics Pipeline Vertex Programming Fragment Programming Introduction to Cg Language Graphics Pipeline The process to

More information

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Texture Mapping CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce Mapping Methods - Texture Mapping - Environment Mapping - Bump Mapping Consider

More information

Shader Programming. Daniel Wesslén, Stefan Seipel, Examples

Shader Programming. Daniel Wesslén, Stefan Seipel, Examples Shader Programming Daniel Wesslén, dwn@hig.se Stefan Seipel, ssl@hig.se Examples 1 Per-pixel lighting Texture convolution filtering 2 Post-processing, animated procedural textures Vertex displacement mapping

More information

Applying Textures. Lecture 27. Robb T. Koether. Hampden-Sydney College. Fri, Nov 3, 2017

Applying Textures. Lecture 27. Robb T. Koether. Hampden-Sydney College. Fri, Nov 3, 2017 Applying Textures Lecture 27 Robb T. Koether Hampden-Sydney College Fri, Nov 3, 2017 Robb T. Koether (Hampden-Sydney College) Applying Textures Fri, Nov 3, 2017 1 / 24 Outline 1 Applying Textures 2 Photographs

More information

Relief Mapping in a Pixel Shader using Binary Search Policarpo, Fabio

Relief Mapping in a Pixel Shader using Binary Search Policarpo, Fabio Relief Mapping in a Pixel Shader using Binary Search Policarpo, Fabio (fabio@paralelo.com.br) 1. Introduction The idea of this shader (called Relief Mapping) is to implement a better quality Bump Mapping

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

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October WebGL and GLSL Basics CS559 Fall 2016 Lecture 14 October 24 2016 Review Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33

More information

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp Next-Generation Graphics on Larrabee Tim Foley Intel Corp Motivation The killer app for GPGPU is graphics We ve seen Abstract models for parallel programming How those models map efficiently to Larrabee

More information

INFOGR Computer Graphics

INFOGR Computer Graphics INFOGR Computer Graphics Jacco Bikker & Debabrata Panja - April-July 2017 Lecture 10: Shaders Welcome! INFOGR2016/17 Today s Agenda: Recap: Diffuse Materials The Phong Shading Model Environment

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

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing) ME 290-R: General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing) Sara McMains Spring 2009 Performance: Bottlenecks Sources of bottlenecks CPU Transfer Processing Rasterizer

More information

11 - Bump Mapping. Bump-Mapped Objects. Bump-Mapped Objects. Bump-Mapped Objects. Limitations Of Texture Mapping. Bumps: Perturbed Normals

11 - Bump Mapping. Bump-Mapped Objects. Bump-Mapped Objects. Bump-Mapped Objects. Limitations Of Texture Mapping. Bumps: Perturbed Normals CSc 155 Advanced Compter Graphics Limitations Of extre Mapping extre mapping paints srfaces o extre image is typically fixed Some characteristics are difficlt to textre o Roghness, Wrinkles extre illmination

More information

What is VertExmotion?

What is VertExmotion? by Kalagaan VertExmotion What is VertExmotion?...1 How to use it? (Tutorial)...2 Paint settings...3 Sensors settings...4 Sensor's link...7 How to setup the collision system?...8 How to setup the sensor's

More information

To Do. Demo for mytest3. Methodology for Lecture. Importance of Lighting. Brief primer on Color. Computer Graphics

To Do. Demo for mytest3. Methodology for Lecture. Importance of Lighting. Brief primer on Color. Computer Graphics Computer Graphics CSE 167 [Win 17], Lecture 7: OpenGL Shading Ravi Ramamoorthi http://viscomp.ucsd.edu/classes/cse167/wi17 To Do This week s lectures have all info for HW 2 Start EARLY Methodology for

More information

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008. CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions The Midterm Exam was given in class on Thursday, October 23, 2008. 1. [4 pts] Drawing Where? Your instructor says that objects should always be

More information

The Great Divide. Unique Visuals and Deterministic Gameplay in Homeworld: Deserts of Kharak Yossarian King CTO, Blackbird Interactive

The Great Divide. Unique Visuals and Deterministic Gameplay in Homeworld: Deserts of Kharak Yossarian King CTO, Blackbird Interactive For original slides (with notes) see tinyurl.com/dok-gdc17 The Great Divide Unique Visuals and Deterministic Gameplay in Homeworld: Deserts of Kharak Yossarian King CTO, Blackbird Interactive "How To Make

More information

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 6 Part 2 Lighting and Shading in OpenGL Matt Burlick - Drexel University - CS 430 1 OpenGL Shading Need Vertex Normals Material properties Lights Position of

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

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012. CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions The Midterm Exam was given in class on Tuesday, October 16, 2012. 1. [7 pts] Synthetic-Camera Model. Describe the Synthetic-Camera Model : how

More information

Relief mapping for urban and natural environments rendering

Relief mapping for urban and natural environments rendering Relief mapping for urban and natural environments rendering D. Janković * and Ž. Mihajlović ** * AVL/AST -- Advanced Simulation Technologies, Zagreb, Croatia ** University of Zagreb, Faculty of Electrical

More information

INFOGR Computer Graphics

INFOGR Computer Graphics INFOGR Computer Graphics Jacco Bikker & Debabrata Panja - April-July 2018 Lecture 10: Shaders Welcome! Ƹ Ƹ Ƹ x M final = T totorso R T down R = x y z 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Operations: 1. Translate

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

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

object (say a cube) will be made up of triangles, each with three vertices, each with known object coordinates.

object (say a cube) will be made up of triangles, each with three vertices, each with known object coordinates. hello world 3d: basic approach object (say a cube) will be made up of triangles, each with three vertices, each with known object coordinates. object coordinates of vertices will be put in an OpenGL buffer

More information

Overview. By end of the week:

Overview. By end of the week: Overview By end of the week: - Know the basics of git - Make sure we can all compile and run a C++/ OpenGL program - Understand the OpenGL rendering pipeline - Understand how matrices are used for geometric

More information

Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics. Sean Ellis Consultant Graphics Engineer ARM, Maidenhead

Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics. Sean Ellis Consultant Graphics Engineer ARM, Maidenhead Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics Sean Ellis Consultant Graphics Engineer ARM, Maidenhead Introduction M3G 1.x Recap ARM M3G Integration M3G 2.0 Update

More information

Multimedia Programming

Multimedia Programming Multimedia Programming Medialogy, 8 th Semester, Aalborg University Wednesday 6 June 2012, 09.00 12.00 Instructions and notes You have 3 hours to complete this examination. Neither written material nor

More information

Introduction to Shaders for Visualization. The Basic Computer Graphics Pipeline

Introduction to Shaders for Visualization. The Basic Computer Graphics Pipeline Introduction to Shaders for Visualization Mike Bailey The Basic Computer Graphics Pipeline Model Transform View Transform Per-vertex Lighting Projection Transform Homogeneous Division Viewport Transform

More information

CS 179 GPU Programming

CS 179 GPU Programming CS179: GPU Programming Lecture 7: Render to Texture Lecture originally by Luke Durant, Russell McClellan, Tamas Szalay 1 Today: Render to Texture Render to texture in OpenGL Framebuffers and renderbuffers

More information

Preparing for Texture Access. Stored Texture Shaders. Accessing Texture Maps. Vertex Shader Texture Access

Preparing for Texture Access. Stored Texture Shaders. Accessing Texture Maps. Vertex Shader Texture Access Stored Texture Shaders Preparing for Texture Access These steps are the same when using a shader as when using fixed functionality Make a specific texture unit active by calling glactivetexture Create

More information

Stored Texture Shaders

Stored Texture Shaders Stored Texture Shaders 157 Preparing for Texture Access These steps are the same when using a shader as when using fixed functionality Make a specific texture unit active by calling glactivetexture Create

More information

Rendering 13 Deferred Shading

Rendering 13 Deferred Shading Catlike Coding Unity C# Tutorials Rendering 13 Deferred Shading Explore deferred shading. Fill Geometry Buffers. Support both HDR and LDR. Work with Deferred Reflections. This is part 13 of a tutorial

More information

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel,

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel, EDAF80 Introduction to Computer Graphics Seminar 3 Shaders Michael Doggett 2017 Slides by Carl Johan Gribel, 2010-13 Today OpenGL Shader Language (GLSL) Shading theory Assignment 3: (you guessed it) writing

More information

Textures. Texture coordinates. Introduce one more component to geometry

Textures. Texture coordinates. Introduce one more component to geometry Texturing & Blending Prof. Aaron Lanterman (Based on slides by Prof. Hsien-Hsin Sean Lee) School of Electrical and Computer Engineering Georgia Institute of Technology Textures Rendering tiny triangles

More information

Graphics Processing Unit Architecture (GPU Arch)

Graphics Processing Unit Architecture (GPU Arch) Graphics Processing Unit Architecture (GPU Arch) With a focus on NVIDIA GeForce 6800 GPU 1 What is a GPU From Wikipedia : A specialized processor efficient at manipulating and displaying computer graphics

More information

Render all data necessary into textures Process textures to calculate final image

Render all data necessary into textures Process textures to calculate final image Screenspace Effects Introduction General idea: Render all data necessary into textures Process textures to calculate final image Achievable Effects: Glow/Bloom Depth of field Distortions High dynamic range

More information

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker CMSC427 Advanced shading getting global illumination by local methods Credit: slides Prof. Zwicker Topics Shadows Environment maps Reflection mapping Irradiance environment maps Ambient occlusion Reflection

More information

Point-Based rendering on GPU hardware. Advanced Computer Graphics 2008

Point-Based rendering on GPU hardware. Advanced Computer Graphics 2008 Point-Based rendering on GPU hardware Advanced Computer Graphics 2008 Outline Why use the GPU? Splat rasterization Image-aligned squares Perspective correct rasterization Splat shading Flat shading Gouroud

More information

CS559 Computer Graphics Fall 2015

CS559 Computer Graphics Fall 2015 CS559 Computer Graphics Fall 2015 Practice Midterm Exam Time: 2 hrs 1. [XX Y Y % = ZZ%] MULTIPLE CHOICE SECTION. Circle or underline the correct answer (or answers). You do not need to provide a justification

More information

CSE 4431/ M Advanced Topics in 3D Computer Graphics. TA: Margarita Vinnikov

CSE 4431/ M Advanced Topics in 3D Computer Graphics. TA: Margarita Vinnikov CSE 4431/5331.03M Advanced Topics in 3D Computer Graphics TA: Margarita Vinnikov mvinni@cse.yorku.ca Debugging Shaders Can't print a number from a shader, but you can "print" a colour, most of our value-checking

More information

Shadows. COMP 575/770 Spring 2013

Shadows. COMP 575/770 Spring 2013 Shadows COMP 575/770 Spring 2013 Shadows in Ray Tracing Shadows are important for realism Basic idea: figure out whether a point on an object is illuminated by a light source Easy for ray tracers Just

More information

A Trip Down The (2011) Rasterization Pipeline

A Trip Down The (2011) Rasterization Pipeline A Trip Down The (2011) Rasterization Pipeline Aaron Lefohn - Intel / University of Washington Mike Houston AMD / Stanford 1 This talk Overview of the real-time rendering pipeline available in ~2011 corresponding

More information

2D graphics with WebGL

2D graphics with WebGL 2D graphics with WebGL Some material contained here is adapted from the book s slides. September 7, 2015 (Dr. Mihail) 2D graphics September 7, 2015 1 / 22 Graphics Pipeline (Dr. Mihail) 2D graphics September

More information

Computer Graphics (CS 543) Lecture 8c: Environment Mapping (Reflections and Refractions)

Computer Graphics (CS 543) Lecture 8c: Environment Mapping (Reflections and Refractions) Computer Graphics (CS 543) Lecture 8c: Environment Mapping (Reflections and Refractions) Prof Emmanuel Agu (Adapted from slides by Ed Angel) Computer Science Dept. Worcester Polytechnic Institute (WPI)

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

3D buzzwords. Adding programmability to the pipeline 6/7/16. Bandwidth Gravity of modern computer systems

3D buzzwords. Adding programmability to the pipeline 6/7/16. Bandwidth Gravity of modern computer systems Bandwidth Gravity of modern computer systems GPUs Under the Hood Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology The bandwidth between key components

More information

SUMMARY. CS380: Introduction to Computer Graphics Texture Mapping Chapter 15. Min H. Kim KAIST School of Computing 18/05/03.

SUMMARY. CS380: Introduction to Computer Graphics Texture Mapping Chapter 15. Min H. Kim KAIST School of Computing 18/05/03. CS380: Introduction to Computer Graphics Texture Mapping Chapter 15 Min H. Kim KAIST School of Computing Materials SUMMARY 2 1 Light blob from PVC plastic Recall: Given any vector w (not necessarily of

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

Quick Shader 0.1 Beta

Quick Shader 0.1 Beta Quick Shader 0.1 Beta Documentation (last update 2014-07-10) QuickShader is a program that allows you to write and test shaders without creating your own rendering engine. Using this tool you can quickly

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

Optimized Rendering Techniques Based on Local Cubemaps

Optimized Rendering Techniques Based on Local Cubemaps Optimized Rendering Techniques Based on Local Cubemaps Roberto Lopez Mendez Senior Software Engineer, ARM ARM Game Developer Day - London 03/12/2015 Agenda The concept of local cubemaps Optimized rendering

More information

± (1./ResS, 1./ResT) Using Fragment Shaders to Manipulate Images. Image Basics. Image Negative. t = 1.

± (1./ResS, 1./ResT) Using Fragment Shaders to Manipulate Images. Image Basics. Image Negative. t = 1. Using Fragment Shaders to Manipulate Images 1 Image Basics t = 1. Mike Bailey mjb@cs.oregonstate.edu Treat the image as a texture. Index it using usual texture indexing (0. s,t 1.) If you need it, the

More information

Using Fragment Shaders to Manipulate Images

Using Fragment Shaders to Manipulate Images 1 Using Fragment Shaders to Manipulate Images Mike Bailey mjb@cs.oregonstate.edu image.pptx Image Basics t = 1. Treat the image as a texture. Index it using usual texture indexing (0. s,t 1.) If you need

More information

Using Fragment Shaders to Manipulate Images. Mike Bailey. Oregon State University. Image Basics. s = 0.

Using Fragment Shaders to Manipulate Images. Mike Bailey. Oregon State University. Image Basics. s = 0. 1 Using Fragment Shaders to Manipulate Images Mike Bailey mjb@cs.oregonstate.edu image.pptx Image Basics t = 1. Treat the image as a texture. Index it using usual texture indexing (0. s,t 1.) If you need

More information

Software Engineering. ò Look up Design Patterns. ò Code Refactoring. ò Code Documentation? ò One of the lessons to learn for good design:

Software Engineering. ò Look up Design Patterns. ò Code Refactoring. ò Code Documentation? ò One of the lessons to learn for good design: Software Engineering ò Look up Design Patterns ò Code Refactoring ò Code Documentation? ò One of the lessons to learn for good design: ò Coupling: the amount of interconnectedness between classes ò Cohesion:

More information

CS GPU and GPGPU Programming Lecture 3: GPU Architecture 2. Markus Hadwiger, KAUST

CS GPU and GPGPU Programming Lecture 3: GPU Architecture 2. Markus Hadwiger, KAUST CS 380 - GPU and GPGPU Programming Lecture 3: GPU Architecture 2 Markus Hadwiger, KAUST Reading Assignment #2 (until Feb. 9) Read (required): GLSL book, chapter 4 (The OpenGL Programmable Pipeline) GPU

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

Gettin Procedural. Jeremy Shopf 3D Application Research Group

Gettin Procedural. Jeremy Shopf 3D Application Research Group Gettin Procedural Jeremy Shopf 3D Application Research Group 1 Adding Procedural Content (30 mins) Basics Why should I care? Noise, etc. Procedural Surfaces Layered ice Procedural Geometry Growing icicles

More information

Advanced Deferred Rendering Techniques. NCCA, Thesis Portfolio Peter Smith

Advanced Deferred Rendering Techniques. NCCA, Thesis Portfolio Peter Smith Advanced Deferred Rendering Techniques NCCA, Thesis Portfolio Peter Smith August 2011 Abstract The following paper catalogues the improvements made to a Deferred Renderer created for an earlier NCCA project.

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

Google SketchUp/Unity Tutorial Basics

Google SketchUp/Unity Tutorial Basics Software used: Google SketchUp Unity Visual Studio Google SketchUp/Unity Tutorial Basics 1) In Google SketchUp, select and delete the man to create a blank scene. 2) Select the Lines tool and draw a square

More information

last time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders

last time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders last time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders calls to load vertex data to vertex buffers calls to load

More information

Game Graphics Programmers

Game Graphics Programmers Graphics INTRODUCTION - A Glimpse into what Game Graphics Programmers do - System level view of Graphics Architectures & Pipeline - Intro to Commonly used Rendering Techniques in Games Game Graphics Programmers

More information

Image Processing Tricks in OpenGL. Simon Green NVIDIA Corporation

Image Processing Tricks in OpenGL. Simon Green NVIDIA Corporation Image Processing Tricks in OpenGL Simon Green NVIDIA Corporation Overview Image Processing in Games Histograms Recursive filters JPEG Discrete Cosine Transform Image Processing in Games Image processing

More information

Project 1, 467. (Note: This is not a graphics class. It is ok if your rendering has some flaws, like those gaps in the teapot image above ;-)

Project 1, 467. (Note: This is not a graphics class. It is ok if your rendering has some flaws, like those gaps in the teapot image above ;-) Project 1, 467 Purpose: The purpose of this project is to learn everything you need to know for the next 9 weeks about graphics hardware. What: Write a 3D graphics hardware simulator in your language of

More information

Name. EE 4702 Final Exam. Friday, 7 December 2012, 12:30-14:30 CST. Exam Total. Alias. (100 pts) Good Luck!

Name. EE 4702 Final Exam. Friday, 7 December 2012, 12:30-14:30 CST. Exam Total. Alias. (100 pts) Good Luck! Name EE 4702 Final Exam Friday, 7 December 2012, 12:30-14:30 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (20 pts) (20 pts) (100 pts) Good Luck! Problem 1: [15 pts]the

More information