Skip to content

stevelonny/jujutracer

Repository files navigation

jujutracer

Julia Licence Docs stable Docs dev Test

Simple raytracer built in julia by Boldini M., Galafassi G. and Lonardoni S. during Calcolo Numerico per la Generazione di Immagini Fotorealistiche (AY 2024/25) @ UNIMI.

Reflective surface

Installation

Clone this repository.

git clone https://github.com/stevelonny/jujutracer.git

Then activate the environment and instantiate the dependencies.

cd jujutracer
julia --project=.
using Pkg
Pkg.activate(".")
Pkg.instantiate()

Enjoy the code! Either use the REPL or use the scene definition language to define your scene and render it as per documentation.

Renderings

The code can be used in two main ways:

  • As a library in the REPL, as demonstrated in the scripts folder. Examples of these scenes are shown in examples.
  • Using the provided interpreter to define scenes, like those in the scenes folder. Usage example:
    julia -t auto interpreter.jl scenes/<file_name>

For more details on using the REPL or defining scenes, please refer to the official documentation.

Usage

Conversion PFM -> LDR formats

The user must provide the input file in the correct PFM format, the a value and gamma correction value, and the output file, which must be of the .png or .jpg extension.

julia main.jl <pfm_file> <a> <gamma> <output_file>

Multi-thread support

See issue #22

The code leverages multi-threading in a clean way simply by parallelizing each ray fired using the @threads keyword.

To leverage multi-thread, launch julia with the correct flag t and the number of threads to be assigned (or the auto keyword).

julia -t auto demo.jl <output_file> <width> <height> <cam_angle>
julia -t auto demoCSG.jl <output_file> <width> <height> <cam_angle>

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

This project is licensed under the MIT "Expat" License

About

Simple Raytracer built in julia

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages