Covering the week of April 12th – 16th, 2021.
Thanks for checking out our 55th development update for the FLIP Fluids liquid simulation addon for Blender! Last week felt like such a productive week for code development. I was able to clean up and optimize some code to add proper attribute based shading feature implementations using Blender’s 2.93 new geometry attributes, and that is what I’ll cover in today’s post.
Incremental Resolution Test
We ran 560 simulations using the text sheeting + surface tension splash example scene, each time increasing resolution and grabbing the last frame. Here’s the result![gfycat data_id="selfassuredsoupyhydatidtapeworm"]
New Geometry Attribute Features
A few weeks ago we released a prototype build for velocity-based shading (read more in development notes #52). We heard, and saw from many of you that you are loving this type of feature so we have bumped this up in our development priorities. We now have a proper feature implementation for some new geometry attribute features in the latest experimental build.
These attribute features can be enabled in the FLIP Fluids Surface panel. After baking, the attributes can be accessed in a Cycles Attribute Node.
An important note is that due to a bug in Blender, these new attribute features will cause render crashes or incorrect renders. Until this is fixed, rendering from the command line will be required to prevent render crashes and ensure correct rendering when using these attribute features.
We have added a feature to attach 3D velocity vectors to the fluid surface mesh. After baking, the velocity vectors (in m/s) can be accessed in a Cycles Attribute Node with the name flip_velocity from the Vector output. Here is an example shader set up:
This shader uses the Vector Math Length node to convert the directional velocity vector to a speed value. If the velocity direction is not needed in your shader, enabling the Speed Attribute would be a better choice.
If the velocity direction is not needed, enabling the speed attribute instead of velocity would be more optimized and uses 1/3rd the amount of cache storage compared to the 3D velocity vector data. After baking, the speed values (in m/s) can be accessed in a Cycles Attribute Node with the name flip_speed from the Fac output. Here is an example shader set up:
We have also added a feature to attach the fluid age to the liquid surface mesh. After baking, the age values (in seconds) can be accessed in a Cycles Attribute Node with the name flip_age from the Fac output. Here is an example shader set up:
An Attribute That Did Not Work Well
Last week we also experimented with adding an attribute to make it possible to support simulations with multiple material fluids. Sadly, this did not work as well as we had hoped and this feature will need more work to add a correct implementation. We added a Source ID attribute that can be set on each Fluid or Inflow object hoping that accessing this data in a shader could be used to differentiate between materials.
In this setup, there are three fluid objects each set to a Source ID value of 0, 1, and 2. The shader selects the material based on the attribute value. 0 is Red, 1 is Green, and 2 is Blue.
The problem with this method is that when different materials touch each other, there are jagged edges because the attribute data is aligned to the mesh vertices and interpolated inside of the faces. Even at high mesh resolutions, the jagged materials are still quite noticeable.
Another problem due to interpolated data is that two touching materials can result in the wrong ID attribute for part of the face. For example, when Red (ID 0) touches Blue (ID 2), the interpolated ID value averages in the middle to 1, which is why there is a green stripe in the render.
In this render test, the Source ID and Age attributes were used to color the liquid. Notice the jagged edges and flickering between the two liquid materials:[gfycat data_id="wellinformedoldhypacrosaurus"]
We’re working on a better method in order to support multiple material liquids. Instead of outputting source ID values, we are going to try generating blend percentages for each source ID. Example: a vertex could contain data like 30% Material1, 10% Material2, and 60% Material3 and a shader would correctly mix the shaders in order to create a smooth blend between touching materials.
This feature is currently hidden from the UI until a better implementation is added, but if you would like to play around with the current state of the feature, this can be unhidden by checking the Enable Developer Tools option in the FLIP Fluids Preferences menu.
Experimental Version 184.108.40.206
Want to try out these new features? They can be tested in our Experimental Builds Package in the latest version!
Release Notes v220.127.116.11 (21-APR-2021)
- This version is the first experimental build since the release of FLIP Fluids 1.0.9b (06-APR-2021).
- Added geometry attribute features for the liquid surface mesh that can be enabled in the FLIP Fluid Surface panel.
- Added a velocity attribute. After baking, the velocity vectors (in m/s) can be accessed in a Cycles Attribute Node with the name ‘flip_velocity’ from the Vector output. If the velocity direction is not needed, use Generate Speed Attributes instead.
- Added a speed attribute. After baking, the speed (in m/s) can be accessed in a Cycles Attribute Node with the name ‘flip_speed’ from the Fac output.
- Added an age attribute. After baking, the age (in seconds) can be accessed in a Cycles Attribute Node with the name ‘flip_age’ from the Fac output.
- Only supported in Blender 2.93.
- Only supported using the Cycles renderer. According to the Blender developers, EEVEE support will come at a later date.
- Due to a bug in Blender, these new attribute features will cause render crashes or incorrect renders. Until this is fixed, rendering from the command line will be required to prevent render crashes when using these attribute features.
- Compatibility with older .blend files: If you had tested our prototype build for velocity-based shading, you may need to fix your .blend file when using this version. To fix your file, delete all shape keys attached to the fluid_surface object.