Membrane Fusion
World Building Media Lab
Unity HDRP, Unreal Engine 5
Procedural Content Generation, Optimization, Shaders

The Ask
We are building a 1:1, scientifically accurate, model of the Pancreatic Beta Cell to better understand how insulin is produced so that we can develop better drugs for diabetes. To do this we need a suite of custom tools to build cellular structures at scale while adhering to real-time rendering constraints of an RTX 2080 Super.
One of these custom tools is the "Membrane Fusion Generator", a tool to generate a very complex animation where the lipid bilayer of a vesicle and its cell fuse together.
Procedural Content Generation
To build the "Membrane Fusion Generator" we first need to figure out how to render milions of membranes at runtime. This is a similar problem to grass, except it will need to be very dynamic with the ability to rotate and translate during fusion. With GPU instancing we can store a List<> of positions and batch render 1000 mesh's per draw call.

Now to populate our vesicle and cell with membrane we fill our List<> of coordinates with points on a sphere for the vesicle and points on a plane for the cell. (The cell is huge, there is no way we can do points on a sphere for that, so we will simplify to points on a plane for now, and render the rest later with other methods).
In world space, the vesicle and cell will be represented by empty GameObjects that can be moved dynamically, our List<> of coordinates will update based on these positions each frame. When the vesicle and cell intersect, we can trigger a function that rotates and translates each membrane in the appropriate direction to convey the following animation.
Note: I added a sphere collider to help visualize the vesicle and I only rendered vesicle membrane near the intersection point to save on compute.

Below is the function that calculates the relative rotation and translation for each membrane based on how far the vesicle and cell intersects.

Since this project intends to scale up and generate multiple membrane fusion moments, I made it very user friendly for future designers to reuse and modify. To set up a new vesicle, all that's needed is an empty GameObject representing the vesicle and an empty GameObject positioned at the cell wall.

For a presentation comparing the two engines, I re-implemented the "Membrane Fusion Generator" in Unreal Engine 5. As a fun challenge for myself I made it Blueprints (making a big ball of Spaghetti) and then again in C++.

Optimization
The vesicle membrane that do not undergo the fusion animation are rendered separately. They have a simplified script, lower-level detailed mesh (LOD 01), and use a simplified shader.

For the cell membrane in the distance, I implemented a "Cell Texturing" technique where I overlayed 64 transparent textures on top of each other creating the illusion of solid spikes with their negative space.


Shaders
Below is the shader for the "Cell Texturing" effect where layers of transparent planes are overlayed with small adjustments to the alpha channel to convey the illusion of solid spikes.

Below is the shader for each membrane particle. It is an unlit material that relies on color manipulation to give the effect of depth and distance. Dithering is used when the camera intersects the membrane fpr low-cost transparency. Vertex manipulation is used to make each membrane wiggle.

The Final Product
