- Home /
blendshape multiplication- Exporting Envelope attr from Maya
Hi, I need to find a way to multiply the value of a blendshape as opposed to controlling the 0-100 range.
My blendshapes have been made in Maya, and some of these are inbetween where a number of blends are in a single blendshape, I want to be able to control the intensity of this. An example would be a ripple where you might have a small circle, and mid sized circle and a large circle as blendshapes and when animated for 0-100 in unity it would create the appearance of a ripple. What I need to be able to control is the magnitude of the ripple, so either being a very subtle or a very large ripple.
In Maya there is an Envelope control that is in the blendshape to give you this control. This is included in the fbx but doesnt appear in the blendshape parameters in unity. Is there still a way to access this control in unity, perhaps via script or other?
Thanks
Answer by Remy_Unity · Jun 05, 2018 at 02:26 PM
If I understood correctly, in maya you have 3 blend shapes, let say : ripple-small, ripple-medium, ripple-big, all those controlled as intermediate blend shapes by a single controller, right ?
A control similar to this can be achieved in unity by script with this method : https://docs.unity3d.com/ScriptReference/SkinnedMeshRenderer.SetBlendShapeWeight.html
And in you script, use a float value (lets name it "ripple") in the range [0-1] (1 = 100%) as this :
For ripple between 0 and 1/3 : ripple-small between 0 and 1, and other =0
For ripple between 1/3 and 2/3 : ripple-small goes from 1 to 0 and ripple-medium goes from 0 to 1
For **ripple* between 2/3 and 1 : ripple-medium goes from 1 to 0 and ripple-big from 0 to 1
You can deduce a pseudocode like this :
if (ripple < 0.33333f)
{
ripple-small = ripple * 3f;
ripple-medium = 0f;
ripple-big = 0f;
}
else if (ripple < 0.66666f)
{
ripple-small = 1f - (ripple-0.33333f) * 3f;
ripple-medium = (ripple-0.33333f) * 3f;
ripple-big = 0f;
}
else
{
ripple-small = 0;
ripple-medium = 1f - (ripple-0.666666f) * 3f;
ripple-big = (ripple-0.66666f) * 3f;
}
Hey, I hadnt thought of recreating the blend sequence in Unity. Thats not a bad idea. Each blend would have to return to zero after reaching the 'ripple' master float, before continuing on to the next blend. Its a bit of extra coding, but seems like the best solution. Thanks a lot. On further testing, it seems Unity kills the Envelope attribute stored in the fbx from $$anonymous$$aya. So yeah, my only solutions. :) Thanks again
Your answer
Follow this Question
Related Questions
Blendshapes How To Get them in from Maya 1 Answer
How to import skeleton and blendshape animation from maya? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers