Frame Buffers Fall 2018 CS480/680.

Slides:



Advertisements
Similar presentations
POST-PROCESSING SET09115 Intro Graphics Programming.
Advertisements

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
COMPUTER GRAPHICS CS 482 – FALL 2014 NOVEMBER 10, 2014 GRAPHICS HARDWARE GRAPHICS PROCESSING UNITS PARALLELISM.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Graphics Pipeline.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
GAM532 DPS932 – Week 7 Introduction to shadows. Shadow Effects Light Surface No Shadows Shadows.
Week 11 - Wednesday.  Image based effects  Skyboxes  Lightfields  Sprites  Billboards  Particle systems.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
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.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
The programmable pipeline Lecture 10 Slide Courtesy to Dr. Suresh Venkatasubramanian.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Programming Concepts. Derive a new class from Activity of the framework Prepare the data beforehand, e.g., vertices, colours, normal vectors, texture.
Geometric Objects and Transformations. Coordinate systems rial.html.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
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.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Week 10 - Wednesday.  What did we talk about last time?  Shadow volumes and shadow mapping  Ambient occlusion.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
Gene Au-yeung, Daniel Quach, Jeffrey Su, Albert Wang, Jessica Wang, David Woo.
Intro. to Advanced Lighting, Basic Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, April.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Image Synthesis Rabie A. Ramadan, PhD 4. 2 Review Questions Q1: What are the two principal tasks required to create an image of a three-dimensional scene?
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics.
 Learn some important functions and process in OpenGL ES  Draw some triangles on the screen  Do some transformation on each triangle in each frame.
Ray Tracing using Programmable Graphics Hardware
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.
Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Siggraph 2009 RenderAnts: Interactive REYES Rendering on GPUs Kun Zhou Qiming Hou Zhong Ren Minmin Gong Xin Sun Baining Guo JAEHYUN CHO.
Our Graphics Environment Landscape Rendering. Hardware  CPU  Modern CPUs are multicore processors  User programs can run at the same time as other.
Introduction to Computer Graphics
Visible Surface Detection
COMPUTER GRAPHICS CHAPTER 38 CS 482 – Fall 2017 GRAPHICS HARDWARE
Discrete Techniques.
Reflective Shadow Mapping By: Mitchell Allen.
Week 2 - Friday CS361.
Week 11 - Wednesday CS361.
Patrick Cozzi University of Pennsylvania CIS Fall 2013
Graphics Processing Unit
Deferred Lighting.
Introduction to OpenGL
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Introduction to Computer Graphics with WebGL
Advanced Menuing, Introduction to Picking
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Graphics Processing Unit
UMBC Graphics for Games
Texture and Shadow Mapping
Computer Graphics Introduction to Shaders
03 | Creating, Texturing and Moving Objects
Introduction to OpenGL
Frame Buffer Applications
OpenGL-Rendering Pipeline
Presentation transcript:

Frame Buffers Fall 2018 CS480/680

An OpenGL pipeline Retrospective Stuff we know in detail Stuff we briefly talked about ???

What are Frame Buffers?

Frame Buffers They hold data about the current frame While a Frame Buffer is called a buffer, it is actually a collection of buffers that store the actual fragment data (like a folder of images) There are 3 main types of buffers stored in the Frame Buffer: Color Buffer Stencil Buffer Depth Buffer

Buffer Types Color Buffer Stores data about the color of each pixel in a frame Usually stored as 4 bytes (RGBA) Depth Buffer Stores data about the depth of each pixel in a frame Usually stored as a float Ranges from 0.0 (the near place) to 1.0 (the far plane) Stencil Buffer Stores data about whether or not the pixel should be rendered While stored as a byte, the stencil buffer is effectively used as a boolean value

Frame Buffers in our engine While there are no references to a frame buffer in code, we are implicitly writing to the most important Frame Buffer: the screen Imagine an invisible ‘glBindFramebuffer(GL_FRAMEBUFFER, 0)’ being called every time we call our render function All the code in Window.cpp is what sets up Framebuffer 0 (the back buffer for the screen)

What can we use frame buffers for? While OpenGL has a data type for creating buffers that won’t be seen (Render Buffers)... we can make the buffers Textures as well Since we store data like a texture, we can sample it like a texture This allows us to do effects originally impossible in our current engine, such as mirrors, shadows, refraction, and portals

Example in Industry: Half-Life 2 The Source Engine (HL2’s engine) uses frame buffers to generate textures from a camera in the world, known as “Render Targets:” Screenshots of Half-Life 2, Courtesy of Valve Corporation. All rights reserved.

Post-Processing Shaders

Why Post Processing Shaders? Problem: For each fragment in the fragment shader, I want to sample the pixels around me Issue: The GPU calculates stuff in parallel; the issue is, we don’t know when each calculation is finished Each fragment is treated as an independent calculation We don’t even know if the fragments around us have finished rendering! Solution: Store the finished fragments into a buffer and wait until all fragments have finished Use another pass to modify the finished fragments

High Level Overview Render scene to an offscreen texture Draw a quad that covers the entire screen Use the rendered scene as a texture input

Why this works: Screen Coordinates Without matrices, everything would be stretched and out of place, since we’re rendering using screen coordinates. We can use this to our advantage to draw a screen fitting quad

High Level Overview: Creating a Frame Buffer In the same fashion as creating other buffers in OpenGL, we have to: glGenFramebuffers to allocate a space in GPU space glBindFramebuffer to use the FrameBuffer glFramebufferTexture / glFramebufferRenderbuffer to add our data Because a Frame buffer is a container for buffers, we need to first initialize the Textures and Render Buffers we attached to the Frame Buffer NOTE: A Frame Buffer must have at least one Color buffer attached to be usable

Learning By Example

Questions?