[175 points] The purpose of this assignment is to give you practice with shaders in OpenGL.
|
|
- Belinda Montgomery
- 5 years ago
- Views:
Transcription
1 CPSC 441 Computer Graphics Assignment 5 due 11/20/18 (11:59 p.m.) [175 points] The purpose of this assignment is to give you practice with shaders in OpenGL. Part 1: First, download and get the code itself to run. Below is a brief explanation of the source code; you will want to examine it yourself to ensure you understand it: You will not see any output when you first run your code. There are 3 files you will work with: o main.cpp is the main file. In this file, you will want to edit the sendattributes function (beginning line 181). You will want to fill in the information in this function. o vert.glsl is the vertex shader. You will be filling this in as part of the assignment. o frag.glsl is the pixel (fragment) shader. You will be filling this in as part of the assignment. First look at the overall structure of main.cpp. o There are several classes/functions/structs defined: A face (line 17) is a triangle it stores the indices of the 3 vertices making up the triangle. It also stores the texture coordinates and normal (note that texture coordinates are not required to be used). The objreader (line 27) is a function that will read in basic (not every).obj files, which is a common file format for storing models. It will store the vertices and faces in global vectors. The Program class (line 92) is a class used to define shader programs. It will be described below. The KeyCallbackFunc (line 319) is where you can fill in your code for responding to key presses. The WindowSizeCallbackFunc (line 324) is called if the window size changes. You may wish to put your code to change the view/projection matrix in this routine. o There are some global variables defined: The window, along with its width and height A vector of vertices and a vector of faces A sample_program (line 317). This will be the shader program that compiles and runs the vertex and pixel shaders. You will likely want to create other global programs to go with this. Look at the main function in main.cpp. This routine should now make sense to you: o The init routine (line 331) is called to initialize various parameters. This will be discussed below. o Then, there is a check to make sure you have the right number of command-line arguments. There should be either 1 or 2 arguments given: (the first being the.obj file, and the second being the optional texture).
2 o Next, there are two sample lines (THAT YOU WILL WANT TO DELETE EVENTUALLY) that set up a view matrix, mat with an initial view to the vertex shader (the senduniform command), and that sends per-vertex attributes (the sendattributes command). o Then, as long as it is not time to close the main window, the following happens repeatedly: The window is cleared. Notice that there are two bits used in the glclear command: one for the color buffer, one for the depth buffer. These are flags, combined with a bitwise or. This command clears out the current ( working ) image buffer and depth buffer. Then, display is called, which if you look at the display function (just above main), simply calls the display member function of the sample_program. This is defined in lines Next, the buffers are swapped. This will make the working image buffer the display image buffer (and the one that was being displayed is, for now, the working buffer). And, then we poll to see if any events occurred. Any events have their corresponding callback function called. Now look at the init function in main.cpp. o The first several lines just set up the window itself, using glfw (you will want to put your name in the window title), and initializing glew. o The glviewport command sets the area of the window to draw into (in this case, the whole window). o The glclearcolor sets the color that the window should be cleared to (in this case, white so, when glclear is called, the image buffer is set to all white). Note that you could change this to black (or some other color) if you wish. o The next two lines enable depth testing (i.e. they turn on Z-buffering) and texture mapping. o The next two lines register the callback functions to use when there is a keypress event or a window-size-change event. o Finally, the init command creates the sample_program using the vert.glsl and frag.glsl shaders. Note that you could create other, different Programs here, with different vertex and pixel shaders. Within the Program class, there are several key member functions. o Create is used to create a new shader program using the vertex and pixel shaders passed in as parameters (these are vert.glsl and frag.glsl in the example). You may want to look through the lines of create most (though probably not every line) should be something you can make sense of. o The sendattributes function will be a key one that you will fill in. It contains a data_buffer that will be used to store the triangle information (see the comments for the structure). It also has commands (lines ) so that, once you have filled in the data buffer, OpenGL will use that buffer information to send the vertices and normal on to the shader program. You will need to call sendattributes to send vertex attributes on to the shader.
3 o The senduniform functions (several overloaded versions are provided) are used to send uniform variables to the vertex shader. Uniform variables do not vary by vertex or over the triangle. You should use senduniform to send a variable of some type on to the shader programs you call senduniform and then within the shader program, you will need to declare a corresponding uniform variable. o The display function is called to display the current scene. Now look at the file vert.glsl. This is the vertex shader program. It is initially a simple program, that does the following: o The uniform designation refers to a variable that will be brought in identically to all versions of the shader program. In this case, that s the matrix (for handling view transformations). It is expecting you to send it a uniform mat4 (i.e. a 4x4 matrix) with the name mat o The attribute designation refers to variables that are set for each vertex. These will be different for each vertex. In this case, these are the position and normal, which were obtained from the data_buffer that was set in the main program (in the sendattributes member function). o The varying designation is a way to declare a variable that will be interpolated into the pixel shader. These variables should be set in the vertex shader, and then they are interpolated across the triangle, and can be accessed in the pixel shader. In this case, there are two such variables a 3D vector vnor and a 3D vector vpos. o The code itself just does two things. First, it sets the varying variables vnor and vpos to equal the Normal and Position that were passed in as vertex attributes: Nor andpos. vnor and vpos will be interpolated across the triangle and passed on to the pixel shader. Then, it sets gl_position to be the uniform matrix that was passed in, mat, times the 3D position of the vertex (the vertex attribute, Pos). That is, it is applying the transformation matrix to the point to get the final position. Finally look at the file frag.glsl. This is the pixel (fragment) shader. It is initially a simple program that does the following: o The varying designation refers to a value that is going to be interpolated across the triangle from the vertex data. In this case, since we set the vertex normal vnor to be varying in the vertex shader, the values set for each vertex by the vertex shader are interpolated to the individual pixel being processed by this fragment shader. o The uniform designation indicates a value that does not vary. In this case, there are two such attributes the position of a light, and the position of the eye. Note that these are not actually set in the program, currently: you will have to set them yourself. They are included here just for demonstration.
4 o The code itself sets the color of the pixel (fragment). This is done by assigning to the gl_fragcolor an RGBA value. In this case, the color of the pixel is set to be blue. Be sure to spend sufficient time reviewing the skeleton code that you understand how the various parts are working together. Part 2: From the skeleton code that was provided, you are to write a program that will read in a.obj file, and will render it using Phong shading. You will need to do the following, though the order in which you do them is up to you. You are strongly encouraged to use an iterative development process. That is try to make one small change at a time, and ensure it is working before you try to implement the next part of the program. If you try to do too many things at once, you will almost certainly have your program fail, and will have great difficulty debugging! For example, you might want to first ensure that you can create a single triangle and render it using the existing shaders before trying to modify shaders, read more data, etc. And, you should likely ensure you can perform Gouraud shading before you try implementing Phong shading. Specifically, here are the things you will need to do: You should set up an appropriate transformation matrix that allows you to see the model(s) that you load. This should take into account the view transformations that are needed. Note that you will need to pass this matrix on to the vertex shader e.g. the initial vert.glsl program is expecting a matrix mat to be provided, and the skeleton code does not yet do this. o Note: you might originally start with a fixed view, such as the one provided, but for full credit, your view should adjust to allow the whole.obj file to be viewed. You should read in a.obj file and use it for the triangles that you render. Note that a function to read a.obj file into vertex and face arrays is provided. You will need to read in the file, and then convert those vertices and faces into the data that will be passed to the shaders. Note that there is an outline in the sendattributes function that describes part of what needs to be done. o For setting normals, you can initially begin by setting the normal to be the normal of the triangle itself. Recall that you can find a triangle normal by taking the cross product of the vectors along two edges. This should be the default and should correspond to hitting the key 1. o For full credit, you should create a smoothly varying model by setting the vertex normal equal to the average of the normal of all the faces incident on that vertex. Note that this will make that vertex appear smooth, and there may be
5 some models where you want sharp edges so that a smooth vertex does not look correct. This should correspond to hitting the key 2. o Note (for bonus): in practice, the normals are provided WITHIN the.obj file itself. The basic reader provided here does not read in normals, but you may modify it to read in normals from the file. To do this you will need to read about the.obj file format and modify the reader (or write your own) to read in normal. This should correspond to hitting the key 3. Note that you will want to call sendattributes again each time the way to compute normal changes. You should add lights to your scene, and perform lighting calculations. In the end, you should have: o At least 3 point lights and ambient light in the scene. o Some sort of material property that includes ambient, diffuse, and specular material characteristics. It should be clear that these properties are set for the model. Your README file should state what your material parameters are. You should be able to use any of 4 different shader programs, by hitting the Q, W, E, and R keys. Specifically, the four shaders should be: o Q : Flat shading that colors the polygons a single color (based on calculating lighting at the center point or one vertex per triangle). Note that you will want to perform the color calculation itself in the main C++ program (rather than in the shaders) and pass in the color as a vertex attribute. o W : Gouraud Shading calculate color per vertex and interpolate colors to pixels. o E : Phong Shading calculate color per pixel by interpolating normals o R : Shader of your choice: Make an interesting shader that highlights something. Your grade here will be based on the complexity and interestingness of the shader (e.g. a blue shader is not interesting). Examples you might consider are silhouette shaders or toon shaders. Remember that when dealing with vectors, you want to ensure they are normalized in most cases. You should allow the user to: o Change the position of the model and/or the lights. Changing the model/lights should result in an obvious change in the diffuse and specular portions of the model. You should use the A and (if desired) S keys to make these changes; the way the model or lights change position is up to you, but it should be an obvious change as you press keys. o Change the direction of the view. Changing the view direction should change the specular effect but not the diffuse effect on the model. Use the Z and (if desired) X keys to change the view direction (e.g. rotate view around the center). Again, the specific way your key(s) move the view is up to you but it should be an obvious specular change as you move it. You should include in your README file the ways that you can vary the view and lighting and/or model.
6 For bonus credit: put in a falloff of the lighting and/or a spotlight effect of lighting. Document exactly what you have done in your readme file, and ensure that the effect of your improvements are obvious to a user. For bonus credit: read and display multiple.obj files at once, with different material properties for each. Document exactly what you have done in your readme file. Your program should still run with the default command line arguments, but you might take more arguments, for instance. Note that you will need to pass more information to the shader programs than what is in there now! Grading: [10 points].obj file is read in [10 points] Vertex normals are set at least from triangles (option 1 ) [15 points] Vertex normals are set by averaging triangles (option 2 ) [10 points] Basic view can render some object and see the geometry [15 points] View is set up to allow view of entire model that is read in. [15 points] Change of model and/or lighting is supported (options A and S ) [15 points] Change of view direction is supported (options Z and X ) [10 points] Lights are set up in the scene. [10 points] Material properties are set for the object. [20 points] Ambient, Diffuse, and Specular lighting are computed correctly in flat/gouraud/phong shaders [10 points] Flat Shader implemented correctly (option Q ) [10 points] Gouraud Shader implemented correctly (option W ) [10 points] Phong Shader implemented correctly (option E ) [15 points] New/interesting Shader implemented (option R ) [15 points] Bonus: vertex normals are read from.obj file (option 3 ) [15 points] Bonus: reading in multiple.obj files [15 points] Bonus: light falloff and spotlight effects (partial bonus for either)
7 Honors students: Alternative work You should modify the program as described above in order to bring in texture mapping. This involves several items: You will need to read texture coordinates in when you read in the.obj file. Alternatively (for less credit), you may set the texture coordinates manually. You will need to load in an image to use for texture mapping. You may use the.bmp reader provided earlier. You will need to change the data buffer to incorporate texture coordinates, in addition to position and normal of each vertex. You will need to use the texture color in your fragment calculation. You should use the texture color in place of the ambient and diffuse reflection coefficients (though you should scale the color appropriately for the ambient and diffuse terms). You should still use an externally set specular term per object, in this case. You do not have to do the following parts of the base assignment if you do texture mapping: - Ensuring the view takes into account the entire model - Changing view direction ( Z / X keys) Grading: Incorporating texture mapping is worth 50 points, and replaces the material properties set, basic view, view direction is set up to allow view of entire model, and change of view direction is supported portions of the grade. Honors students may do those other portions for a 20 point bonus. Non-honors students may include texture mapping as for a 20 point bonus.
Shading and Texturing Due: Friday, Feb 17 at 6:00pm
CMSC 23700 Winter 2012 Introduction to Computer Graphics Project 2 Feb 2 Shading and Texturing Due: Friday, Feb 17 at 6:00pm (v1.0 Feb 2: initial version) 1 Summary You can complete this project in pairs
More informationDeferred 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 informationComputer 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 informationLecture 17: Shading in OpenGL. CITS3003 Graphics & Animation
Lecture 17: Shading in OpenGL CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL shading methods - per vertex shading
More informationModule Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1
UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series PG Examination 2013-14 COMPUTER GAMES DEVELOPMENT CMPSME27 Time allowed: 2 hours Answer any THREE questions. (40 marks each) Notes are
More informationSpring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley
Spring 2012 Final CS184 - Foundations of Computer Graphics University of California at Berkeley Write your name HERE: Write your login HERE: Closed book. You may not use any notes or printed/electronic
More informationCS 130 Final. Fall 2015
CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying
More informationCS 4620 Program 3: Pipeline
CS 4620 Program 3: Pipeline out: Wednesday 14 October 2009 due: Friday 30 October 2009 1 Introduction In this assignment, you will implement several types of shading in a simple software graphics pipeline.
More informationObjectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading
Objectives Shading in OpenGL Introduce the OpenGL shading methods - per vertex shading vs per fragment shading - Where to carry out Discuss polygonal shading - Flat - Smooth - Gouraud CITS3003 Graphics
More informationCS 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 informationCS559 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 informationECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014
ECS 175 COMPUTER GRAPHICS Ken Joy Winter 2014 Shading To be able to model shading, we simplify Uniform Media no scattering of light Opaque Objects No Interreflection Point Light Sources RGB Color (eliminating
More informationInterpolation using scanline algorithm
Interpolation using scanline algorithm Idea: Exploit knowledge about already computed color values. Traverse projected triangle top-down using scanline. Compute start and end color value of each pixel
More informationIllumination Models & Shading
Illumination Models & Shading Lighting vs. Shading Lighting Interaction between materials and light sources Physics Shading Determining the color of a pixel Computer Graphics ZBuffer(Scene) PutColor(x,y,Col(P));
More informationPipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11
Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION
More informationComputer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting
Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Computation of Vectors To calculate
More informationCS 130 Exam I. Fall 2015
S 3 Exam I Fall 25 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying
More informationCS 464 Review. Review of Computer Graphics for Final Exam
CS 464 Review Review of Computer Graphics for Final Exam Goal: Draw 3D Scenes on Display Device 3D Scene Abstract Model Framebuffer Matrix of Screen Pixels In Computer Graphics: If it looks right then
More informationPipeline Operations. CS 4620 Lecture 14
Pipeline Operations CS 4620 Lecture 14 2014 Steve Marschner 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives
More informationLets assume each object has a defined colour. Hence our illumination model is looks unrealistic.
Shading Models There are two main types of rendering that we cover, polygon rendering ray tracing Polygon rendering is used to apply illumination models to polygons, whereas ray tracing applies to arbitrary
More informationMach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.
Mach band effect The Mach band effect increases the visual unpleasant representation of curved surface using flat shading. A B 320322: Graphics and Visualization 456 Mach band effect The Mach band effect
More informationThe 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 informationCSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #8: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #4 due Friday, November 2 nd Introduction:
More informationToday. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models
Computergrafik Thomas Buchberger, Matthias Zwicker Universität Bern Herbst 2008 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation
More information9. Illumination and Shading
9. Illumination and Shading Approaches for visual realism: - Remove hidden surfaces - Shade visible surfaces and reproduce shadows - Reproduce surface properties Texture Degree of transparency Roughness,
More informationOpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.
OpenGl Pipeline Individual Vertices Transformed Vertices Commands Processor Per-vertex ops Primitive assembly triangles, lines, points, images Primitives Fragments Rasterization Texturing Per-fragment
More informationCSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011
CSE 167: Introduction to Computer Graphics Lecture #8: Lighting Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #4 due Friday, October 28 Introduction:
More informationHow do we draw a picture?
1 How do we draw a picture? Define geometry. Now what? We can draw the edges of the faces. Wireframe. We can only draw the edges of faces that are visible. We can fill in the faces. Giving each object
More informationCS5620 Intro to Computer Graphics
So Far wireframe hidden surfaces Next step 1 2 Light! Need to understand: How lighting works Types of lights Types of surfaces How shading works Shading algorithms What s Missing? Lighting vs. Shading
More informationTHE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations(Semester 2) COMP4610/COMP6461 (Computer Graphics) Final Exam
THE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations(Semester 2) 2009 COMP4610/COMP6461 (Computer Graphics) Final Exam Writing Period: 3 hours duration Study Period: 15 minutes duration - you may read
More informationToday s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1
Today s class Simple shadows Shading Lighting in OpenGL Wednesday, November 21, 27 Computer Graphics - Class 1 1 Simple shadows Simple shadows can be gotten by using projection matrices Consider a light
More informationAdvanced Lighting Techniques Due: Monday November 2 at 10pm
CMSC 23700 Autumn 2015 Introduction to Computer Graphics Project 3 October 20, 2015 Advanced Lighting Techniques Due: Monday November 2 at 10pm 1 Introduction This assignment is the third and final part
More informationCS 4620 Midterm, March 21, 2017
CS 460 Midterm, March 1, 017 This 90-minute exam has 4 questions worth a total of 100 points. Use the back of the pages if you need more space. Academic Integrity is expected of all students of Cornell
More informationHomework 3: Programmable Shaders
Homework 3: Programmable Shaders Introduction to Computer Graphics and Imaging (Summer 2012), Stanford University Due Monday, July 23, 11:59pm Warning: The coding portion of this homework involves features
More informationCS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside
CS230 : Computer Graphics Lecture 4 Tamar Shinar Computer Science & Engineering UC Riverside Shadows Shadows for each pixel do compute viewing ray if ( ray hits an object with t in [0, inf] ) then compute
More informationToday. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models
Computergrafik Matthias Zwicker Universität Bern Herbst 2009 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation of physics Global
More informationObjectives. Introduce the OpenGL shading Methods 1) Light and material functions on MV.js 2) per vertex vs per fragment shading 3) Where to carry out
Objectives Introduce the OpenGL shading Methods 1) Light and material functions on MV.js 2) per vertex vs per fragment shading 3) Where to carry out 1 Steps in OpenGL shading Enable shading and select
More informationIllumination and Shading
Illumination and Shading Illumination (Lighting)! Model the interaction of light with surface points to determine their final color and brightness! The illumination can be computed either at vertices or
More informationGLSL 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 informationShaders. 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 informationGLSL 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 informationOUTLINE. 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 informationCSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego
CSE 167 - Intro to Computer Graphics ANSWER KEY: Midterm Examination November 18, 2003 Instructor: Sam Buss, UC San Diego Write your name or initials on every page before beginning the exam. You have 75
More informationLighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015
Lighting and Shading II 1 Objectives Continue discussion of shading Introduce modified Phong model Consider computation of required vectors 2 Ambient Light Ambient light is the result of multiple interactions
More informationComputer Graphics MTAT Raimond Tunnel
Computer Graphics MTAT.03.015 Raimond Tunnel The Road So Far... Last week This week Color What is color? Color We represent color values with 3 channels: Red Green Blue Color We represent color values
More informationOrthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015
Orthogonal Projection Matrices 1 Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization 2 Normalization Rather
More informationOPENGL 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 informationFor each question, indicate whether the statement is true or false by circling T or F, respectively.
True/False For each question, indicate whether the statement is true or false by circling T or F, respectively. 1. (T/F) Rasterization occurs before vertex transformation in the graphics pipeline. 2. (T/F)
More informationComputer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010
Computer Graphics 1 Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering 1 The 3D rendering pipeline (our version for this class) 3D models in model coordinates 3D models in world coordinates 2D Polygons
More informationCS 130 Exam I. Fall 2015
CS 130 Exam I Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is
More informationIllumination and Shading
Illumination and Shading Illumination and Shading z Illumination Models y Ambient y Diffuse y Attenuation y Specular Reflection z Interpolated Shading Models y Flat, Gouraud, Phong y Problems CS4451: Fall
More informationHomework #2. Shading, Ray Tracing, and Texture Mapping
Computer Graphics Prof. Brian Curless CSE 457 Spring 2000 Homework #2 Shading, Ray Tracing, and Texture Mapping Prepared by: Doug Johnson, Maya Widyasari, and Brian Curless Assigned: Monday, May 8, 2000
More informationCSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016
CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Thursday in class: midterm #1 Closed book Material
More informationComputer 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 informationGraphics for VEs. Ruth Aylett
Graphics for VEs Ruth Aylett Overview VE Software Graphics for VEs The graphics pipeline Projections Lighting Shading Runtime VR systems Two major parts: initialisation and update loop. Initialisation
More informationhttps://ilearn.marist.edu/xsl-portal/tool/d4e4fd3a-a3...
Assessment Preview - This is an example student view of this assessment done Exam 2 Part 1 of 5 - Modern Graphics Pipeline Question 1 of 27 Match each stage in the graphics pipeline with a description
More informationOutline. Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s)
Modeler Help Outline Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s) Objects in the Scene Controls of the object selected in the Scene. Currently the Scene
More informationMethodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3 http://inst.eecs.berkeley.edu/~cs184 Methodology for Lecture Lecture deals with lighting (teapot shaded as in HW1) Some Nate
More informationCPSC 314 LIGHTING AND SHADING
CPSC 314 LIGHTING AND SHADING UGRAD.CS.UBC.CA/~CS314 slide credits: Mikhail Bessmeltsev et al 1 THE RENDERING PIPELINE Vertices and attributes Vertex Shader Modelview transform Per-vertex attributes Vertex
More informationCS 418: Interactive Computer Graphics. Basic Shading in WebGL. Eric Shaffer
CS 48: Interactive Computer Graphics Basic Shading in WebGL Eric Shaffer Some slides adapted from Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 205 Phong Reflectance Model Blinn-Phong
More informationLecture 12: Mid-term test solution & project. CITS 3003 Graphics & Animation
Lecture 12: Mid-term test solution & project CITS 3003 Graphics & Animation Slides: E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Explain solution to the mid-term
More informationTSBK03 Screen-Space Ambient Occlusion
TSBK03 Screen-Space Ambient Occlusion Joakim Gebart, Jimmy Liikala December 15, 2013 Contents 1 Abstract 1 2 History 2 2.1 Crysis method..................................... 2 3 Chosen method 2 3.1 Algorithm
More informationPROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd.
PROFESSIONAL WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB Andreas Anyuru WILEY John Wiley & Sons, Ltd. INTRODUCTION xxl CHAPTER 1: INTRODUCING WEBGL 1 The Basics of WebGL 1 So Why Is WebGL So Great?
More informationOpenGL shaders and programming models that provide object persistence
OpenGL shaders and programming models that provide object persistence COSC342 Lecture 22 19 May 2016 OpenGL shaders We discussed forms of local illumination in the ray tracing lectures. We also saw that
More informationCCSI 3161 Project Flight Simulator
1/11 CCSI 3161 Project Flight Simulator Objectives: To develop a significant OpenGL animation application. Due date: Dec 3 rd, Dec 1st, 11:59pm. No late submission will be accepted since the grades need
More informationTDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)
TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students) Saturday, January 13 th, 2018, 08:30-12:30 Examiner Ulf Assarsson, tel. 031-772 1775 Permitted Technical Aids None, except
More informationComputer 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 information3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models
3D Programming Concepts Outline 3D Concepts Displaying 3D Models 3D Programming CS 4390 3D Computer 1 2 3D Concepts 3D Model is a 3D simulation of an object. Coordinate Systems 3D Models 3D Shapes 3D Concepts
More informationLessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering
Lessons Learned from HW Shading CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Only have an idle() function if something is animated Set idle function to NULL, when
More informationShadows. 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 informationModule 13C: Using The 3D Graphics APIs OpenGL ES
Module 13C: Using The 3D Graphics APIs OpenGL ES BREW TM Developer Training Module Objectives See the steps involved in 3D rendering View the 3D graphics capabilities 2 1 3D Overview The 3D graphics library
More informationLighting/Shading III. Week 7, Wed Mar 3
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading III Week 7, Wed Mar 3 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 reminders News don't need to tell
More informationCSE 167: Introduction to Computer Graphics Lecture #7: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015
CSE 167: Introduction to Computer Graphics Lecture #7: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015 Announcements Thursday in-class: Midterm Can include material
More informationShading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann
Shading Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller/Fuhrmann Reading Chapter 5.5 - Angel Chapter 6.3 - Hughes, van Dam, et al Machiraju/Zhang/Möller/Fuhrmann 2 Shading Illumination
More informationIllumination and Shading
Illumination and Shading Light sources emit intensity: assigns intensity to each wavelength of light Humans perceive as a colour - navy blue, light green, etc. Exeriments show that there are distinct I
More information5.2 Shading in OpenGL
Fall 2017 CSCI 420: Computer Graphics 5.2 Shading in OpenGL Hao Li http://cs420.hao-li.com 1 Outline Normal Vectors in OpenGL Polygonal Shading Light Sources in OpenGL Material Properties in OpenGL Example:
More informationCS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.
CS 380 Introduction to Computer Graphics LAB (1) : OpenGL Tutorial 2018. 03. 05 Reference : Foundations of 3D Computer Graphics, Steven J. Gortler Goals Understand OpenGL pipeline Practice basic OpenGL
More informationTopics and things to know about them:
Practice Final CMSC 427 Distributed Tuesday, December 11, 2007 Review Session, Monday, December 17, 5:00pm, 4424 AV Williams Final: 10:30 AM Wednesday, December 19, 2007 General Guidelines: The final will
More informationComputer Graphics: Programming, Problem Solving, and Visual Communication
Computer Graphics: Programming, Problem Solving, and Visual Communication Dr. Steve Cunningham Computer Science Department California State University Stanislaus Turlock, CA 95382 copyright 2002, Steve
More informationShading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline
CSCI 420 Computer Graphics Lecture 10 Shading in OpenGL Normal Vectors in OpenGL Polygonal Shading Light Source in OpenGL Material Properties in OpenGL Approximating a Sphere [Angel Ch. 6.5-6.9] Jernej
More informationRendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information
llumination Model Wireframe rendering simple, ambiguous Color filling flat without any 3D information Requires modeling interaction of light with the object/surface to have a different color (shade in
More informationComputer Graphics (CS 4731) Lecture 18: Lighting, Shading and Materials (Part 3)
Computer Graphics (CS 4731) Lecture 18: Lighting, Shading and Materials (Part 3) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Flat Shading compute lighting once
More informationLight Sources. Spotlight model
lecture 12 Light Sources sunlight (parallel) Sunny day model : "point source at infinity" - lighting - materials: diffuse, specular, ambient spotlight - shading: Flat vs. Gouraud vs Phong light bulb ambient
More informationPipeline Operations. CS 4620 Lecture 10
Pipeline Operations CS 4620 Lecture 10 2008 Steve Marschner 1 Hidden surface elimination Goal is to figure out which color to make the pixels based on what s in front of what. Hidden surface elimination
More informationGraphics and Interaction Surface rendering and shading
433-324 Graphics and Interaction Surface rendering and shading Department of Computer Science and Software Engineering The Lecture outline Introduction Surface rendering and shading Gouraud shading Phong
More informationAdvanced Real- Time Cel Shading Techniques in OpenGL Adam Hutchins Sean Kim
Advanced Real- Time Cel Shading Techniques in OpenGL Adam Hutchins Sean Kim Cel shading, also known as toon shading, is a non- photorealistic rending technique that has been used in many animations and
More informationLecture outline Graphics and Interaction Surface rendering and shading. Shading techniques. Introduction. Surface rendering and shading
Lecture outline 433-324 Graphics and Interaction Surface rendering and shading Department of Computer Science and Software Engineering The Introduction Surface rendering and shading Gouraud shading Phong
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 2 Part 2 Introduction to Shaders Matt Burlick - Drexel University - CS 432 1 Shaders To understand shaders, let s look at the graphics pipeline again The job
More informationRay Tracer Due date: April 27, 2011
Computer graphics Assignment 4 1 Overview Ray Tracer Due date: April 27, 2011 In this assignment you will implement the camera and several primitive objects for a ray tracer, and a basic ray tracing algorithm.
More informationGraphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University
Graphics Programming Computer Graphics, VT 2016 Lecture 2, Chapter 2 Fredrik Nysjö Centre for Image analysis Uppsala University Graphics programming Typically deals with How to define a 3D scene with a
More informationShader 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 informationComputergrafik. Matthias Zwicker. Herbst 2010
Computergrafik Matthias Zwicker Universität Bern Herbst 2010 Today Bump mapping Shadows Shadow mapping Shadow mapping in OpenGL Bump mapping Surface detail is often the result of small perturbations in
More information6.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-=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 informationCMSC427 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 informationCS451Real-time Rendering Pipeline
1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does
More informationComputer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College
Computer Graphics Shading Based on slides by Dianna Xu, Bryn Mawr College Image Synthesis and Shading Perception of 3D Objects Displays almost always 2 dimensional. Depth cues needed to restore the third
More informationCHAPTER 1 Graphics Systems and Models 3
?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........
More informationC O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65
Computer Graphics Three-Dimensional Graphics V Guoying Zhao 1 / 65 Shading Guoying Zhao 2 / 65 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material
More informationShading Techniques Denbigh Starkey
Shading Techniques Denbigh Starkey 1. Summary of shading techniques 2 2. Lambert (flat) shading 3 3. Smooth shading and vertex normals 4 4. Gouraud shading 6 5. Phong shading 8 6. Why do Gouraud and Phong
More information