Lecture 12: Mid-term test solution & project. CITS 3003 Graphics & Animation

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

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers

TEACHING PLAN FAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI UNIVERSITI TEKNIKAL MALAYSIA MELAKA

CS 432 Interactive Computer Graphics

[175 points] The purpose of this assignment is to give you practice with shaders in OpenGL.

Computer Graphics Coursework 1

Lecture 10: Input, Interaction & callbacks. CITS 3003 Graphics & Animation

Three Main Themes of Computer Graphics

Programming with OpenGL Complete Programs Objectives Build a complete first program

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Computer Graphics. Bing-Yu Chen National Taiwan University

Input Nodes. Surface Input. Surface Input Nodal Motion Nodal Displacement Instance Generator Light Flocking

Computer Graphics (CS 543) Lecture 1 (Part 2): Introduction to OpenGL/GLUT (Part 1)

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Shading and Texturing Due: Friday, Feb 17 at 6:00pm

Computer Graphics (CS 4731) OpenGL/GLUT(Part 1)

Computer Graphics Lecture 2

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

OpenGL refresher. Advanced Computer Graphics 2012

CS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL

Terrain rendering (part 1) Due: Monday, March 10, 10pm

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

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

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

Lecture 2 CISC440/640 Spring Department of Computer and Information Science

THE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations(Semester 2) COMP4610/COMP6461 (Computer Graphics) Final Exam

CS 4620 Program 3: Pipeline

Ciril Bohak. - INTRODUCTION TO WEBGL

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

Lecture 11: Callbacks. CITS 3003 Graphics & Animation

3D GRAPHICS. design. animate. render

Homework 3: Programmable Shaders

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

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

1 Preview. Dr. Scott Gordon Computer Science Dept. CSUS. Virtual Cameras, Viewing Transformations: CSc-155 Advanced Computer Graphics

Advanced Lighting Techniques Due: Monday November 2 at 10pm

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL

CSE 167: Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

3D Modeling. 3D Modeling 1

to OpenGL Introduction Pipeline Graphics pipeline OpenGL pipeline OpenGL syntax Modeling Arrays Conclusion 1 Introduction Introduction to OpenGL

We assume that you are familiar with the following:

Building scalable 3D applications. Ville Miettinen Hybrid Graphics

CS 184: Assignment 2 Scene Viewer

BCA611 Video Oyunları için 3B Grafik

CPSC 436D: Video Game Programming Intro to Game Graphics Assignment

Shaders. Slide credit to Prof. Zwicker

CS450/550. Pipeline Architecture. Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012

Graphics Programming

Lecture 0 of 41: Part A Course Organization. Introduction to Computer Graphics: Course Organization and Survey

Manipal Institute of Technology Manipal University Manipal

CS452/552; EE465/505. Clipping & Scan Conversion

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Sign up for crits! Announcments

OPENGL RENDERING PIPELINE

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

Models and Architectures

Dave Shreiner, ARM March 2009

3D Graphics and OpenGl. First Steps

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

CS451Real-time Rendering Pipeline

Graphics Pipeline 2D Geometric Transformations

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

WebGL A quick introduction. J. Madeira V. 0.2 September 2017

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Lecture 1. Computer Graphics and Systems. Tuesday, January 15, 13

Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011

LECTURE 02 OPENGL API

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Lecture 4 of 41. Lab 1a: OpenGL Basics

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

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

From system point of view, a graphics application handles the user input, changes the internal state, called the virtual world by modeling or

Announcement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12

CSE4030 Introduction to Computer Graphics

OPENGL AND GLSL. Computer Graphics

OpenGL/GLUT Intro. Week 1, Fri Jan 12

Introduction to OpenGL

Today s Agenda. Shaders fundamentals. Programming with shader-based OpenGL

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

Programming using OpenGL: A first Introduction

Using VTK and the OpenGL Graphics Libraries on HPCx

Computer Graphics 7: Viewing in 3-D

Computer Graphics. Shadows

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

Programming with OpenGL Part 1: Background

CS559 Computer Graphics Fall 2015

CSC 8470 Computer Graphics. What is Computer Graphics?

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

Overview. Computer Graphics CS324. OpenGL. Books. Learning Resources. CS131 Notes. 30 Lectures 3hr Exam

Outline. Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s)

2.11 Particle Systems

EDAF80 Introduction to Computer Graphics. Seminar 1. Hierarchical Transformation. Michael Doggett. Some slides by Carl Johan Gribel,


I think this assignment should have 8 objectives but we should still mark it out of 10. The Mean TA.

RECITATION - 1. Ceng477 Fall

By: Tyler Spears Mentor: Dr. Bijaya Karki. Visualizing Time- Dependent Atomic Data in OpenGL

Computer Graphics. OpenGL

Transcription:

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 test Explain the project requirements etc Show demos of the project 2

MID TERM TEST

Q1. (6 Mks) What are attributes and primitives in OpenGL? Give two examples of each. Answer Attributes: Properties that describe how an object should be rendered are called attributes OR 2 Mark Attributes are properties associated with primitives that give them their different appearances. E.g., Color, Size and Width, Stipple Pattern, Polygonmode etc. 1 Mark Primitives: These are the simplest elements provided in OpenGL. e.g. OpenGL supports lines, points, loops, triangles, etc., denoted by GL LINES, GL POINTS, GL STRIP, GL LOOP, GL TRIANGLES, GL TRIANGLE FAN, GL TRIANGLE STRIP. 1 Mark 1 Mark 1 Mark

Q2(a) (2 marks) What is the difference between request input mode and event input mode? Answer A computer has a number of input devices such as keyboard and mouse. These devices contain a trigger which can be used to send a signal to the OS. For the request input mode, the input is provided to the program only when the user triggers the device (e.g. entering a number then pressing <enter>). The program that requests this input comes to a halt until the input is entered. Since most computer systems have more than one input device, each of these devices can be triggered at an arbitrary time by the user. Each trigger from these input devices generates an event that is put in an event queue which can be examined by the user program. For the event input mode, the program may be executing many other operations (i.e., it does not come to a halt) while waiting for an event to be triggered.

Q2(b) (2 marks) Give any two common applications of vertex shaders in OpenGL Answer (i) Geometric transformations change relative location, rotation, and scale of objects/camera 3D perspective transformation - make far objects smaller (ii) Moving vertices morphing wave motion and deformation due to physical forces particle effects - fire, smoke, rain,... (iii) Lighting calculate shading color using light and surface properties special effect

Q3(a)(6 marks) (2 Mks) Why do we need a frame of reference? (2 Mks) Explain how points and vectors in 3D are represented in homogeneous coordinates. (2 Mks) Why is the use of homogeneous coordinates important in computer graphics? Answer We need a frame of reference to relate points and objects to our physical world, for example where is a point? We cannot answer this without a reference system. In homogeneous coordinates points and vectors are denoted by 4 dimensional vectors If we define 0.P = 0 and 1.P = P, then we can obtain the four dimensional homogeneous coordinate representation as follows: v = [a 1,a 2,a 3,0] T In vector the fourth dimension is zero, while for a point the 4th dimension is 1. v = [b 1,b 2,b 3,0] T Importance: Homogeneous coordinates are key to all computer graphics systems. All standard transformations (rotation, translation, scaling) can be implemented with matrix multiplications using 4 x 4 matrices since hardware pipeline works with 4 dimensional representations.

Q3(b) (4 marks) Explain what the following variables/functions do in an OpenGL program: Answer (i) gl_fragcolor (ii) glutinitwindowsize(175,450) gl_fragcolor : Built in variable. Assigns color to each fragment. glutinitwindowsize(175,450): Creates/sets/initializes a window with width 175 pixels and height 450 pixels

Q4 (a) (6 marks) What do the following functions do in OpenGL: 1) main(), 2) init() and 3) display()? Answer main(): creates the window, calls the init() function, specifies callback functions relevant to the application, enters event loop (last executable statement) init(): defines the vertices, attributes, etc. of the objects to be rendered, specifies the shader programs display(): this is a callback function that defines what to draw whenever the window is refreshed.

Q4 (b) (4 marks) What is a varying variable? Describe when it would be suitable to use a varying variable. Answer The qualifier varying is used to declare variables that are shared between the vertex shader and the fragment shader. Varying variables are used to store data calculated in the vertex shader and to pass down to the fragment shader. Again, because of the sharing of name space of the two shaders, varying variables must be declared identically in both shaders. The varying qualifier can only be used with floating point scalar, floating point vectors and (floating point) matrices as well as arrays containing these types.

PROJECT

Two parts Part-1 has been released. Part-2 will be released soon Submission due date : 01-June-2018 Marks Part-1 : 60 Part-2 : 40 Weightage : 40 % As the additional functionalities in part 2 of the project are actually an extension of the same C++ code from part 1, you only need to submit the final C++ code at the end of part 2 of the project. Backup your code regularly. You should target to finish part 1 before the end of week 10 to leave yourself sufficient time to complete part 2. Groups: You should complete this project in groups of two (group size = 2), but you may work alone if you choose (group size = 1). Each individual is also required to separately design and implement their own small extension of the specified functionality (task J).

Submission Guidelines Submit all your files to cssubmit. To submit your files, you will need to login to the system using your Pheme account. You must submit all your files including header files and base code. To ensure that your program works when we test it, you should submit a zip file that retains the directory structure of the program. Note: your scene editor will be tested on computers that are compatible to those in the labs. The report should be in PDF format. Please mention your full names and student numbers on the first page of the report. Please name your report file as report_surname1_surname2.pdf where surname1 and surname2 are the surnames of the students. If you are the only group member surname2 would be 00. If your group size is 2, then one of the group members must be responsible for submitting the code and report. Only one code and one report is required to be submitted per group. Within the report, individual efforts of the students on the coding should be detailed e.g. which student implemented which functionality.

Part-1 You are required to complete an implementation of a simple scene editor that allows a collection of objects to be arranged in a scene and various properties of them to be changed, such as colour, shininess and texture. Download the project-2018.zip file. You will also need a zip file that contains many texture map files. These files are for educational purpose and cannot be publicly distributed. A zip file (password protected) containing the texture map files can be downloaded from project page. The zip file contains a subdirectory named models-textures which should be placed in the same directory as scenestart.cpp. You are strongly suggested to use the pre-compiled assimp library files provided to you. You should see the shared library libassimp.so.3.1.1 in the LINUX_VERSIONS subdirectory and the dynamic library libassimp.3.1.1.dylib in the MAC_VERSIONS subdirectory.

How to run start-up code OpenGL installation on Linux You need to install mesa on your computer for opengl to run. sudo apt-get install build-essential libgl1-mesa-dev sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6- dev # Debian, Ubuntu https://en.wikibooks.org/wiki/opengl_programming/installation/linux Now setup some links as follows on the terminal: ln -s libassimp.so.3.1.1 libassimp.so.3 ln -s libassimp.so.3 libassimp.so ln -s /usr/lib64/libglew.so.1.10 libglew.so Type: ls -l You should see two small symbolic link files (created by Step 2 above) pointing to the actual dynamic library file. Type: make This should compile scene-start.cpp and create the executable program scene-start In case some package is missing then please install it for example: sudo apt-get install freeglut3 freeglut3-dev sudo apt-get install libxmu-dev libxmu-headers

Type: source./setup How to run start-up code You need to do this command every time you open a new terminal window. If this does not work then paste the following command in the terminal: export LD_LIBRARY_PATH=. Type:./scene-start to run the skeleton program scene-start generated from the compilation (step 4 above). Note: you need to make sure the models-textures directory is in the same directory as scene-start.cpp

Assessment Details Your project part 1 has 60 marks and will be assessed on correctness of the functionalities and coding (structure, clarity and appropriate use of OpenGL). Tasks A to I carry 5 marks each. Task J carries 5+5 marks for the two additional functionalities each student is required to implement. The last 5 marks are reserved for the report. You can get upto 5 bonus marks by optionally completing task K.

Further Reading See the project page 18