Computer Graphics



CUDA-based fluid solver. Using Back and Forth Error Compensation and Correction for increased detail (notice how smaller features are preserved compared to a direct implementation of Stam's stable fluids). The densities are ray-casted for visualization.

Running on a MacBook Pro 13'' (GeForce 320m).

Very simple CUDA-based water volume renderer with reflection, refraction, Fresnel reflectivity and wet effect --the rate the ground dries is exaggerated. The heightfields are ray-casted

Not using any illumination model, environment maps or texture maps for the moment. The ground and the water heightfields are actually sinusoidal functions (a combination of sine and cosine) for visualizing purposes only and they are not physically-based.

Refraction indices: a) water: 1.33 b) air: 1.0.

Comparing pure Level Set advection (i.e. no Marker Level Set or Particle Level Set for the moment) using semi-Lagrangian and Back And Forth Error Compensation and Correction methods --the difference is quite obvious.

CPU-based, Level Set implementation showing the popular Zalesak's disk. Given the velocity field defined by

u(x; y) = (\pi / 314)(128 - y)
v(x; y) = (\pi / 314)(x - 128)

the level set is moved using the advection schemes mentioned above. Yellowish colors indicate \phi lesser than 0 and the gray scales indicate \phi greater than 0, where \phi is simply a scalar field (level set).

I used a relatively high Courant-Friedrichs-Lewy (CFL) number of 5+.

A not-so-interesting implementation of MLS-2 [1]. (I will probably have to tune some parameters.) Early tests seem to show that only one reinitialization iteration is required every 3 (possibly more) time steps. Note the reinitialization is applied only in a tubular neighborhood near the interface.

The level set itself is moved using semi-Lagrangian advection, the particles are moved using second-order Runge-Kutta and a fast PDE-based reinitialization [2].

This first version runs in the CPU. The Zalesak's disk is defined by a radius of 60, slot width of 20 and slot height of 100. The grid size is 256 x 256. Similar (read: better) tests can be found in Enright's PhD thesis [3], which is illustrative and easy to read.

[1] Mihalef et al., The Marker Level Set method: a new approach to computing accurate interfacial dynamics, Journal of Computational Physics, 2007. A copy can be downloaded from

[2] Peng et al., A PDE-Based Fast Local Level Set Method, Journal of Computational Physics, 1999. Can be downloaded from

[3] Enright, D. P., Use of the Particle Level Set Method For Enhanced Resolution of Free Surface Flows. PhD thesis, Stanford University, 2002. Can be found in

Lattice Boltzmann Method. Simple CPU-based, 2D, LBM (D2Q9 with obstacles).

Inverse Kinematics

Inverse Kinematics using Jacobian transposed algorithm. If you use the software, I'd appreciate if you can drop me an email --please refer to the "About" section. I'm curious to see where it's used.



Zmorzynski, K., Solving IK problems for open chains using optimization methods, Proceedings of the International Multiconference on
Computer Science and Information Technology, 2008.

Guo, D. et al., Efficient Algorithms for the Kinematics and Path Planning of Manipulator, 2009 International Conference on Artificial Intelligence and Computational Intelligence, 2009.

Huang, W. et al., Full-Body Hybrid Motor Control for Reaching, International Conference on Motion in Games, 2010.

Talk slides of the the short lecture (12-hour) given at the Middle East Technical University, Turkey.


The very same presentation was given at CodeCamp Buenos Aires 2008.


Old Computer Graphics Stuff

Radial blur using DirectX PS 2.0. If you have access to the DirectX SDK, I suggest to place this file in the Post Process example and modify the CPP file accordingly.

Source code (FX, 8 KB)

GPU programming using NVIDIA's Cg (Perlin noise, Blinn, Phong, etc).

Source code (RAR, 3.8 MB)

Implementation of CG primitives, different curves and a raw simulation of the OpenGL pipeline (on software).

Source code (RAR, 1.3 MB)