liu.yan Posted January 29, 2019 Posted January 29, 2019 Could ObjectDynamic or Ffp do similar job like glDrawArraysInstanced?
silent Posted January 29, 2019 Posted January 29, 2019 liu.yan ObjectDynamic internally using MeshDynamic with renderInstancedSurface when possible. Instancing applied only to the same meshes with same materials. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
liu.yan Posted January 30, 2019 Author Posted January 30, 2019 Thank you, silent. we are going to research the function renderInstancedSurfac. But first, we need to upgrade to the latest Unigine.
liu.yan Posted January 30, 2019 Author Posted January 30, 2019 Unigine had been updaded to the latest version! Is there any demos on how to use renderInstancedSurfac?
silent Posted January 31, 2019 Posted January 31, 2019 There is no exact sample available with renderInstancedSurface() usage, but for ObjectMeshDynamic usage you can check: Samples -> C++ API -> Nodes -> Objects Samples -> UnigineScript -> Objects -> dynamic_** Samples -> UnigineScript -> Shaders -> lines_00 Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
liu.yan Posted January 31, 2019 Author Posted January 31, 2019 Hi, silent: According to the demos on ObjectDynamic, we invoke render() or renderInstancedSurface() of MeshDynamic in the update() or Render, but nothing displayed. Should we set the MeshDynamic into Object so that it will display? But there is no interface we can do it. So how to use MeshDynamic?
silent Posted January 31, 2019 Posted January 31, 2019 Could you please provide a small test scene with objects that are not rendered? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
andrey-kozlov Posted February 1, 2019 Posted February 1, 2019 Hello liu.yan, There's no need to call render explicitly. Once ObjectDynamic has proper mesh, settings and material, it will be rendered by engine like any other object. Inctancing also will be done automatically when ObjectDynamics point to the same mesh and have the same material. I attached an example where several ObjectDynamics rendered instanced because there are cloned (so they have the same mesh) and have same material. ObjectDynamicInstanced.zip
liu.yan Posted February 13, 2019 Author Posted February 13, 2019 Hi, Andrey: I had followed your way and it works. But the performance is dramatically dropping, comparing with ObjectMeshCluster. Is it normal or is there something we can do to improve performance.
liu.yan Posted February 13, 2019 Author Posted February 13, 2019 Image descriptions(from top): 1 Render 9,000 cubes using ObjectMeshCluster 2 Render 9,000 cubes using new method 3 Render 1,000,000 cubes using new mothod
andrey-kozlov Posted February 13, 2019 Posted February 13, 2019 Hello liu.yan, Instancing is not the only optimization used by ObjectMeshCluster. It also hugely reduces CPU-side bottlenecks by using effective data structures. And for ObjectDynamic 1,000,000 nodes are still 1,000,000 nodes even with instancing. The engine can't really deal with such a number of them on the screen. I can see two options here. The first one is to stick with ObjectMeshCluster and try to utilize the standard vertex format. And the second one is to write custom Object efficiently working with large number of MeshDynamic's instances which maybe not a simple task.
Recommended Posts