====== Seminars ====== ===== Syllabus ===== ^ Week ^ Date ^ Content ^ | 1. | 23.9. | //{{courses:b4m39apg:seminars:apg0.pdf|Introduction}}// | | 2. | 30.9. | Team forming \\ //{{courses:b4m39apg:seminars:apg1.pdf|Homework assignment I}}// | | 3. | 7.10. | Homework assignment I - consultation | | 4. | 14.10. | Homework assignment I - consultation \\ //{{courses:b4m39apg:seminars:memory-management.pdf|Crash course in Memory management}}//| | 5. | 21.10. | Homework assignment I - submission \\ //{{courses:b4m39apg:seminars:apg2.pdf|Homework assignment II}}// | | 6. | 28.10. | //Public holiday// \\ Homework assignment II - consultation (online) | | 7. | 4.11. | Homework assignment II - submission \\ //{{courses:b4m39apg:seminars:apg3.pdf|Homework assignment III}}// | | 8. | 11.11. | Homework assignment III - consultation | | 9. | 18.11. | Homework assignment III - consultation | | 10. | 25.11. | Homework assignment III - submission \\ //{{courses:b4m39apg:seminars:apg4.pdf|Homework assignment IV}}// | | 11. | 2.12. | Homework assignment IV - consultation | | 12. | 9.12. | Test \\ Homework assignment IV - submission \\ //{{courses:b4m39apg:seminars:apg5.pdf|Homework assignment V}}// | | 13. | 16.12. | Homework assignment V - consultation | | | 31.12. | Homework assignment V - submission | | 14. | 6.1. | Assessment \\ Speed competition workshop \\ Misc topics | ===== Rules of the Game ===== * [[http://dcgi.felk.cvut.cz/en/study/rules|Academic rules]] * 5 homework assignments: 50 points (10 points each) + bonus points * All assignments must be accepted * Later submissions are penalized by 3 points for each week of delay! * Test in the 12th week for up to 10 points * At least 30 points for the assessment ===== Homework Assignments ===== * Simple graphics library (SGL) divided into 5 assignments * Team of two people (possibly across all course parallels, if need be) * Submission via https://cw.felk.cvut.cz/brute/: * Automatic evaluation: * Images diff * Speed competition * Manual evaluation: * Clean build & run * Clear code, comments, etc. * Functionality * Speed competition (homework assignments I, II, III): * 3 bonus points for the 1st fastest solution * 2 bonus points for the 2nd fastest solution * 1 bonus point for the 3rd fastest solution ==== Test Application ==== * Test application using GLUT for all homework assignments: {{courses:b4m39apg:seminars:sgl_testapp.zip?linkonly|sgl_testapp.zip}} * Use CMake to generate makefile or VS solution * New: using CMake variable SGL_BACKEND, you can choose to code either in the C++ (the default), Rust, or Zig language * Windows: freeglut binaries are part of the zip file * Linux/MacOS: GLUT installation (e.g. freeglut using brew) * Test application calls SGL functions declared in ''sgl-{cpp,rust,zig}/include/sgl.h'', which is the fixed (immutable) interface of SGL from your point of view * Implement functions in ''sgl-{cpp,rust,zig}/src/*'' * Switch contexts using keys 0-9 * [[https://cent.felk.cvut.cz/courses/APG/doxygen/sgl_8h.html|SGL API documentation]] ==== Homework Assignment I ==== === 2D Graphics Library, part A === {{courses:b4m39apg:seminars:apg1.pdf|Presentation}} * Library initialization, data structures design * Rasterization of basic primitives: * Point * Line and polyline (Bresenham's algorithm) * Circle (Bresenham's algorithm) * Ellipse (sglEllipse) and arc (sglArc): * Approximation of ellipse by 40 line segments * Approximation of arc by 40*(from-to)/(2 PI) line segments * BONUS: * Adaptive approximation of ellipse and arc with an error of less than 1 pixel (1 point) * Transformations: * Modeling transformations (translation, rotation, scale) * Orthographic projection (sglOrtho) * Viewport transformation * Transformation stack === Reference Images === graphics elements\\ {{courses:b4m39apg:seminars:test1a-ref.png?200x150|graphics elements}} transformations\\ {{courses:b4m39apg:seminars:test1b-ref.png?200x150|transformations}} transformation stack\\ {{courses:b4m39apg:seminars:test1c-ref.png?200x150|transformation stack}} ==== Homework Assignment II ==== === 2D Graphics Library, part B === {{courses:b4m39apg:seminars:apg2.pdf|Presentation}} * Non-convex polygon filling: * Polygon definition (sglBegin(SGL_POLYGON)) * Self-intersecting polygon filling, so don't use seed filling! * Filling circle, ellipse, and arc * Perspective projection (sglFrustum) * Depth management via z-buffer * BONUS: * [[https://www.researchgate.net/publication/2893969_Perspective-Correct_Interpolation|Perspective correct interpolation of vertex attributes]] ([[https://www.comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf|PDF]]) (1 point) === Reference Images === non-convex polygon filling\\ {{courses:b4m39apg:seminars:test2a-ref.png?200x150|non-convex polygon filling}} graphics elements filling\\ {{courses:b4m39apg:seminars:test2b-ref.png?200x150|graphics elements filling}} 3D scene rendering - cube with z-buffer enabled/disabled\\ {{courses:b4m39apg:seminars:test2c-ref.png?200x150|3D scene rendering - cube with z-buffer enabled/disabled}} 3D scene rendering - NFF file\\ {{courses:b4m39apg:seminars:test2d-ref.png?200x150|3D scene rendering - NFF file}} ==== Homework Assignment III ==== === Simple Ray Tracer, part A === {{courses:b4m39apg:seminars:apg3.pdf|Presentation}} * Scene definition via SGL API (see sgl.h) * Primary rays generation: * Transformation matrix inverse * {{courses:b4m39apg:seminars:invert-matrix.cpp.zip|Matrix inverse from Numerical Recipes in C}} * {{courses:b4m39apg:seminars:ray-sphere.cpp.zip|Ray-sphere intersection}} * Ray-triangle intersection: [[https://dl.acm.org/citation.cfm?id=272315|Moeller]] or {{courses:b4m39apg:seminars:triangle-pbrt.cpp.zip|PBRT}} * Phong lighting model: * Material definition (see sglMaterial) * Diffuse coefficients: [r*kd g*kd b*kd] * Specular coefficients: [ks ks ks] * BONUS: * Adaptive anti-aliasing (1 point), * Multiple lighting models support: [[https://dl.acm.org/doi/10.1145/357290.357293|Cook-Torrance]] or [[http://www.graphics.cornell.edu/pubs/2005/Wal05.html|Ward]] (1 point) === Test scenes and reference images === sphere\\ {{courses:b4m39apg:seminars:test3a-ref.png?200x200|sphere}} Cornell box\\ {{courses:b4m39apg:seminars:test3b-ref.png?200x200|Cornell box}} sphere on floor\\ {{courses:b4m39apg:seminars:test3c-ref.png?200x200|sphere on floor}} ==== Homework Assignment IV ==== === Simple Ray Tracer, part B === {{courses:b4m39apg:seminars:apg4.pdf|Presentation}} * Shadow rays * Secondary Rays: recursive ray tracing: * Reflections and {{courses:b4m39apg:seminars:refract.cpp.zip|refractions}} * Max. recursion depth 8 * Backface culling: ignore intersections if DotProd(normal,dir)>0.0 * BONUS: * Depth of field (1 point) === Test Scenes and Reference Images === shadows\\ {{courses:b4m39apg:seminars:test4a-ref.png?200x200|shadows}} reflections and refractions\\ {{courses:b4m39apg:seminars:test4b-ref.png?200x200|reflections and refractions}} multiple reflections and refractions\\ {{courses:b4m39apg:seminars:test4c-ref.png?200x200|multiple reflections and refractions}} ==== Homework Assignment V ==== === Simple Ray Tracer, part C === {{courses:b4m39apg:seminars:apg5.pdf|Presentation}} * Area light sources: * Emissive materials support (see sglEmissiveMaterial) * Point sampling on triangles, 16 samples per triangle * Intensity of light samples (Phong lighting model): * sample_i = (r,g,b)*cos fi*(light_triangle_area/num_samples)/(c0 + c1*d + c2*d^2) * cos fi = DotProd(light_triangle_normal, -shadow_ray.direction) * Environment mapping ({{courses:b4m39apg:seminars:hdr-images.zip|HDR images}}): * Use environment map instead of constant background color (see sglEnvironmentMap) * Mapping ray direction to environment map coordinates (u,v) [0,1]x[0,1]: * d = sqrt(dir.x^2 + dir.y^2) * r = d>0 ? acos(dir.z)/(2*PI*d) : 0.0 * u = 0.5 + dir.x * r * v = 0.5 + dir.y * r * BONUS: * Textures support (2 points) === Test Scenes and Reference Images === area light source\\ {{courses:b4m39apg:seminars:test5a-ref.png?200x200|area light source}} color area light source\\ {{courses:b4m39apg:seminars:test5b-ref.png?200x200|color area light source}} environment map St. Peter's Basilica\\ {{courses:b4m39apg:seminars:test5c-ref.png?200x200|environment map St. Peter's Basilica}} environment map St. Uffizi Gallery\\ {{courses:b4m39apg:seminars:test5d-ref.png?200x200|environment map St. Uffizi Gallery}}