Simple Spheres raycasting in CUDA (rendered with openGL).
Some parameters are avaliable to configure before starting the raycasting. They include
- the number of spheres
x, y, z(for location) and radius values ranges- spheres material (choice from predefined list)
- number of sources of lights
- location and radius ranges for light sources
- Phong reflection model parameters for lights (ranges)
- camera resolution (which determins the number of cast rays)
Parameters can be loaded from file within the executable location (check example config in repo)
After the start of casting user has fewer options at their disposal.
-
Ambient component of Phong reflection model can be changed (value
0 - 1) -
Animation mode can be set to rotate the lights around the center of the scene with time.
-
User can select to rotate the light sources or the spheres around the center of the scene.
-
Camera movement is not possible.
- Rays are cast from the camera position along the Z axis and intersection with spheres in the scene are checked. After failing to implement LVBH myself (to be fair I didn't try particulary hard) I have used this github project.
- Based on ray intersection with spheres Phong reflection model parameters and the pixel color are calculated
- Color is written to openGL texture
- Texture is render on the screen by openGL
- Nvidia Developer Technical Blog: Thinking in parallel
- Phong reflection model
The project uses
- GLFW (managing windows)
- glad (openGL loader (and more))
- openGL
- CUDA
- Dear imGui (controls)
- lbvh implementation by Toru Niina
- GML (math)
Build in Visual Studio 2022 with CUDA support. Installation steps can be found here.
Dependencies are placed in the Libraries subdirectory or are directly part of source files.



