Skip to content

Mourtz/raytracer-0

Repository files navigation

Pathtracing using the WebGL API

This is a not functional raytracer. It is entirely written in Javascript, using the WebGL2 API to carry out all computations. Is kinda modular, allowing the end user to toggle some basic functionalities like "un/biased rendering", "procedural sky", "next event estimation" and "Bi-Directional path tracing".

On low end devices, the GLSL compiler is usually crashing due to the large amount of code that is being passed by the main fragment shader. Of course the amount of computational power needed to run the renderer depends on the complexity of the scene. On my current system I have a GTX 960m and the driver doesn't crash that regularly, so any graphics card with 1.5 GFLOPS and above should be running fine.

It seems to be working fine on Windows using Angle, Google Chrome is highly suggested as it gives me the lowest render times among of all the browsers I 've tested.

List of features

  • generative texture mapping
  • procedurally generated textures
  • supports color, emission and specular textures
  • supports raytracing of Quadric & Euclidean surfaces
  • supports raymarching of signed distance fields
  • multiple light sampling
  • Reinhard tone mapping
  • cosine weighted importance sampling

Demo (Let it fetch all the required data before hitting the render button!)


@ToDo List

  • bump mapping
  • split the main shader into three (1st for eye path tracing, 2nd for light path tracing, 3rd for merging the paths) to reduce the probability of the driver crashing during compilation.
  • HLBVH support(some work has been done already)
  • participating media
  • volumetric SDF
  • functional camera controls
  • BSSRDF

Future Plans

I have already started working on my next raytracer written in C++. The library I chose to use for GPU acceleration is OpenCL 1.2 by Khronos. However, Arrayfire seems like a good tool I could make use of in the future.

Gallery

alt text

alt text

alt text

Show more

Credits

iq - Inigo quilez
Toshiya Hachisuka - Toshiya Hachisuka
reinder - Reinder Nijhoff
erichlof - Erich Loftis