Coating Objects with Gold
Introduction
Covering an object with a thin layer of gold using FLIP simulation isn’t ideal.
First, FLIP is very time-consuming, so it’s worth considering alternatives whenever possible.
Second, FLIP simulations typically generate meshes that are suited for liquid rendering:
- Surface tension characteristics that create rounded, droplet-like forms
- Fast changing topology that accommodates fluid-like behavior and splashing
For metallic gold surfaces, we need different mesh qualities:
- Extremely smooth surface continuity for proper specular reflections
- Clean topology that supports metallic material shading without artifacts
This is why I came up with the technique described below to achieve cleaner geometry that’s better suited for gold surfaces.
Concept
Diffuse a group onto a highly dense scattering of the mesh you want covered in gold, then remesh the result.
Execution
1. Diffuse a group
a. Pyro Source Spread
Pyro Source Spread is one method for diffusing a group onto a scattered mesh, simulating the spread of a fluid or substance. It offers several advantages and disadvantages:
Pros:
- No need to guide the diffusion.
- We obtain a convenient attribute in the form of @totalburn.
- Easy injection of noisy behavior for a more realistic progression of the leakage.
Cons:
- It’s a simulation setup.
- Achieving appealing leakage shapes is challenging.
- The diffusion doesn’t match expected movement. For example, it can climb up girders when gravity should prevent that.
The cons ultimately outweighed the pros, leading me to adopt a different approach. I ended up using Pyro Source Spread (PSS) for only a small portion of the effect.
b. Noise spread
I considered using this technique, which is a real classic, but it didn’t really fit my needs. I think it’s still worth mentioning just to share this all-star tutorial.
c. Snake system
The idea behind the “snake system” is quite simple. After drawing curves matching the flow of the tower’s geometry, I would grow my group using path deform on tubes whose caps were mountained, producing the leakage look.
Path deform tricks:
I learned a few things about path deform and the distance attribute doing so:
- You can easily measure the length of a curve with the distance along curves node -> Outputs @dist
- Now you can use @dist in path deform to have the tube match the curve.
Offset Position attribute:
In the previous screen, you can see that I created an attribute named @carveval to guide my tube along the curves.
To create variation in the rhythm at which each snake descends, I added a wrangle that creates a random animation range for each curve:
int fstart = chi('FSTART');
int fend = chi('FEND');
float floor, ceil, randFloor, randCeil, seedFloor, seedCeil, floorOffset, ceilOffset;
seedFloor = chf('Seed_Floor');
seedCeil = chf('Seed_Ceil');
ceilOffset = chf('Ceil_Offset');
floorOffset = chf('floor_Offset');
randFloor = rand(@id + seedFloor);
randFloor = - fit01(randFloor, 0, floorOffset);
randCeil = rand(@id + seedCeil);
randCeil = 1 + fit01(randCeil, 0, ceilOffset);
f@carveval = fit(@Frame, fstart, fend, randFloor, randCeil) - chf('offset_path_end');
This creates animations that start and end at different times while maintaining linear motion.
To add non-linear motion, you can use a solver with a point VOP to manipulate the @Frame attribute (this is easier to understand in the attached hipfile).
Horizontal girders:
For this part, the curve technique was too cumbersome to implement, so I completed the effect with the PSS technique. I used the points of the horizontal girders that would become included in the snake group as triggers for the PSS simulation. I learned that to animate PSS sourcing you have to use the @ignite attribute.
See: How to animate Pyro Source Spread sourcing?
toMesh:
Now our group called toMesh flows along the tower in a fluid-like manner, and we can send those points to the particle fluid surface SOP.
2. Inflate leakage front
In order to produce the inflation that is typical in fluid drippings, we will use the @pscale attribute. We need to bump the pscale value on the points that just entered the mesh. As the points grow older in the mesh, the pscale multiplier must also decrease.
a. Pyro Source Spread
With the Pyro Source Spread setup, we already have an attribute that tells us how long a point has been burning: @totalburn.
Before modifying pscale values on our points, we can remove the points that won’t be remeshed: @totalburn < 1.
The effect should only be applied during the first few seconds after points enter the mesh, so we can simply clamp the upper values.
@pscale = chf('particle_separation');
float rangemax = chf('fx_range');
f@range = fit(@totalburn, 0, rangemax, 0, 1);
float front = chramp('remap_pscale', @range);
@pscale *= front;
Our points are ready for Particle Fluid Surface.
b. Noise spread & Snake system
For those 2 setups we don’t have @totalburn, but there’s an alternative solution. We put our points inside of a toMesh group. Thanks to a solver, we can measure for how long the points have been in this group.
See: Age in a Group
Unlike @totalburn, this approach will lead to some stepping, as our counter yields discrete values. Before applying our Front Bump Wrangle to the points, we need to convert @count to a float and then apply an attribute blur.
@pscale = chf('particle_separation');
float rangemax = chf('fx_range');
f@range = fit(@count, 0, rangemax, 0, 1);
float front = chramp('remap_pscale', @range);
@pscale *= front;
3. Remesh with Particle Fluid Surface
When remeshing our points, set the adaptivity parameter to 0. This is crucial for achieving a super smooth surface and proper gold shading. It’s the only way to create a beautiful mesh without flickering artifacts.
Conclusion
This technique offers a simple approach to coating objects with a golden fluid effect. Although demonstrated on a tower structure, these fundamental principles are versatile enough to apply to diverse objects and scenarios.
Through careful control of particle attributes and remeshing parameters, we can achieve smooth results suitable for gold shading.