All Projects → vkoskiv → C Ray

vkoskiv / C Ray

Licence: mit
C-Ray is a small, simple path tracer written in C

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to C Ray

Unitydxrtest
A testbed project for Unity real-time ray tracing features
Stars: ✭ 172 (-46.75%)
Mutual labels:  graphics, raytracing, ray-tracing
Retrace.gl
Create, ray trace & export programatically defined Signed Distance Function CSG geometries with an API suited for generative art - in your browser! 🎉
Stars: ✭ 149 (-53.87%)
Mutual labels:  graphics, raytracing, path-tracer
LumillyRender
Monte Carlo path tracing implementation on Rust
Stars: ✭ 36 (-88.85%)
Mutual labels:  path-tracer, raytracing, ray-tracing
Diligentcore
Core functionality of Diligent Engine
Stars: ✭ 263 (-18.58%)
Mutual labels:  graphics, raytracing, ray-tracing
Photon-v2
A program that takes photographs of a virtual world.
Stars: ✭ 75 (-76.78%)
Mutual labels:  raytracing, ray-tracing
ray-tracing
This is a go implementation of the "Ray Tracing in One Weekend" book
Stars: ✭ 37 (-88.54%)
Mutual labels:  sdl2, raytracing
MinecraftC
A Raytraced Minecraft Classic 0.0.30a port to C
Stars: ✭ 250 (-22.6%)
Mutual labels:  sdl2, raytracing
Yune
GPU based framework for writing Raytracers/Pathtracers. (Pronounced as "Yu-nay")
Stars: ✭ 64 (-80.19%)
Mutual labels:  path-tracer, ray-tracing
ray-tracer
A simple ray tracing engine
Stars: ✭ 27 (-91.64%)
Mutual labels:  raytracing, ray-tracing
RayTracedGGX
Ray tracing sample using GGX reflection model, 1spp with spatial-temporal denoiser. Acceleration structure build uses async compute.
Stars: ✭ 43 (-86.69%)
Mutual labels:  raytracing, ray-tracing
Unreal-Development-Guides-and-Tips
High-level concept explanations, detailed tutorials, performance considerations, shortcuts and other useful content that aims to improve your Unreal Engine 4 development journey.
Stars: ✭ 118 (-63.47%)
Mutual labels:  raytracing, ray-tracing
awesome-rtx
Curated collection of projects leveraging NVIDIA RTX technology (OptiX, DXR, VKR)
Stars: ✭ 73 (-77.4%)
Mutual labels:  raytracing, ray-tracing
webrays
WebRays - Ray Tracing on the Web
Stars: ✭ 38 (-88.24%)
Mutual labels:  raytracing, ray-tracing
fluctus
An interactive OpenCL wavefront path tracer
Stars: ✭ 55 (-82.97%)
Mutual labels:  path-tracer, raytracing
Tinykaboom
A brief computer graphics / rendering course
Stars: ✭ 2,077 (+543.03%)
Mutual labels:  graphics, raytracing
ProtoTracer
3D rendering and animation engine for multifaceted displays on microcontrollers
Stars: ✭ 80 (-75.23%)
Mutual labels:  raytracing, ray-tracing
Flycube
Graphics API wrapper is written in C++ on top of Directx 12 and Vulkan. Provides main features including ray tracing.
Stars: ✭ 78 (-75.85%)
Mutual labels:  graphics, raytracing
Yocto Gl
Yocto/GL: Tiny C++ Libraries for Data-Driven Physically-based Graphics
Stars: ✭ 1,391 (+330.65%)
Mutual labels:  graphics, path-tracer
Vanilla-Raytraced
Official repository of Vanilla Raytraced resources pack.
Stars: ✭ 25 (-92.26%)
Mutual labels:  raytracing, ray-tracing
Edxray
A physically based renderer which implements many state of the art techniques in light transport simulation, material modeling, sampling and reconstruction.
Stars: ✭ 270 (-16.41%)
Mutual labels:  graphics, raytracing

Example renders


(1000 samples, 1920x1080, 512 max bounces, 26min, scene by Scott Graham)


(2500 samples, 2560x1600, 512 max bounces, 43min)

Status

Build Status

Synopsis

C-ray is a research oriented, hackable, offline CPU rendering engine built for learning. The source code is intended to be readable wherever possible, so feel free to explore and perhaps even expand upon the current functionality. See the contributing section in the wiki for more details.

C-ray currently has:

  • A simple unidirectional Monte Carlo integrator
  • Real-time render preview using SDL2
  • Easy scene compositing using a JSON interface
  • Multithreading (using pthreads or WIN32 threads)
  • Wavefront OBJ mesh loading with transforms for compositing a scene
  • Object instancing
  • PNG and BMP file output
  • Two levels of BVH acceleration structures (by @madmann92)
  • Antialiasing (MSAA)
  • HDR environment maps for realistic lighting
  • Gouraud interpolated smooth shading
  • Benchmarking metrics

The default integrator supports:

  • Metal
  • Glass
  • Lambertian diffuse
  • Plastic
  • Triangles and spheres
  • Depth of field
  • Russian Roulette path optimization
  • Diffuse textures
  • Normal maps

Things I'm looking to implement:

  • Proper physically based materials in place of the current ad-hoc implementations
  • Built a more robust API with an interactive scene state.
  • Some procedural textures
  • Python API wrapper
  • Networking and clustered rendering
  • Volumetric rendering
  • Subsurface scattering
  • Spectral rendering

Compatibility

C-ray has been verified to work on the following architectures

  • x86 & x86_64 (Primarily developed on x86_64)
  • ARMv6, ARMv7 and ARMv8 (Various Raspberry Pi systems)
  • PowerPC 7xx and 74xx (PowerPC G3 and G4 systems)
  • MIPS R5000 (1996 SGI O2)
  • SuperSPARC II (1992 SUN SparcStation 10)

Usage

Please see the Wiki for details on how to use the JSON scene interface.

Dependencies

  • CMake for the build system
  • SDL2 (Optional, CMake will link and enable it if it is found on your system.)
  • Python3 (Optional, it's used for some utility scripts)
  • Standard C99/GNU99 with some standard libraries

All other dependencies are included as source

Installation

macOS: Either follow these instructions, or the instructions for Linux below. Both work fine.

  1. Install SDL2 (See installing SDL below)
  2. Open the .xcodeproj file in Xcode
  3. Edit scheme by clicking C-Ray in top left, make sure 'Use custom working directory' is ticked and set it to the root directory of this project.
  4. Go into the Arguments tab, and add by clicking +. Type in ./input/scene.json, then click close
  5. Build&Run with CMD+R

Linux:

  1. (Optional) Install SDL2 (See installing SDL below)
  2. Run cmake ., or optionally cmake . -DNO_SDL2=True to disable SDL2.
  3. Run make to build the project
  4. Run binary: ./bin/c-ray ./input/scene.json (Making sure the working dir is the root directory). You can also pipe files into C-ray and it will read from there. This is useful for scripts that invoke C-ray. Example: cat input/scene.json | ./bin/c-ray Note: Reading the json from stdin assumes that the asset path is ./

Windows:

  1. Download SDL2 Development libaries from here and extract: https://www.libsdl.org/download-2.0.php (https://www.libsdl.org/release/SDL2-devel-2.0.8-VC.zip)
  2. Open a x64 Native Tools Command Prompt and set path to SDL2DIR (where you extracted the files to, should have a few folders like 'include' and 'lib'): set SDL2DIR=E:\sdl2\SDL2-devel-2.0.8-VC\SDL2-2.0.8
  3. Run cmake: cmake -G "Visual Studio 15 2017 Win64" .
  4. (Optional) Edit src\includes.h to uncomment #define UI_ENABLED and copy your SDL2.dll into bin\Release\
  5. Build the generated solution: msbuild c-ray.sln /p:Configuration=Release
  6. Run: bin\Release\c-ray.exe input\scene.json or type input\scene.json | bin\Release\c-ray.exe

Installing SDL

On macOS, use homebrew to install SDL. brew install sdl2

On Windows, download from https://www.libsdl.org/release/SDL2-devel-2.0.8-VC.zip

On Linux using APT, run sudo apt install libsdl2-dev

Tests

You can run the integrated test suite by invoking the test script like this: ./run-tests.sh This will compile C-ray with the correct flags, and then run each test individually in separate processes. If you want to run them in a shared process, do ./bin/c-ray --test

In either case, you will get a log of all the tests, and their status.

Credits

3rd party libraries included in this project

lodePNG PNG compression library: http://lodev.org/lodepng/

stb_image.h by Sean Barrett: https://github.com/nothings/stb/blob/master/stb\_image.h

SDL2: https://www.libsdl.org/index.php (Optional)

JSON parsing library: https://github.com/DaveGamble/cJSON

PCG random number generator: http://www.pcg-random.org

Contributors

  • Huge thanks to @madmann91 for the new BVH accelerator and overall ~60% performance improvement!

Please file an issue detailing any improvements you're planning on making. I openly welcome contributions!

You can also ping me on Discord: vkoskiv#3100

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].