Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Suggestion / Idea  (Solved) UserData Indices - 4 is not enough, I want 16
#3
Multiple vector4s per particle userdata is working, with Jobified UserData>Color averaging that scores 2/10 on aesthetics
Though it's only Cyan/Black/Yellow/Red, there are really 16 colors per-particle being averaged into 1 color, trust me...

Made a patch for the feature, which can be applied to your Unity repo if you also use TortioseGit
Open the .diff file with TortoiseGit, then click "File">"Apply Patch" and select the root folder of your Unity Project. TortoiseGit may propose a better match.
If you have any edits to these scripts, or Obi at a weird path, the patch won't work, but you can just read the snippets and re-write some it out yourself
https://pastebin.com/B88kVvYQ
save as "multiple userdata vectors per particle.diff" (no quotes) for TortoiseGit to open it


I modified FluidOverlapQuery.scene, so each cube draws 1 userdata to it's userdata channel. Colors are later averaged per-particle to display them.
Scene edits to add cubes and colors to OverlapTest.unity are not included, but there's a picture for reference

If userData has multiple values per-particle, then the conventional get/set userData accessors will Warn - see the modified Get/Set in ObiSolver.cs below

Notes:
ObiSolverEditor.cs: Add "numUserDataVecs" to inspector
Water.asset: diffusion set to 1
OverlapTest.cs: Add burst job to average colors for 16 channels into 1 color per-particle, and reduce userdata over time to prevent over-mixing
BurstDensityConstraintsBatch.cs: Diffusion job now iterates over multiple vectors per particle
ObiSolver.cs: Add numUserDataVecs, and multiply userdata size by that num. Add helper functions Get/SetUserData, Get/SetUserDataSingle
ProjectSettings.asset: Add OBI_BURST, defines now" OBI_ONI_SUPPORTED;OBI_BURST"

Performance: Tested it with 1500 vectors per-particle with 1500 particles, and got about 3 fps (compared to 100 fps with a more reasonable 4 vector4s per-particle)


Attached Files Thumbnail(s)
       
Reply


Messages In This Thread
RE: UserData Indices - 4 is not enough, I want 16 - by nanimo(null) - 11-11-2022, 01:35 AM