Jump to content

[SOLVED] 2.19 Missing mesh->setBoundBox ?


photo

Recommended Posts

Posted

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!

Posted

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:

image.png

No need to do that for mesh :)

Thanks!

  • Thanks 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

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!

Posted

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:

Posted

Nice to hear these details! Thanks!

  • Like 1
  • silent changed the title to [SOLVED] 2.19 Missing mesh->setBoundBox ?
×
×
  • Create New...