Blendshape (morph target) bounding box (mesh baking)

Hi there,

I suppose the blendshapes are computed on GPU in Babylon (like skinning). But Im looking for a way to get the correct bounding box (maybe based on a baked mesh) for the first active target.
I tried to use:

    meshes.forEach((mesh) => {
		mesh.morphTargetManager.getTarget(0).influence = 1.0;

Do you have any idea ?
Maybe @bghgary :stuck_out_tongue:
Thanks in advance,
Best regards,

I’m not aware of anything we have that can do this. In order to compute the bounding box for a morph the morph has to be done on the CPU.

refreshBoundingInfo(applySkeleton?: boolean)

We have something for this for skinning (applySkeleton), but I don’t think we have this for morph. It shouldn’t be too hard to add though. It would perhaps be just another parameter applyMorph or something similar. Would you be willing to contribute? If not, maybe file a feature request and we will look into it.

Indeed, I started (localy) to implement a CPU bounding box computation (based on the selected morph target).
I will contribute when I will sure of the computation.

Thanks a lot :wink:

1 Like

Hi @bghgary ,

I start working on a PR (to update refreshBoundingInfo(applySkeleton: boolean = false, applyMorph: boolean = false)).

However, using npm run start as mentioned here, the local playground (http://localhost:1338/Playground/index-local.html) seems to not understand the added arguments applyMorph (even if I can log it in the source code)…

Did I miss something ?

I’ve never had any issues with this. Are you using the TypeScript or JavaScript playground?

I am using the TypeScript playground (but I also tried with the JavaScript playground with the same behaviour).

I updated the function comments, without any update on playground. But if I debug step by step, the babylon source code is updated :confused:.

Use npm run start is enough ?

Perhaps not. Maybe it doesn’t update the definition files. @sebavan /@deltakosh/@RaananW will know more.

Just to show you the result:
With applyMorph = false:

With applyMorph = true:

Yup, this is expected as the playground relies on a definition file which is pretty slow to build. So It will not be available before a production build :frowning:

Ohh, so it’s normal.

I will continue with a default parameter value.

Thanks a lot for your help !!

1 Like

The (maybe draft) PR was submitted here :slight_smile:

1 Like