Help Fluid rendering performance - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html) +--- Thread: Help Fluid rendering performance (/thread-2733.html) |
Fluid rendering performance - jleemans - 02-02-2021 Hello, we urchase Obi fluid recently. And after setup it in our project we had seen a huge drop in our performance, even without any fluid or softbody in our scene. From our profiling we had guess the probleme is the fuild rendering feature added to URP. It use two times the function FindObjectsOfType wich is very slow (probably because our scene is huge > 20000 objects.) The result of one of the two calls isn't even used and is just a waste of cpu. Any way to improve that ? Usage of frustum culling maybe ? RE: Fluid rendering performance - josemendez - 02-02-2021 Hi there, From within a URP Renderer feature there's no way to access scene objects, other than use FindObjectsOfType() or filter by layer/tag. The reason for this is that renderer features are project assets, and as such, they're not tied to any scene in particular and so they can't hold references to GameObjects. I know this is less than ideal, but it's what URP is . This makes it impossible to provide direct references to objects like you can when using command buffers in the built-in pipeline, which would remove any need to do scene-wide searches at runtime. A workaround in case you don't add/remove particle renderers programmatically, is to cache the particleRenderers array as a member variable and only call FindObjectsOfType() is it's null: Code: if (particleRenderers == null) (02-02-2021, 02:16 PM)jleemans Wrote: Any way to improve that ? Usage of frustum culling maybe ?[/font][/size][/color]Frustum culling won't help in this case, since we still need to have access to the particle renderer from the renderer feature anyway. Let me know if this helps. kind regards, RE: Fluid rendering performance - jleemans - 02-02-2021 Thx for th quick answer. To fix this I added a static list that is filled by ObiParticleRenderer on OnEnable/OnDisable. Should do the trick Code: public class ObiParticleRenderer : MonoBehaviour |