Several assignments, including ray casting, particle sims and shader pipelines https://github.com/IDLab-MEDIA/cg-01-tdpeuter
This repository has been archived on 2024-12-30. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Find a file
Tibo De Peuter d9cf26902e
Some checks failed
CMake / build (zip, zip, [self-hosted Linux], raytracing, ux) (push) Has been cancelled
CMake / build (zip, zip, [self-hosted Windows], Release/raytracing.exe, win) (push) Has been cancelled
chore: Cleanup
2024-10-25 17:50:44 +02:00
.github GitHub Classroom Feedback 2024-10-11 10:47:19 +00:00
correct_results Initial commit 2024-10-11 10:27:35 +00:00
css Initial commit 2024-10-11 10:27:35 +00:00
data Initial commit 2024-10-11 10:27:35 +00:00
eigen/Eigen Initial commit 2024-10-11 10:27:35 +00:00
include Initial commit 2024-10-11 10:27:35 +00:00
lab1 chore: Cleanup 2024-10-25 17:50:44 +02:00
lib Initial commit 2024-10-11 10:27:35 +00:00
src chore: Cleanup 2024-10-25 17:50:44 +02:00
test test: Add tests 2024-10-25 17:50:32 +02:00
.gitignore chore: Import Lab1 2024-10-11 14:10:08 +02:00
02_RayTracing.html Initial commit 2024-10-11 10:27:35 +00:00
CMakeLists.txt chore: Set Lab1 default 2024-10-11 14:14:18 +02:00
main.cpp Initial commit 2024-10-11 10:27:35 +00:00
README.md add deadline 2024-10-11 10:47:22 +00:00

Review Assignment Due Date

Computer Graphics Lab2 - Ray Tracing

As explained in 02_RayTracing.html, your ray tracer reuses the ray casting code that you wrote in the previous assignment. This leaves you with two options.

Option 1: You feel confident that your code from lab 1 is correct. In this case, I would recommend that you copy-paste the 6 .cpp files from the src/ folder of the previous assignment into the lab1/ folder of this repository. In other words, your executable for this lab will also depend on your code from the previous lab.

Option 2: You know that your code from lab 2 is functionally incorrect/incomplete. We could give you our solution code, but that would spell all kinds of trouble. So instead we have compiled our solution code into a static library. Thanks to the CMakeLists.txt, CMake will link this library during compilation, and you will be able to call our methods, like first_hit() and viewing_ray() without viewing our source code. However, libraries are platform dependent, and we don't have the patience to compile one for every OS out there. We only support Windows, Ubuntu 20.04, Ubuntu 22.04 (Do you have a newer version and it works? Let us know.) and MacOS with Intel x86_64 chips (and the arm64 chips through Rosetta). More info below.

Submission

You know the drill. Check if your rgb.png files look exactly like those in the correct_results/ folder.

Building the project using CMake

Go ahead and have a quick look at CMakeLists.txt before you continue. There are 2 main changes.

  1. If you chose Option 1 (use your own files in lab1/), then you need to set the USE_OWN_SRC_FILES_LAB1 parameter on ON (explained below). Then the files in lab1 will be added to ${SRCFILES} and passed to the compiler through add_executable(${PROJECT_NAME} ${SRCFILES}). Compiling, building and running your code should go without a hitch.
  2. If you chose Option 2, then USE_OWN_SRC_FILES_LAB1 should be OFF. The lines link_directories(${LIB_PATH}) and target_link_libraries(${PROJECT_NAME} hw2) tell the compiler which static library to link.

Depending on your choice between Option 1 and 2, USE_OWN_SRC_FILES_LAB1 should be set to ON or OFF respectively. This can be achieved in several ways, for example:

  • by passing a command line arg to cmake, e.g.: cmake .. -DUSE_OWN_SRC_FILES_LAB1=ON.
  • by overwriting the 5th line in CMakeLists.txt, e.g.: option(USE_OWN_SRC_FILES_LAB1 "Use the cpp files in lab1/" ON)

Let's say that you were able to build your executable. When you run it, it will create not only rgb.png but also the familiar depth.png. If the latter is completely black or looks wrong, then your compiler is not correctly using the code from the previous lab. If you are using Option 2, it means that our static library is incorrect or does not support your platform, so consider switching to Option 1. If that really is not a possibility, contact us.

Linux, MacOS (and WSL Windows)

Pass -DCMAKE_BUILD_TYPE=Debug or -DCMAKE_BUILD_TYPE=Release to cmake on the command line. So for Option 1:

cmake .. -DUSE_OWN_SRC_FILES_LAB1=ON -DCMAKE_BUILD_TYPE=Debug  

For Option 2:

cmake .. -DCMAKE_BUILD_TYPE=Debug

MacOS new arm64 chips

The static libraries lib/*/mac/libhw2.a were compiled with the x86_64 architecture in mind. So in theory, if your Mac can compile the rest of the ray tracing code as x86_64 as well (using Rosetta), you should get a fully working x86_64 executable. This in turn can be run through Rosetta. We don't have a Mac to test this on, so we cannot make it work for you. This worked for one student last year, but there are no guarantees:

# download the x86_64 version of cmake
arch -x86_64 /usr/local/bin/brew install cmake  

# run cmake as usual, in the build folder
arch -x86_64 /usr/local/bin/cmake .. -DCMAKE_BUILD_TYPE=Debug

make

# run program
arch -x86_64 ./raytracing ../data/sphere-and-plane.json

Windows

Option 1: you can work in Debug or Release mode, as you wish.

Option 2: you can only work in Release mode, since we did not provide you with lib/Debug/win/hw2.lib. So don't forget to change to Release mode in Visual Studio, or your IDE of choice.

Chances are that you don't use CMake on the command line, so just alter line 5 in CMakeLists.txt to your liking.

Note: while building, you might get warnings like PDB 'hw2.pdb' was not found, ignore these.