Giter Site home page Giter Site logo

rtb7syl / grpathtracer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shadowwarden/grpathtracer

0.0 1.0 0.0 20.42 MB

Raytraced rendering of a Schwarzchild Black Hole

License: GNU General Public License v3.0

C++ 37.95% Python 0.69% Cuda 58.65% Makefile 2.70%

grpathtracer's Introduction

GRPathTracer

Raytraced rendering of a Schwarzchild Black Hole. master

alt text

Instructions for Compiling

You need the SDL1.2, freeglut and CUDA libraries to compile. To install the first two on ubuntu, run the following:

apt-get install libsdl1.2-dev libsdl-image1.2-dev freeglut3-dev

Installing CUDA is a pain in the neck, unfortunately. You need to install both the Nvidia driver and the CUDA libraries. Instructions to do this are provided here : http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#axzz4g7polGbZ

Once these packages are installed, run make to compile and ./bhfs to run the program

Note : I just about finished writing this, so I haven't had to chance to do any kind of optimization to increase FPS. In general, the following will make the program run a little faster:

  • Decrease the resolution (i.e width, height) in main.cu (You have to change int width and int height in line 12 and inside the CUDA kernel in line 95)
  • If you're really ambitious, try putting a pragma in front of the pixel rendering loop in line 206 of main.cu. The main bottlenecks are the computation itself (one way of speeding this up is to use rk4 and reduce the step size), the cudaMemcpys - which I can get rid off in the future with a compute shader or even a fragment shader - and the pixel rendering (which can almost certainly be made much faster)

I managed to get 15 frames per second on my system while actively raytracing (Nvidia GeForce 820M, 640x480, openmp pragma with 8 threads) compared to 1100 without the raytracing... Yeah, that's steep

Once in the program, use 'm' to switch between Newtonian and Relativistic modes. Newtonian rendering just uses raster operations and is thus super fast. Note : I think I goofed on the sign of phi, so left arrow will take you right and vice versa in the GR mode.

Arrow keys change theta and phi (distance to the Black Hole is fixed in GR mode)

'p' prints out current theta and phi for the camera

Spacebar prints the frame rate

grpathtracer's People

Contributors

shadowwarden avatar

Watchers

 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.