The concept of a Lattice engine was originally thought out by Olivier De Deken. Olivier hired me through Twikit to implement his idea.
There was a shout from the additive manufacturing industry that lattices are the next thing. Unfortunately, there wasn't a fast and iterative solution for these types of geometry. Especially not widely available to the public. This is were "Laddy" the name of the project stepped in. We set our goal to make sure we can dynamically alter lattices in real-time within a web browser. The first version of our application was a proof of concept but showed that the challenge we had set for ourselves was achievable.
"We encountered various challenges while working on the project. Initially, artifacts appeared in the rendered image, and this was just the start. We also had to include different lattice shapes, incorporate pressure data to support non-uniform lattices, apply a surface layer to smooth the lattice's appearance, address issues with normals to correctly render shadows, and implement hybrid rendering to combine implicit and explicit shapes in a single render.
Odd discontinuities within the distance functions of the lattice.
Creating A Lattice
Rendering lattices in a web environment is not exactly a walk in the park, as you might have guessed. The issue with these geometric marvels is their penchant for sky-high polycounts. To put it in perspective, we once used a marching cubes algorithm to transform a lattice into a mesh, and we ended up with a whopping 12 million triangles.
Now, you might think, 'What's the big deal? Modern computers can handle this, right?' Well, sure, your trusty desktop or the latest laptop might shrug it off, but spare a thought for our humble mobile friends. High polycounts still give them a workout, especially if we want to tweak things on the fly. So, we had to tackle this problem differently – enter signed distance fields.
The catch? There's no off-the-shelf distance function for lattices. But, we realized lattices are basically the same shape repeated over and over again, called unit cells. They're a bunch of line segments with some thickness, and lines happen to have a neat little distance function. Toss in a sprinkle of repetition mathematics, and voilà, we had ourselves a uniform lattice – without giving our mobile friends a nervous breakdown!