Computer Graphics
Transcription
Computer Graphics
Welcome back to Computer Graphics course How was your holidays? Today is homework 1deadline Bring your results in one page to TA’s desk Your name/Student No./course ID input.txt.000.png - input.txt.012.png Computer Graphics submit your implementation from http://goo.gl/OF0i0b 1st quarter, 2015 Do NOT despair ! 諦めんなよ!どうしてそこでやめるんだ! Nara Institute of Science and Technology May 7, 2015 Close the site tonight. We are still open submission with small deduction. You can contact us for further support. But, we need to go ahead in this class… Today’s topics Homework 2 Homework 2 is due next week due May 21, 2015. Homework 3 pre-out Print out the results in one page Your name / Student No. /course ID Check your understanding Homework 2 support demo.txt.input.txt.000.png - demo.txt.input.txt.012.png Submit your source codes from http://goo.gl/ZqP7LK in my implementation, about 30 lines on light.frag.glsl 12 lines on display.cpp 10 lines on readfile.cpp about 15 lines on Transform.cpp Next homework - edX (recap) What’s required in Homework 2 ? Unit 2 This requires you Lecture 7: OpenGL Shading Remains (L7V3,V4), about 30 min. Lecture 8: OpenGL 2 five clips, about 30 min. to read a scene from file ≤ 10 objects with configurable material ≤ 10 lights (point/directional) to change viewpoint Rotation (as in HW1) / translation / scale to render the objects according to their material Implement the above using OpenGL! Start early! It takes hours! 1 What’s in skeleton code? Detailed explanation about Homework 2 File main.cpp variable.h shaders.h / shaders.cpp Transform.h / Transform.cpp readfile.h / readfile.cpp display.cpp shaders/light.vert.glsl shaders/light.frag.glsl contents core functions variables used in the program prepare shaders Transform class implements geometric transforms parser for input file display() for render the scene vertex shader fragment shader What’s required? Transform.cpp - Tranform class You need to fill codes to “YOUR CODE FOR HW 2 HERE.” Form 4 × 4 geometric transformation matrix Transform.cpp Implement geometrical transformations mat4 lookAt(const vec3 &eye, const vec3 ¢er, const vec3 &up) mat4 perspective(float fovy, float aspect, float zNear, float zFar) Similar to HW1 mat4 scale(const float &sx, const float &sy, const float &sz) Rotations, translations, scales, perspective projection. mat4 translate(const float &tx, const float &ty, const float &tz) readfile.cpp for reading the input file display.cpp displaying the scene. shaders/light.frag.glsl mat3 rotate(const float degrees, const vec3& axis) This is also used in the followings as helper function. Change viewpoint void left(float degrees, vec3& eye, vec3& up) void up(float degrees, vec3& eye, vec3& up) fragment shader to implement phong shading readfile.cpp - read scene file push/pop Transform Specifications example) https://courses.edx.org/courses/BerkeleyX/CS_184.1x/3T2 014/courseware/Unit_2/Homework_2/ Read parameters, set them to variables light / camera command Check variable.h to find variables to be set Process transformation stack – use Tranform class translate / scale / rotate command pushTransform translate -0.4 -0.4 0 pushTransform translate 0 0 0.6 sphere 0.1 popTransform scale 0.2 0.2 .5 translate 0 0 0.5 cube 1.0 popTransform Perform transformation on transfstack.top() Do you know “stack”, one of the data structures? 2 display.cpp shaders/light.frag.glsl Pass some values to the shader by glUniform*() Refer shaders/light.frag.glsl in HW1 light positions and colors Remember that light positions must be transformed by modelview. Transformvec(…) funcation helps do it. object transformations & material properties Set up the net transformation matrix for the objects. Core process is already implemented in it Extend it to accept lighting setting from input Directional / pointlight Up to 10 lights Set transf by using mv(modelview), sc(scale) & tr(translation) specified by keyboard input. Homework 3 pre-out There are three options Questions? [beginner] HW3.1 Requirements are much smaller than the one on edX. [intermediate] HW3.2 [advanced] HW3 (original version on edX) You can use skeleton made by Kubo-sensei. Download from the course website. http://omilab.naist.jp/~funatomi/courses/CG/2015/ Due May 28, 2015. Please tell us your ID & name before asking/answering. Homework support on May 21, 28. Check! Take a short test from http://goo.gl/yRaXQw Questions? Please tell us your ID & name before asking/answering. 3 Homework 2 Questions? due May 21, 2015. Print out the results in one page Your name / Student No. /course ID demo.txt.input.txt.000.png - demo.txt.input.txt.012.png Submit your source codes from http://goo.gl/ZqP7LK in my implementation, Please tell us your ID & name before asking/answering. about 30 lines on light.frag.glsl 12 lines on display.cpp 10 lines on readfile.cpp about 15 lines on Transform.cpp Next homework - edX Unit 2 Lecture 7: OpenGL Shading Remains (L7V3,V4), about 30 min. Lecture 8: OpenGL 2 five clips, about 30 min. 4