Amerio.Stephane Posted yesterday at 10:07 AM Posted yesterday at 10:07 AM Hi, When manipulating vertices in a shader, the visible mesh can be far from the original mesh, hence leading to an object being culled while its deformed mesh should still be visible. This is the case for example with shader-animated flags. There use to be this code in our FlagComponent to artificially extend the bounding box, but mesh->setBoundBox no longer exist in 2.19+. // this is workaround for render materialgraph-changeable meshes ObjectMeshStaticPtr meshstatic = checked_ptr_cast<ObjectMeshStatic>(node); if (meshstatic) { auto mesh = meshstatic->getMeshForceVRAM(); // we set here +-2 because its common mesh for all flags BoundBox bb = BoundBox(vec3(-5), vec3(5)); // -> setBoundBox and setBoundSphere unknown //mesh->setBoundBox(bb); //mesh->setBoundSphere(BoundSphere(bb)); } Is there a new way to do this? thanks!
silent Posted 22 hours ago Posted 22 hours ago Hi Stephane, If you are using material graph you can already use built-in functionality to expand bounds inside materials: You need just to adjust Bound Scale parameter: No need to do that for mesh :) Thanks! 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Amerio.Stephane Posted 21 hours ago Author Posted 21 hours ago Yes indeed it works! Thanks! But, as a suggestion, in some cases, having a uniform scaling is neither required, nor efficient (especially when the displacement occurs in only one direction, on a very large mesh). In such cases, it would be more efficient to still have the capability to manually override the bounding box (even just via API). Thanks!
silent Posted 20 hours ago Posted 20 hours ago This variant is well-optimized for such tasks and works perfectly well even with bigger bounds than you potentially would need. Also it automatically takes in account object's scale. So, please don't worry about it :) How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts