GithubHelp home page GithubHelp logo

wangxihao / rtowcudaglfw Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gomezzz/rtowcudaglfw

0.0 1.0 0.0 520 KB

Ray Tracing in One Weekend (RTOW) in Cuda with a GLFW live render display

License: GNU General Public License v2.0

C++ 75.09% C 3.19% Cuda 21.72%

rtowcudaglfw's Introduction

Ray Tracing in One Weekend (RTOW) in Cuda with a GLFW live render

DISCLAIMER: This code is intended to be close to the original RTOW tutorial and thus uses neither modern C++ nor is it pretty, production-ready or anything like that.

1800x900 Render of the current default scene at 3000 samples.

The purpose of this code is to have a functional version of the RTOW code in CUDA with a live render output using GLFW. Thus, one can continue integration of more sophisticated features etc. without having to look at the generated image files all the time. If you have any ideas for improvements feel free to submit pull requests or comment.

I intentionally included my VS 2019 project files to allow a rapid start. Also, I added references in the code where each excerpt is discussed in RTOW and a bunch of comments.

The code builds on three different tutorials:

Structure

  • camera.h,hitable.h,hitable_list.h,material.h,ray.h,sphere.h,vec3.h - These files are similar to the RTOWCuda tutorial by Roger Allen
  • check_cuda.h - Used throughout the project to display potential CUDA errors
  • interop.cpp,interop.h - These are close to the tutorial by Allan MacKinnon
  • main.cpp, kernel.cu - These were modified to allow the live render display

For changing resolution, CUDA blocks / threads and the world (spheres etc.) configuration have a look at the settings section in kernel.cu

Requirements

  • CUDA>=10.2 (lower might work, not tested)
  • GLFW - This will have to be added to includes and you need to link the appropriate lib
  • glad - You will need to include your own glad.c file into the project and add the includes
  • Visual Studio 2019 - If you want to use the included VS solution file. Unfortunately, I don't have the time to create a cross-platform version using CMake right now. However, I am unaware of anything that would inhibit it.

For a great setup tutorial of GLFW and glad please refer to learnopengl.com

Execution

Once you get the solution up and running you are good to go. Note that Release mode in VS will give you much higher FPS. Still, this code is of course not particularly efficient at the moment.

I took the freedom to change the default scene for testing purposes. If everything works you should get a lower resolution version of the image at the top.

rtowcudaglfw's People

Contributors

gomezzz avatar

Watchers

James Cloos avatar

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.