Skip to main content

Practical assignment #2


Assignment presentation
  • Prepare a 2 min video presenting your software;
  • Share the link to your GIThub repo through this form;
  • The practical assignment has to reside in a branch named PA2.
Requirements
    Use sources from PA#1 adding a new functionality as follows:
  • Render the surface with filled triangles using VBO (Vertex Buffer Object) technology with indices;
  • Add two sliders providing ability to control surface granularity over U and V directions;
  • Implement triangle shading method as per variant;
  • Implement vertex and pixel shaders that calculate intensity of illumination for the surface coming from a single light source: Irgb=Ambient+Diffuse+Specular that rotates in a circular motion around the surface. 
Resources
    The project we started to code at the lecture is here WebGL branch PA2

Details on Vertex Normals Calculation
    Pass the vertex normals as vertex attributes to GPU.
  • Analytic normal: implement the function calculating normal as a cross product of  partial derivatives (tangent vectors) along U and V directions of your surfacenormalize the result;
  • Facet Average normal: sum all facet normals that are adjacent to the vertex to form a vertex normal, normalize the result;
  • Facet Area Weighted Average normal: sum all facet normals that are adjacent to the vertex to form a vertex normal using area as a weight coefficient, normalize the result;
  • Facet Angle Weighted Average normal: sum all facet normals that are adjacent to the vertex to form a vertex normal using angle as a weight coefficient, normalize the result.
Details on Gouraud/Phong shading
    Implement the necessary code in .js and/or vertex/fragment shader.

Details on a point light source
  • pass coordinates of a light source to GPU as uniform parameter;
  • do not forget to multiply the coordinates by ModelView matrix before passing them to GPU.
Details on projection
    use single point perspective/orthographic matrix.

Hint
  • when calculating specular component you can take (0,0,1) direction vector as the vector pointing towards the viewer instead of calculating per-pixel direction (global viewer model);
  • intensity of the light source components can be hardcoded in the shader;
  • you can calculate the world coordinates of each point in fragment shader  interpolating vertex coordinates using hardware interpolator (varying keyword);
  • If you need to interpolate normals along primitive pass them to fragment shader using varying keyword.

Variant* Shading
Gouraud
Shading
Phong
Vertex
Normal
Analytic
Vertex
Normal
Facet
average
Vertex
Normal
Facet Area
Weighted
average
Vertex
Normal
Facet Angle
Weighted
average
1

V
V


2
V


V

3

V


V
4
V




V
5

V



V
6
V



V
7

V

V

8
V

V


9

V
V


10
V


V

11

V


V
12
V




V
13

V



V
14
V



V
15

V

V

16
V

V


17

V
V


18
V


V

19

V


V
20
V




V
21

V



V
22
V



V
23

V

V

24
V

V


25

V
V


26
V


V

27

V


V
28
V




V
29

V




30
V





*Variants higher than 30 start over from 1

Comments

Popular posts from this blog

Practical assignment #1 (Surface Rendering)

Assignment presentation Share screenshots presenting your assignment, the video and the link to your GIThub repo through  this form . The practical assignment has to reside in a branch named PA1. Prerequisites The credit module is based on WebGL interface brought in JS language. Suggested IDE for JavaScript is VisualStudio Code. How to start Use a skeleton WebGL project:  Project  as a fast way to start. https://webglfundamentals.org  is a comprehensive resource for studying WebGL protocol. Link to handbook The book of surfaces (the password equals to the first letters of the name of this credit module) Requirements Basing on the skeleton project add a new js script file containing Model object. Model object has to draw the surface wireframe as two sets of vertices: a set of U polylines and a set of V polylines. Figure out your order number in a list of the group you study at in campus system, that is your variant Render  wire-frame ...

DTE Lecture #1

 The lecture we describe the history of OpenGL, OpenGL ES and WebGL standards Переклад лекції українською