zhang.jian_bin Posted August 30, 2018 Share Posted August 30, 2018 In order to access each mesh of in the ObjectMeshCluster, we are marking each mesh in the cluster with an ID. And the ID is passed into the shader by buffer or texture. In the shader, we use IN_INSTANCE to find the corresponding ID. But in the practice, we found the ID is changed by the visible count of the mesh. How can we get the right ID like using s_clutter_cluster_instances in the shader? Link to comment
morbid Posted September 4, 2018 Share Posted September 4, 2018 Hi @zhang.jian_bin, have you used the define for clutter and cluster parameters? You can find it in data/core/materials/default/mesh/mesh_base.basemat, str. 547. This define enables logic for Cluster objects. Also, please check how we handle cluster transformation in vertex shader (data/core/shaders/mesh/common/vertex.h). If you need more help. please, send us your custom shader. Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
zhang.jian_bin Posted September 5, 2018 Author Share Posted September 5, 2018 I found that the problem was in the Calculations phase, Checks the intersections of objects with frustum (frustum culling) and finds those which present in the frame. The RENDER_MESH_NUM_INSTANCES change caused IN_INSTANCE to not correspond to the Id we wrote the texture. And I also want to modify the mesh's transform in the vertex shader, but the original transform will cause an exception to occur in the Calculations stage. How can I turn off the clipping of the related model or override the related vertex shader in the Calculations stage? Link to comment
morbid Posted September 10, 2018 Share Posted September 10, 2018 Hi, it's hard to understand where's exactly the problem. Please, send us a sample with your shader and step-by-step instructions so we can check everything. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
zhang.jian_bin Posted September 12, 2018 Author Share Posted September 12, 2018 The code had been uploaded. As you can see, our demo is modified from the meshbase material. The modification is mainly in the file: vertex.h, fragment.h, deferred.shader and ambient.shader. The problem: 1 Shadow is not correct. 2 Color and object clipping is not correct while moving the camera. unigine_ClusterId.rar Link to comment
silent Posted September 12, 2018 Share Posted September 12, 2018 Zhang, Thank you for the test scene. We will surely take a look into it this ASAP (but it could move to the next week, sorry). How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
zhang.jian_bin Posted October 15, 2018 Author Share Posted October 15, 2018 Hi, @silent Is there a conclusion to this problem? Link to comment
silent Posted October 15, 2018 Share Posted October 15, 2018 Hi Zhang, Sorry for the late reply. Unfortunately, there is no way to control the cluster culling, that's why you have these weird artifacts all over again. We can recommend only to use a custom object derived from ObjectExtern. There you can do full custom CPU logic and shading as you want. Trying to adjust built-in Cluster object is not a good choice, because it was designed specifically to do one thing - large performance with static objects. If you can explain in more details what kind of task you are trying to achieve maybe we can suggest you a different approach that is more suitable for you. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
zhang.jian_bin Posted October 16, 2018 Author Share Posted October 16, 2018 At first, we are only concerned about performance, and we used lots of clusters in the scene. And then the demand for interaction came, which heavily depends on fast object selection. It seems that performance and flexibility can not have together. Link to comment
silent Posted October 16, 2018 Share Posted October 16, 2018 Hi Zhang, Yep, that's the complicated balance. Maybe re-organizing content in some way will be the key (use less objects, for example if possible). How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
zhang.jian_bin Posted October 16, 2018 Author Share Posted October 16, 2018 Hi, silent: We are going to try the custom object derived from ObjectExtern. It may help us to balance the performance and flexibility. The problem is: can we utilize the instance rendering capability of the hardware, as we noticed that cluster rendering is similar with instance rendering which may take advantages from hardware. Link to comment
Recommended Posts