OperatorGraph is the reference implementation for the ideas exposed in the paper Representing and Scheduling Procedural Generation using Operator Graphs.

It's essentially a toolkit offers an end-to-end solution to compile shape grammars as programs that efficiently run on CUDA enabled GPUs.

The toolkit consists of:

The implemented shape grammar - PGA-shape - is a rule-based language that enable users to express sequences of modeling operations in a high level of abstraction.

PGA-shape can be used as a C++/CUDA idiom or as a domain specific language (DSL). For example, to model a Menger sponge, you could write the following grammar in PGA-shape C++/CUDA,

struct Rules : T::List <
    /* rule[0]= */ Proc < Box, Subdivide, T::Pair< DynParam<1>, DCall<0>>, T::Pair< DynParam<2>, DCall<1>>, T::Pair< DynParam<3>, DCall<2>>>, 1>,
    /* rule[1]= */ Proc < Box, Discard, 1>,
    /* rule[2]= */ Proc < Box, IfSizeLess< DynParam<0>, DynParam<1>, DCall<0>, DCall<1>>, 1>,
    /* rule[3]= */ Proc < Box, Generate< false, 1 /*instanced triangle mesh*/, 
    DynParam<0>>, 1>,
> {};
or the equivalent grammar in PGA-shape DSL...
axiom Box A;

terminal B (1,0);

A = IfSizeLess(X, 0.111) { B | SubX };
ZDiscard = SubDiv(Z) { -1: A | -1: Discard() | -1: A };
YDiscard = SubDiv(Y) { -1: ZDiscard | -1: Discard() | -1: ZDiscard };
SubZ = SubDiv(Z) { -1: A | -1: A | -1: A };
SubY = SubDiv(Y) { -1: SubZ | -1: ZDiscard | -1: SubZ };
SubX = SubDiv(X) { -1: SubY | -1: YDiscard | -1: SubY }
Resulting in the following Menger sponge:

Grammars written with the C++/CUDA variant can be embedded in OpenGL/Direct3D applications, while grammars written with the DSL can be executed on the GPU with the interpreter shipped with the toolkit. The interpreter can also be embedded in an OpenGL/Direct3D application.

The main difference between the two methods is that with C++/CUDA the structure of the grammars directly influence the GPU scheduling, while with the DSL the execution on the GPU is scheduled the same way, independently of the grammar structure.

Grammars written with PGA-shape DSL can be analyzed by the auto-tunner and be optimized for GPU execution. The auto-tuner translates the DSL code to an intermediary representation - the operator graph - and then exploits the graph structure to find the best GPU scheduling for this grammar. When the best scheduling is found, the auto-tuner translates back the operator graph into C++/CUDA code. For more information, please refer to the paper.

Visit project website


PCSS is a C++/OpenGL implementation of the Percentage-Closer Soft Shadows technique.

Developed during my PhD's photorealistic rendering course.

Visit project website


cook-torrance is a C++/OpenGL implementation of the cook-torrance shader model.

Developed during my PhD's photorealistic rendering course.

Visit project website


SAT.js is a Javascript implementation of the Separating Axis Theorem for convex polygons and polyhedra.

Built with JavaScript and three.js.

Based on this article.

Also comes with a demo application that allows you to visualize SAT steps interactively:

Visit project website


roadgen is a road network generation tool based on the article Procedural Modeling of Cities. It was built with C# and Unity personal edition.

It features:

Visit project website

L-Systems in Unity

L-Systems in Unity is a set of scripts that enables Unity developers to rapidly create plants in their games using L-Systems.

It's based on the book Algorithmic Beauty of Plants and supports most of the context-free examples (0L-systems) presented there.

For example, with the 0L-system below, some simple assets and straight-forward configuration one can generate a fairly complex tree:

// 3D Tree 1.txt

number of derivations=3


Visit the project website


FastCG is a thin C++ framework for rapid prototyping of virtual reality applications.

Developed during my master's realtime rendering course, it features:

Visit project website


simpleraytracer is an implementation of a very simple raytracer in C++ using Win32 and OpenGL.

It features:

Visit project website


ImageProcessing.js is a pure Javascript/HTML5 implementation of some common image processing algorithms.

It features:

White noise removal


Fourier filtering

Frequency domain visualization

Visit the project website or
run it here.

L-Systems on the GPU

L-Systems on the GPU is an application that does parallel rewriting and interpretation of L-Systems on the GPU.

It's based on the article Parallel Generation of L-Systems, but unlike the solution presented there, built with plain GLSL shaders instead of CUDA (GPGPU the old way!).

Developed as a final project for the computer graphics topics II course taken during my masters.

Visit project website


Triangulate is a C++ library that puts together some traditional computational geometry algorithms such as convex hull building and polygon triangulation.

Currently provides the following implementations: ear clipping triangulation (based on this article), graham scanning and divide-and-conquer convex hull (based on the descriptions available in this very good book).

Also comes with two applications that demonstrate the results of the aforementioned algorithms

It was developed as an execise for the computational geometry course taken during my masters.

Visit project website


xithcluster is an extention to the Java scene graph library Xith3D.

A complete solution to distribute rendering between multiple computers (using a method called sort-last).

Developed as my final graduation project.

Published in the 8th Brazilian Virtual and Augmented Reality Workshop (WRVA). You can download it here (unfortunately only in portuguese).

Visit project website


simplescenegraph is, as the name says, a scene graph. Scene graphs are data structures that help you manage 3D objects in a scene.

Developed for an advanced data structure course taken in graduation.

While developing it, I was heavily influenced by the reading of this incredible book.

The code also contains an unfinished shoot'em up.

Visit project website

Download sample