Author Topic: Slow Performance with SUIMONO 2.1 and calls to SuimonoModule.SuimonoGetHeight()  (Read 77 times)

RKeown3D

  • Newbie
  • *
  • Posts: 4
    • View Profile
I'm running NWHCoding's DWP2 for water based physics.  I added DWP2's MotorBoat prefab into the scene, and configured it to work with Suimono.  The problem appears to be how much time Suimono is spending when calls are made to SuimonoModule.SuiomonGetHeight(), and it's roughly 2100 ms, and causing a slow down of a framerate to about 0.1/0.2 FPS.  I'm including a screenshot to show the breakdown of time, and the majority is spent in SuimonoModule.DecodeHeightPixels(), with the rest being spread out between the raycast checks.  The calls from DWP2 to Suimono are run via FixedUpdate() for each of its WaterObjects.  I've sent the same information as well.  For now, I'm having to only issue the calls every 10th to 20th frame, just to get back to a decent framerate.

Again, this is with just one of their prefab boats in the scene.

Apparently, the 250k PNG is generating erros, sao I will try to email this to you, to add to the post.

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1649
    • View Profile
    • Tanuki Digital
Posting the image here...





Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1649
    • View Profile
    • Tanuki Digital
Unfortunately I've not used DWP2, so can't give setup advice for that asset specifically.  In the screenshot above I notice at SuimonoWaterDataProvider.GetWaterHeight() it is calling over 25000 items.  Do you know what is happening in this function?  Is it calling the Suimono CalculateHeights() 25000 times? (if so that would be quite extreme).  Or if not can you estimate how many Suimono.CalculateHeights are happening there?


RKeown3D

  • Newbie
  • *
  • Posts: 4
    • View Profile
Ok, so here's what i found, and this doesn't appear to be on your end actually.  DWP2 attempts to simplify the meshes that its WaterObject is attached to, for calculating a faster physics calculation of where the object should be based upon the data it passes to SuimonoModule.  It turns out that theyre not passing in the transfoirm vector of the object it's attached to, but an array of Triangles Points that make up the optimized mesh data.  In this case, the optimized mesh has 328 triangles (3 points each), so for each fixed update, they're calling CalculateHeights 984 per Fixced Update and DecodeHeightPixels is being called up to 5X the number of calls to CalculateHeights, with the exception of the first FixedUpdate, it only called it 936 times.  I'm going to have to escalate this to NWH Coding.  I'll post this data in the Forums as well.  Here are the results of the first 5 Fixed Update Calls:

WaterObjectCount: 8, FixedUpdates: 1, CalcuateHeights: 984, DecodePixelHeights: 936
UnityEngine.Debug:LogFormat(String, Object[])
DWP2.WaterObjectManager:FixedUpdate() (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:243)

WaterObjectCount: 8, FixedUpdates: 2, CalcuateHeights: 1968, DecodePixelHeights: 5292
UnityEngine.Debug:LogFormat(String, Object[])
DWP2.WaterObjectManager:FixedUpdate() (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:243)

WaterObjectCount: 8, FixedUpdates: 3, CalcuateHeights: 2953, DecodePixelHeights: 11202
UnityEngine.Debug:LogFormat(String, Object[])
DWP2.WaterObjectManager:FixedUpdate() (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:243)

WaterObjectCount: 8, FixedUpdates: 4, CalcuateHeights: 3937, DecodePixelHeights: 17106
UnityEngine.Debug:LogFormat(String, Object[])
DWP2.WaterObjectManager:FixedUpdate() (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:243)

WaterObjectCount: 8, FixedUpdates: 5, CalcuateHeights: 4921, DecodePixelHeights: 23010
UnityEngine.Debug:LogFormat(String, Object[])
DWP2.WaterObjectManager:FixedUpdate() (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:243)

This is a running total of counts, and does not reset after each FixedUpdate call.

Rob

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1649
    • View Profile
    • Tanuki Digital
Thanks for the info.  It certainly seems like too many Height calculations are being called.  I'm not familiar with how DWP does it's buoyancy and height systems... is what you describe above an error in how it's performing calculations, or is it the normal expected DWP procedure? 

RKeown3D

  • Newbie
  • *
  • Posts: 4
    • View Profile
Unfortunately, no it's not an error.  This is how it is currently coded.  I have an email into the publisher and will hopefully hear something soon.