Greg Klar project portfolio
Gergely KLAR
PhD Candidate, UCLA
gklar@ucla.edu
CV download
In a hurry? See the one page version here.
Click on the tabs below for project details
PIC & FLIP fluid simulations

FLIP Variants

Below are some of the FLIP variants I have implemented in my research.

Currently, I am interested in combining FLIP with other physically based animation techniques to extend the range of supported phenomenon.

 

Season's greetings, 2013: MGPCG FLIP simulation rendered in Houdini

FLIP123 a.k.a. muFLIP

Inspired by smallpt and minray I got to thinking, how many lines would it take to write a FLIP implementation? My answer is 123. And that includes visualization as well.

Grab the code from GitHub.

MGPCG FLIP

Arguably, getting the boundary conditions right is the hardest part of a FLIP implementation, but at end of the day, the pressure solve merits the most attention as it requires the most compute time during the simulation.

To get the best performance on the pressure solve, we implemented a mulitgrid preconditioner for the conjugate gradient method. It has been introduced for Semi-Lagrangian fluid simulations, but can be adapted to FLIP just as well.

Using MGPCG reduced the time of the pressure solve to 10% of what we had for CG.

OpenVDB FLIP (with MGPCG)

Importance of pressure solve: we limited the number of iterations for the pressure solver. The explosive splashing is an artifact of the inadequate solution.

OpenVDB is a library for sparse 3D data structures.

The premise of OpenVDB for FLIP is pretty straightforward: With the sparse grid, we only store meaningful data, and we won't waste memory or computations on the empty portions of the domain.

To our disappointment, using OpenVDB for the whole simulation turned out to impose such a performance hit, that it did not justify the reduced memory benefits.

After switching to dense structures, our time steps got twice as fast as before, even without reducing the domain to the bounding box of the fluid.

CUDA FLIP

CUDA FLIP test: bucket of water to pool

When something is as computationally heavy as a fluid simulator, it is always a good idea to try to throw a GPU at it.

Indeed, even without serious optimization, the CUDA implementation of FLIP is crunching frames like nobody's business.

The cost of a CUDA project is the harder maintainability and more difficult debugging. Because of these reasons, we decided to keep this a pilot project, and return to CUDA only at major milestones of the research, when the CPU-only version is mature enough.

Extra: flow around a cylinder

MPM, FEM & SMD elasticity

CUDA MPM

I have been working with MPM from the moment the snow paper went online. The most notable thing about MPM is that it is slow. Especially with an explicit solver. In 3D.

But the good news is, that most of the code can be parallelized effortlessly. The only part, where the naive approach fails is in the particle-to-grid transfer.

With our approach of rearranging the particles in memory to a special layout, we were able to make the simulation 45x times faster than its CPU counterpart.

The GTC 2014 talk and slides are available online.

Solfbody with FEM and SMD

The Finite Element Method is the standard go-to for simulation of elastic materials.

While FEM simulations yield the best results, they tend to be slow and are far from the simplest things to implement. Just try to take the derivative of a vector valued function with respect to a matrix. Things get nasty very quickly.

On the other hand, Shape Matching Deformation is as simple to implement as it gets. Its most complicated part is the polar decomposition. But this is still far less difficult than the challenges of FEM. An unpleasant property of SMD though, is the coupling between stiffness and the time step. The smaller dt is, the stiffer the material will be.

Below is a sampling of my past FEM and SMD projects.

Invertible FEM

Test simulation rendered in Maya

A straightforward implementation of the Invertible Finite Elements for Robust Simulation of Large Deformation paper. Objects simulated with this solver are able to recover even after collapsing into a 2D puddle.

My implementation includes both Forward and Backward Euler solvers.

FEM Cloth (2D in 3D FEM)

Simulation sample. The collision object has been omitted from the render.

Here, we investigated the capabilities of a FEM based cloth simulation. The cloth was described as a set of 2D rectangular elements embedded to 3D space.

Cloth simulations traditionally use mass-and-spring systems. Setting up the spring network and defining the spring constants to model actual materials is a challenging and ad-hoc process. Our approach avoids these problems by using the physical equations for elasticity, and solve them using FEM.

A full rigorous explanation of the simulation can be found here.

Simulation of the optics of human eye lens

The human eye focuses by adjusting the curvature on its lens. This adjustment happens by the muscles of the eye exerting force on the lens.

In this project we simulated a 2D cross section of such a lens. We modeled the lens as quadrilateral elements, and the dynamics of these elements are simulated using FEM. To get the smooth surface, that is required for ray propagation, we fitted Beziér splines on each side of the lens.

Our model is capable of controlling the focal point by contracting or relaxing the muscles attached to the lens.

SMD with ProcDef

Early phase of the learning process

ProcDef is a simulation framework, that defines a local frame for each vertex then applies deformations in the vertex' neighborhood using this frame.

We used this basic idea to create a virtual worm. This deformation model was augmented with machine learning to teach the worm locomotion.

In our trials, we were able to teach our worm different motions: a crawl, typical to the inchworm, and a unique slingshot-like jump.

Read more about the details in the project report.

Other projects

Other projects

UCLA48hrs Hack - Augmented Reality Furniture Organizer

The augmented reality part of out pitch video at UCLA48hrs Hack

The idea: give people the freedom to design their homes virtually.

With our software, the user can experience how new pieces of furniture will measure up in their home. Our software places a 3D model of a couch, painting, bed, etc. in the live capture of a camera. The model is embedded in 3D, allowing the user to walk around the furniture, and examine it from various angles.

Since winning second prize in the UCLA 48hrs Hackathon, the project has had a life of its own and is now known as vuPad.

Curvy - A design element creator for smoothly curving patterns

Some of the pleasing curves are those with smoothly varying curvature. We wanted to create a tool for drawing such curves seamlessly in vector graphics.

The backbone of the project are the Pythagorean hodograph curves. The important property of PH curves, that their curvature can be expressed in closed form.

Using this mathematics, we created Curvy, a novel design tool to create beautifully curving curves. The curves are defined by control circles, as Bézier curves are defined by their control points.

See the poster we presented at Computational Aesthetics 2010, read the full paper in Acta Cybernetica, or try Curvy online.

GPU Flow

I have created my first fluid simulation project in 2008. It was a semi-Lagrangian fluid simulation, inspired by the articles of Mark Harris in the GPU Gems books. The simulation run on pre-CUDA GPUs, using DirectX and shaders to perform the computations.

CUDA developers, who never had to learn what a render target is will never know, how simple their life is.

The mandatory raytracer

In my opinion, it is a kind of rite of passage for anybody in Computer Graphics to write their own raytracer. At one point I have felt the urge too, and now with that off my shoulders, I can get back to my particles, and springs, and grids, and conservation laws, and forward and backward solvers.

Publications
  • G. Klár: Speculative Atomics: Case-study of the GPU Optimization of the Material Point Method for Graphics. GPU Technology Conference talk, San Jose, 2014 presentation video slides

  • Z. Szűgyi, G. Klár: Generating Member Functions and Operators by Tagged Fields in a C++. In Proc. of the Eleventh International Conference on Informatics, 2011, pp 96-99.

  • T. Umenhoffer, L. Szécsi, M. Magdics, G. Klár, and L. Szirmay-Kalos: Non-Photorealistic Rendering for Motion Picture Production. Article in Novática magazine of Asociación de Técnicos de Informática, Spain, 2010.

  • G. Klár, G. Valasek: Employing Pythagorean hodograph curves for artistic patterns. In Conference of PhD Students in Computer Science, Hungary, 2010.

  • G. Klár, G. Valasek: A design element creator for smoothly curving patterns. Poster in Computational Aesthetics in Graphics, Visualization, and Imaging 2010, London, 2010. (poster)

  • G. Klár, V. Vad: Highly Parallel Toolbox of Level Set Methods. In 8th International Conference on Applied Informatics, Hungary, 2010.

  • M. Magdics, G. Klár: Rule-based Geometry Synthesis in Real-time. In GPU Pro: Advanced Rendering Techniques, ed. by Wolfgang Engel, 2010

  • G. Klár: Flow Simulation using Obstacle Dependent Grids. In 12th Central European Seminar on Computer Graphics, ed. by M. Wimmer and J. Hladuvka and M. Lipp, Vienna, 2008, pp 91-97.

  • G. Klár, Level of Detail Flow Simulation. In Eurographics 2008 - Short Papers, ed. by K. Mania and E. Reinhard, Crete, 2008, pp 127-130.

  • G. Klár, Flow Simulation on Hierarchical Grids. In 4th Hungarian Conference on Computer Graphics and Geometry, Budapest, 2007, pp 48-52.