GAM531 DPS931 – Week 11 Render State. The Render State Render State BuffersShadersSamplers Rasterizer State Blend State.

Slides:



Advertisements
Similar presentations
15.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 15 – Visible Surfaces and Shadows.
Advertisements

Real-Time Rendering 靜宜大學資工研究所 蔡奇偉副教授 2010©.
O a polygon is a plane figure specified by a set of three or more coordinate positions, called vertices, that are connected in sequence by straight-Line.
3D Game Programming Geometric Transformations
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
OpenGL Fragment Operations
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
Computer Graphics(Fall 2003) COMS 4160, Lecture 7: OpenGL 3 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
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.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Status – Week 277 Victor Moya.
GPU Simulator Victor Moya. Summary Rendering pipeline for 3D graphics. Rendering pipeline for 3D graphics. Graphic Processors. Graphic Processors. GPU.
Status – Week 283 Victor Moya. 3D Graphics Pipeline Akeley & Hanrahan course. Akeley & Hanrahan course. Fixed vs Programmable. Fixed vs Programmable.
Status – Week 260 Victor Moya. Summary shSim. shSim. GPU design. GPU design. Future Work. Future Work. Rumors and News. Rumors and News. Imagine. Imagine.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
CHAPTER 4 Window Creation and Control © 2008 Cengage Learning EMEA.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Geometric Objects and Transformations. Coordinate systems rial.html.
GAM531 DPS931 – Week 10 Meshes and Buffers. Breaking Down An Image Actors Actors = Mesh + Material Mesh = Shape of the object.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
GAM532 DPS932 – Week 8 Texture Shadow Implementation.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
CS 4363/6353 OPENGL BACKGROUND. WHY IS THIS CLASS SO HARD TO TEACH? (I’LL STOP WHINING SOON) Hardware (GPUs) double in processing power ever 6 months!
CSE Real Time Rendering Week 2. Graphics Processing 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Review of OpenGL Basics
Accelerated Stereoscopic Rendering using GPU François de Sorbier - Université Paris-Est France February 2008 WSCG'2008.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Computer Graphics Bing-Yu Chen National Taiwan University.
1 3D API OPENGL ES v1.0 Owned by Silicon Graphics (SGL) Control was then transferred to Khronos Group Introduction.
OpenGL Architecture Display List Polynomial Evaluator Per Vertex Operations & Primitive Assembly Rasterization Per Fragment Operations Frame Buffer Texture.
Draw a Simple Object. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture blending.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics.
2009 GRAPHICS : PROJECT 1 BASED ON DX9 BASICS. Documented by Dongjoon Kim SNU CS Ph.D Course Student Contact : NOTE.
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.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS The GPU.
The Graphics Pipeline Revisited Real Time Rendering Instructor: David Luebke.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Introduction to OpenGL (INF 250) Veronika Solteszova et al., UiB Dept. of Informatics,
CS 4722 Made by Dr. Jeffrey Chastine Modified by Dr. Chao Mei
- Introduction - Graphics Pipeline
Draw a Simple Object.
The Graphic PipeLine
Graphics Processing Unit
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
Models and Architectures
Graphics Processing Unit
Chapter VII Rasterizer
Blending CSCI 440 textbook section 7.10
Chapter X Output Merger.
CS 480/680 Computer Graphics GLSL Overview.
OpenGL Background CS 4722.
OpenGL-Rendering Pipeline
CIS 6930: Chip Multiprocessor: GPU Architecture and Programming
Presentation transcript:

GAM531 DPS931 – Week 11 Render State

The Render State Render State BuffersShadersSamplers Rasterizer State Blend State

The Render Process Clear Buffer Update Graphic Context (per object) Draw Object (per object) Merge Output With Buffer (per object) Flip Back Buffer Send object’s position, camera’s projection etc to the graphics card Transform 3D object representations into 2D textures Combine the 2D output with the back buffer / render target ContextShaderBlend State

What The Blend State Does Blending On Blending Off

Color Model Unsigned Char Min: 0 Max: 255 Float Min: 0.0 Max: 1.0 Non-Alpha Color Red | Green | Blue Alpha Color Red | Green | Blue | Alpha [255,0,0][0,50,0][255,0,255] [255,255,255][0,0,0] [1.0,0,0,1.0][0.5,0.5,0,1.0] [1.0,1.0,0,0.5] [0,0,0,0.5]

Blending Parameters Operation Sources Factors (Source vs Destination) Add (D = S + D) Subtract (D = S – D) Reverse Subtract (D = D – S) Min (D = S < D ? S : D) Max (D = S > D ? S : D) Const Zero Const One Source Color Inverse Source Color Destination Color Inverse Destination Color

The Blend State Blend State Color Operation Source Color Destination Color Alpha Operation Source Alpha Destination Alpha Color Operation: Add Source: One Dest: One Alpha Operation: Add Source: One Dest: Zero [255,0,0,255] [0,255,0,255] + =

Programming Blend State _glBlend t; t.index = rt; //The render target t.enableFunc = //proxy function (Emperor code) t.blendOp = //Blend operation t.blendOpAlpha = //Blend operation t.destBlend = //Destination Color t.destBlendAlpha = //Destination Alpha t.srcBlend = //Source Color t.srcBlendAlpha = //Source Alpha //Nothing to be created, the device will be set with this struct D3D11_BLEND_DESC bsd; ZeroMemory(&bsd, sizeof(D3D11_BLEND_DESC)); bsd.RenderTarget[rt].BlendEnable = //true or false bsd.RenderTarget[rt].BlendOp = //Blend operation bsd.RenderTarget[rt].BlendOpAlpha = //Blend operation bsd.RenderTarget[rt].DestBlend = //Destination color bsd.RenderTarget[rt].DestBlendAlpha = //Dest alpha bsd.RenderTarget[rt].RenderTargetWriteMask = 0x0f; bsd.RenderTarget[rt].SrcBlend = //Source Color bsd.RenderTarget[rt].SrcBlendAlpha = //Source Alpha bsd.IndependentBlendEnable = //true or false bsd.AlphaToCoverageEnable = //true or false dev->CreateBlendState(&bsd, &bs));

Binding Blend State t->enableFunc(t->index); glBlendEquationSeparatei(t->index, t->blendOp, t->blendOpAlpha); glBlendFuncSeparatei(in, t->srcBlend, t->destBlend, t->srcBlendAlpha, t->destBlendAlpha); //enable function activates one of two functions glEnablei(GL_BLEND, index); //if enabled is true //or glDisablei(GL_BLEND, index); //if enabled is false con->OMSetBlendState(bs, Vector4(0,0,0,0).data, 0xffffffff); //blend state, blend factor, sample mask

The Render Process Clear Buffer Update Graphic Context (per object) Draw Object (per object) Merge Output With Buffer (per object) Flip Back Buffer Send object’s position, camera’s projection etc to the graphics card Transform 3D object representations into 2D textures Combine the 2D output with the back buffer / render target ContextShaderBlend State

The Shader Pipeline Vertex Processing Primitive Assembly / Processing Rasterization Fragment Processing Pixel Output Creates 2D primitives (triangles, lines, points) from transformed vertices Divides 2D primitives into many pixel sized fragments Processes each fragment and returns a color to be displayed on the render target Primitive Assembler / Geometry Shader Rasterizer State Fragment Shader Tranforms Vertices into homogenous clip space (and other processing) Vertex Shader

What Does The Rasterizer Do? One Primitive Many Fragments

Rasterizer Parameters Face Culling Vs None Back Face Winding Order Front Vs Front Fill Mode Vs Solid Wireframe Anti-Aliasing Vs

Depth Processing Z Fighting New Fragment Depth ~= Old Fragment Depth ~= Floating point precision will cause inconsistent state if( oldDepth >= newDepth) OverwriteFragment(); Depth Bias if(oldDepth >= newDepth + DepthBias ) OverwriteFragment();

Programming Rasterizer State //No creation code for GL, only Emperor specific code //See binding D3D11_RASTERIZER_DESC d; d.AntialiasedLineEnable = //true or false d.CullMode = //face cull mode, none, front, or back d.DepthBias = //The depth bias d.DepthBiasClamp = //The maximum depth bias d.DepthClipEnable = //true or false, clips far plane d.FillMode = //wireframe or solid d.FrontCounterClockwise = //true or false, wind order d.MultisampleEnable = //true or false, anti-aliasing d.ScissorEnable = //true or false, scissor culling d.SlopeScaledDepthBias = //sloped depth bias dev->CreateRasterizerState(&d, &rasterState);

Binding Rasterizer State aaLine(GL_LINE_SMOOTH); cullFace(GL_CULL_FACE); glCullFace(cullDir); glPolygonOffset(depthClamp, (GLfloat)depthBias); glPolygonMode(GL_FRONT_AND_BACK, fillMode); glFrontFace(windOrder); multiSample(GL_MULTISAMPLE); scissorTest(GL_SCISSOR_TEST); depthClip(GL_DEPTH_CLAMP); //Anything not starting with gl is a function pointer //to either glEnable(a); //or glDisable(a); con->RSSetState(rasterState);

The Render Process Clear Buffer Update Graphic Context (per object) Draw Object (per object) Merge Output With Buffer (per object) Flip Back Buffer Send object’s position, camera’s projection etc to the graphics card Transform 3D object representations into 2D textures Combine the 2D output with the back buffer / render target ContextShaderBlend State

The Shader Pipeline Vertex Processing Primitive Assembly / Processing Rasterization Fragment Process Pixel Output Creates 2D primitives (triangles, lines, points) from transformed vertices Divides 2D primitives into many pixel sized fragments Processes each fragment and returns a color to be displayed on the render target Primitive Assembler / Geometry Shader Rasterizer State Fragment Shader Tranforms Vertices into homogenous clip space (and other processing) Vertex Shader

To Do Continue work on engine enhancement Read this week’s lab Read this week’s notes Re-implement OpenGL Render State functions