mattboran / CudaRT

Photorealistic CPU or GPU (NVidia only) rendering engine written in C++/CUDA.
3 stars 0 forks source link

Stream Compaction and Splitting Up Kernels #37

Closed mattboran closed 5 years ago

mattboran commented 5 years ago

An idea to improve coherence is to split up rendering into several kernels.

Have a generateCameraRays kernel that takes a pointer to a camera, and populates a thrust::device_vector with rays. Then, have a sampleRay kernel that takes the vector of rays and computes the color at each ray in the case of direct lighting otherwise modifies the mask at that pixel index before passing along the ray for the next call of sampleRay.

mattboran commented 5 years ago

The overhead of transferring memory between host and device in the case of generating camera rays is actually inefficient and causes a slowdown in performance.