Realtime graphics on GPU - labs summer semester 2019/2020

In order to pass the lab exercises, you need to pick 2 assignments from the pool below, implement them and submit them by e-mail by 30. 6. 2020 (may get postponed due to COVID-19 situation). Use separate messages for each project and use a meaningful subject like "NPGR019 - {name of the project}". I will send you e-mail confirming delivery followed by further questions (if any) and the result.

Please, for all communication use the following e-mail address: {name}.{surname}.88{at}gmail{dot}com, where name and surname refers to my name. Be considerate and fill properly your name in your e-mail client so I don't need to pair suspiciosly looking nicknames to your real names and/or fish your messages from the spam folder.

Lab exercises overview

Important: Labs will continue in an online form via YouTube videos that I'll start posting in the week of 16th March.


25. 2. & 26. 2. 2020

3D Scene

3. 3. & 4. 3. 2020

  • Gentle re-introduction to a first OpenGL program
  • Introduction to a first 3D scene
  • Working with buffers: vertex array objects, vertex and index buffers

  • Hello cube (MSVS Solution, .zip, 560 kB, updated)
  • Exercises (.txt, 1.6 kB)

3D Scene revisited

10. 3. & 11. 3. 2020 - YouTube video

Depth buffer

22. 3. 2020 - YouTube video

Projection, depth buffer, textures

29. 3. 2020 - YouTube video

Textures, instancing

5. 4. 2020 - YouTube video
13. 4. 2020 - YouTube video

Shading and lighting

22. 4. 2020 - YouTube video
4. 5. 2020 - YouTube video

Shadow volumes

11. 6. 2020 - YouTube video

Flocking simulation

23. 6. 2020 - YouTube video

  • Compute shader
  • Flocking simulation

  • Flocking simulation (MSVS Solution, .zip, 2.3 MB)
  • Exercises (.txt, 882 B)
  • 2019 tutorials archive (MSVS Solution, .zip, 2.3 MB)
  • Useful resources

    • GLFW - multi-platform library abstracting the window creation and more.
    • SDL - multi-platform library allowing window creation, sound handling etc.
    • GLAD - GL loader generator for .dll.
    • GLM - OpenGL Mathematics library. C++ header only mimicing GLSL.
    • Assimp - Open Source Asset Import Library.
    • STB Image - Open source, easy to use image loading library.`

    Semestral project assignments

    You should implement 2 of the following assignments. You can also choose to implement one with all the bonuses if present as it amounts to 2 assignments in a row. OpenGL and C/C++ are preferred and strongly recommended for the implementation but I can handle also Python, C#, WebGL, or D3D11, provided you supply me with easy to compile and run solution that doesn't need too much overhead to get up and running. You can use whatever resources you'd like (textures, models, model loading libraries) but I suggest you keep the assignment as simple as possible and focus only on the task at hand. All of the required geometry and textures for the assignments can be usually hardcoded in the program, e.g., use simple planes, cubes, cylinders, spheres. Please provide interactive camera in all submissions.

    The source code must be well commented so I can decypher what you are trying to achieve and I can see that you understand your code. The handed-in assignments should ideally compile and run on Windows machine under MSVS 2017, I'll be using that as a primary testing machine. Linux is also possible but in all cases I expect that your solution will compile and run without any unreasonable effort (see above).

    Don't forget to bundle all needed external resources and/or .dll files needed to run. Make sure you clean the project before packing so you don't send me compiler generated object files, MSVS debug symbol and intellisense databases, etc. For reference, all of my example programs shown during the labs last year were under 3 MB packed in a .zip file including textures. Finally, before sending your submissions, please make sure that the program can be compiled and run on different PC (or at least from different folder on your PC - hardcoded paths to your username documents folder may be one of the problems). If the filesize exceeds 10 MB, please upload the solution somewhere and send a link instead.

    Shadow maps for point and spot lights

    Shadow mapping is de-facto standard for casting shadows into a computer generated scene in real-time. It is usually implemented using directional lights, i.e., sun. However, we may want to have point lights and spot lights in the scene casting shadows as well. That is the goal of this assignment: implement a simple scene that uses at least one point light and one spot light to cast shadows using shadow mapping.

    The scene you create should be sufficiently complex, e.g., several cubes and spheres on a plane that act as both occluders and shadow receivers. It should provide enough varied geometry to assess how you fought with common shadow map artifacts like Peter panning and shadow acne.


    • Render scene with at least 2 light sources (one spot light, one point light)
    • Solve common artifacts, i.e., shadow acne, Peter panning, and shimmering
    • Filter the shadows using either Percentage Closer Filtering, or, Poisson Disk Sampling for smooth edges


    • Use geometry shader to render all omnidirectional shadow maps in one pass
    • Implement receiver plane (also called adaptive, or per texel) depth bias
    • Alternative: Implement Variance Shadow Maps (for point and spot lights, of course)

    Cartoon shader

    Implement a non-photorealistic toon or cel shader with contours. To generate contours you can employ, for example, a classic method of analyzing depth buffer and scene normals for edge detection, or you can use geometry shader to generate silhouettes.


    • Pixel shader cel shading effect
    • Contours for silhouette edges
    • Use interesting geometry showing off the effect, e.g., Utah teapot

    Mirror, mirror

    Utilize a stencil buffer to render a scene with a mirror reflecting it. Alternatively, you can render a scene with portal showing the scene from a different angle.


    • Create interesting, sufficiently complex scene
    • Place a mirror to the scene so its geometry will be reflected
    • Or place a portal and allow for simultaneous viewing of the scene through it

    Depth of field

    Create a post-process depth of field effect on a 3D rendered scene.


    • Create interesting 3D scene with enough depth, i.e., line of columns or other objects
    • Employ compute shaders to create a post-process depth of field
    • Allow for automatic focus changing

    Volumetric data visualization

    Implement a simple volumetric data visualization using basic methods like maximum intensity projection, average intensity projection, summed intensity projection, transfer functions.


    • Load or generate a volume and visualize it using methods mentioned above

    Copyright (C) 2015-2020 Martin Kahoun