Awesome Open Source
Awesome Open Source


CI codecov Latest Docs DOI DOI

This package was written in the early days of Flux / Zygote. Both these packages have significantly improved over time. Unfortunately the current state of this package of has not been updated to reflect those improvements. It also seems that it might be better to gradually transition to AD systems like Diffractor (which will potentially have good support for mutations) / define the adjoints directly using ChainRules since Zygote will likely not be having these features (note there has not been an official announcement and the statement is based on some discussions in zulip forum)

A Ray Tracer written completely in Julia. This allows us to leverage the AD capablities provided by Zygote to differentiate through the Ray Tracer.


This package is registered. So open up a Julia 1.3+ repl and enter the pkg mode.

julia> ]
(v1.3) pkg> add RayTracer

To use the master branch (not recommended) do.

julia> ]
(v1.3) pkg> add RayTracer#master



Follow the instructions below to run individual examples or use examples/ to run all of them together.

First we need to get the versions of the packages used when these examples were written.

$ cd examples
$ julia --color=yes -e "using Pkg; Pkg.instantiate()"

Now we can run any of the file we need by julia --project=. --color=yes "/path/to/file"

Running Individual Examples

$ mkdir meshes
$ cd meshes
$ wget
$ wget
$ cd ..

$ mkdir textures
$ cd textures
$ wget
$ wget
$ cd ..

This example requires a few arguments to be passes from command line. Chack them using

julia --project=. --color=yes "performance_benchmarks.jl" --help

$ wget 
$ wget

Additional Examples

Duckietown.jl uses RayTracer.jl for generating renders of a self-driving car environment. For more complex examples of RayTracer, checkout that project.


This software was developed as part of academic research. If you would like to help support it, please star the repository. If you use this software as part of your research, teaching, or other activities, we would be grateful if you could cite the following:

  doi = {10.21105/jcon.00037},
  url = {},
  year = {2020},
  publisher = {The Open Journal},
  volume = {1},
  number = {1},
  pages = {37},
  author = {Avik Pal},
  title = {RayTracer.jl: A Differentiable Renderer that supports Parameter Optimization for Scene Reconstruction},
  journal = {Proceedings of the JuliaCon Conferences}


These are not listed in any particular order

  • [X] Add more types of common objects (use mesh rendering for this)
  • [X] Add support for rendering arbitrary mesh
  • [X] Inverse Rendering Examples
  • [X] Texture Rendering
  • [ ] Application in Machine Learning Models through Flux (work in progress)
  • [ ] Major Overhaul using Flux3D.jl
  • [ ] Exploit the latest improvements to Flux and Zygote

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
machine-learning (3,538
julia (640
optimization (281
raytracer (31
gradient-descent (25
differentiable-programming (16

Find Open Source By Browsing 7,000 Topics Across 59 Categories