Skip to content

alex-stavrin/software_ray_tracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image (1920x1080)

Image

Parallel execution

For rendering a 4k image for the final result. Times are:
Serial = 9.28 s
Parallel = 1.60 s
Speedup = $\frac{9.28}{1.60}= 5.8$

Platforms

Linux (CMake)

To compile cmake -B build -S . && cmake --build build
To run ./build/computer_graphics_from_scratch

Windows

Use Visual Studio

Canvas and width

Lets say we have resolution 1000x1000

Canvas

width : [-500, 499]
height : [-500, 499]

Screen

screen width : [0, 999]
screen height : [0, 999]

Book formula

The formula the book says is:

screen_width = canvas.width / 2 + canvas_x
screen_height = canvas.height / 2 + canvas_y

Program results

screen_width_min = 1000 / 2 + -500 = 0 CORRECT
screen_width_max = 1000 / 2 + 499 = 500 + 499 = 999 CORRECT

screen_height_min = 1000 / 2 + 500 = 500 + 500 = 1000 WRONG
screen_height_max = 1000 / 2 - 500 = 500 - 499 = 1 WRONG

Fix

So for height we must do -1

About

Software ray tracer following Computer Graphics from Scratch tutorial

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors