datagarden

datagarden is a data visualization application written for the web. The renderer is written in C++, and compiles to webassembly using emscripten. The client is a React application written in TypeScript. The server is written in go, and serves the React application.

When all components are built and running, a web application serving an interactive 3d data visualization is accessible at localhost:8080/visualization.

The codebase contains a makefile that has build targets for the renderer, client and server, as well as utilities to clean generated code, and to start all services.

Overview

Random data points interpreted as sized and colored spheres in 3d space

Random data points interpreted as rotating, sized and colored cubes in 3d space

Shapes

A few primitive shapes are supported:

  • Cube

  • Sphere

  • Cylinder

Lighting

Three light types are included in datagarden:

  • Direction

  • Point

  • Spot

Source Code

jp tracer

Overview

jp tracer is a raytracer built in rust. It was developed with as few dependencies on external crates as possible. It only depends on the crates:

  • num: for utilities on numbers types

  • chrono: to get UTC time for filename generation

  • rand: for random number generation

Everything else is implemented in the codebase, including a linear algebra math suite, and obj file loader. File output is also handled by writing raw colors to ppm output files. A full test suite has been developed as well.

Shapes

A number of primitive shapes are supported:

  • Triangle

  • Plane

  • Sphere

  • Cube

  • Cylinder

  • Cone

Constructive Geometry

All of the primitive shapes can be combined, or negated from each other in order to produce more complicated shapes. The constructive geometry operations are:

  • Union

  • Intersection

  • Difference

Constructive geometry can be subtractive (left), or additive (right)

Models

Models can be loaded from obj files, and rendered using jp tracer. The model is either loaded as a collection of Triangles (sharp edged), or Smooth Triangles (smooth edged). When loaded as Triangles each vertex takes on the normal of the triangle it belongs to, while Smooth Triangle normals interpolate points across all shared faces.

A model loaded from an obj file

Models can be rendered with vertex normals, smooth shading (left), or face normals, sharp edges (right)

Lighting

Point lights are the only light source supported in jp tracer

Multithreading

Multithreading is optionally available as well, which works by splitting the drawing canvas into equal sections, and creating threads to run the raytracing algorithm on each canvas section, before accumulating the results and outputting them to a saved file.

Antialiasing

Antialiasing is supported, up 16 reads per pixel.

Antialiasing on

Antialiasing off

Source Code

labyrinth

labyrinth is a maze game, with procedurally generated mazes, with written in C++ and utilizing SDL2.

Overview

Segment of a procedural maze

Exit of a procedural maze

Rendering

labyrinth generates a maze represented in 2d, and utilizes raycasting to generate the scene in 3d, in real time. Basic texture projection was implemented as well, in order to draw simple pixel are over surfaces.

The technology was inspired by classic games, such as doom and Wolfenstein, which employed similar algorithms.

Gameplay

When started up a random maze is generated- the dimensions can be configured, and the player is placed in a random location in the resulting maze. The player must navigate the maze, controlling the camera with the “w”, “a”, “s” and “d” keys to move in real time. The objective is to locate a single exit, which is represented by a doorway in a wall. Once the player enters the doorway the game ends, and outputs a file with time indicating how many seconds it took the player to navigate the maze.

Source Code