Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Fluid renders in editor, not in build
#11
(28-05-2024, 07:46 AM)josemendez Wrote: Hi Tim,

The first thing that stands out in your profiler pic is that physics are being updated >6 times per frame (6 visible calls to FixedBehaviorUpdate). It typically is unnecessary to update physics more than once or twice.

This is likely because your maximum allowed timestep is too high, or your timestep too small, leading to a death spiraling situation where physics must be updated more than once per frame to catch up with rendering. Took a look at your project's Time manager , your fixed timestep is set to 0.005 and your max timestep to 0.33, this instructs Unity to update physics at most 0.33/0.005 = 66(!) times per frame leading to extreme performance drops. For reference, typical values for these parameters are max allowed timestep = 0.04 - 0.1, and fixed timestep = 0.01 - 0.02.

Regarding your fluid blueprint parameters, they don't make much sense either. Your atmospheric pressure is set to a negative value, which will try and force fluid particles to expand into the surrounding atmosphere as much as possible like a gas would - should be the exact opposite if you want a smooth fluid stream. Viscosity is set to 0 which allows particles to move completely independent from each other - not what you'd want for a smooth stream, where particles all move in roughly the same direction -. Vorticity is also non-zero, which will cause the fluid to swirl as much as possible instead of keeping an steady trajectory. I think your project compensates for these parameter choices by using a really small timestep, in an attempt to get a smooth stream of fluid despite most fluid parameters forcing otherwise.

Some values I'd suggest:

Time:
- Fixed Timestep = 0.01
- Max allowed timestep = 0.02

Blueprint:
- Smoothing = 2.5
- Viscosity = 0.2
- Buoyancy = -0.1
- Atmospheric drag = 0
- Amospheric pressure = 0
- Vorticity = 0

Emitter:
- Emitter speed = 1.2

As a side note, if you're profiling this in the editor (as opposed to a build) make sure that your Jobs Debugger, Safety Checks and Leak Detection are disabled (found in the Jobs menu) since it will very negatively affect performance. With the changes suggested above I'm getting around 250 fps in your scene, on a Windows 10 PC w/ Core i5 CPU.

kind regards,

Thank you for the reply! Those changes have improved performance. FixedBehaviorUpdate() is now called 2 times per frame, instead of 6.

Still running 50FPS on my Windows PC w/ core i9 with Obi being the biggest performance draw; but it isn't dropping due to death spiraling like before.

This should be enough for us to tune the blueprint and get the look we want with acceptable performance. Some of those settings I had set weirdly to get a splashier look for the water, instead of it maintaining a rope-like stream. I'll toy around and see what gets the best middleground.
Reply