Git Product home page Git Product logo

cuda-raytracer's Introduction

cuda-raytracer

Simple Port of Raytracing in Series to CUDA

This project is largely insipired from Roger Allen's work.

It humbly diverges from it with respect to 2 aspects:

  • Build system is now CMake instead of a simple Makefile.
  • thrust is used for handling host side pointers.

With thrust the code looks a little more readable in my opinion, but for the relatively small scope of this project, I'm not sure if it makes that much of a difference.

Beware that you would need a relatively new version of CMake (3.18).

The branches of the repository is divided into small chunks to facilitate the digestion of newly coded material as per the project of Roger Allen.

The overall project structure is also arranged to make it easier to integrate with other projects.

Building

Assuming you have clang 9+, cmake 3.18+, a recent cuda compatible hardware, and CUDA toolkit (the code base is developped with CUDA 11 but it should be compatible with previous versions as well, no range reserving, or managed cudaMallocManaged etc).

  • cd build

  • ccmake ..

Choose your compiler (clang++) and cuda toolkit location. Then configure and generate.

  • make install

Depending on your compute capability gpu card you should modify CMakeLists.txt file.

All of the images below are realized with the following specs:

  • Device name: Quadro M2000M
  • Memory Clock Rate (KHz): 2505000
  • Memory Bus Width (bits): 128
  • Peak Memory Bandwidth (GB/s): 80.16

WARNING: MOST OF THE TIMINGS HERE ARE WRONG, see Known Issues.

Renders the screenshot below at 800 x 600 in 64.8672 seconds with 50 samples per pixel and 50 bounces per ray.

final screenshot

The one in below at 640x360 in 30.4133 seconds with 20 samples and 10 bounces. final screenshot second version

I don't remember the settings for this one. But it includes perlin noise so. final screenshot third version

The one in below at 800x450 in 49.5292 seconds with 500 samples and 500 bounces. final screenshot fourth version

The one in below at 640x360 in 106.365 seconds with 500 samples and 500 bounces final screenshot fifth version

The one in below at 480x270 in 101.325 seconds with 40 samples and 20 bounces final screenshot sixth version

Features

  • Most of what you get in Ray Tracing In One Weekend and in Next Week.

  • Multiple images in different sizes and channels.

  • Perlin Noise

  • Constant Medium Volume Rendering

  • A simple GPU friendly acceleration structure, a.k.a DA List, Foley et. al., 2013, p. 1081.

Planned

  • Asset loading with assimp.
  • Hopefully pdf handling in near feature.
  • Background handling.

Known Issues

I managed to fix the rng problem around nw-final branch. It was such a simple fix that i kind of feel stupid to let it sit there for so long.

For previous branches, just change the line

  • rcolor += ray_color(r, world, randState, bounceNb); to

  • rcolor += ray_color(r, world, &localS, bounceNb);

This increased significantly the rendering times so all of the rendering times above are compromised. By significantly, I mean it increases about two times more.

Cheers

cuda-raytracer's People

Contributors

d-k-e avatar viva-lambda avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dennis-lynch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.