anthony.liot2 Posted March 12, 2015 Share Posted March 12, 2015 Hi, I have some difficulty to play with the setTarget of ObjectMeshSkinned.I have a Face with one surface and for this surface I have three target :Surface 0 => man_meshshape => Target 3 => (0) man_meshshape => (1) eye_blink_left => (2) eye_blink_right I will be able to close the left eye or the right eye using : // Blink Left mesh.setTarget(0,1,0,1.0,0); mesh.setTarget(1,1,0,-k,0); mesh.setTarget(2,1,1,k,0); // Blink Right mesh.setTarget(0,1,0,1.0,0); mesh.setTarget(2,1,0,-k,0); mesh.setTarget(1,1,2,k,0); But I want blink both eye, I am not sure to understand how I can do that. Any suggestion ? Thank you :) Link to comment
koshachy Posted March 12, 2015 Share Posted March 12, 2015 Hi Anthony! :) To blend these animations, you should create 5 morph targets by using the setNumTargets() function. To clarify this: 1. morph target for "bind pose", when there is no interpolation 2. target for interpolation of the bind pose and the right eye 3. target for interpolation of the bind pose and the left eye 4. target for right eye blinking 5. target for left eye blinking And your code should be the following: mesh.setTarget(0,1,0,1.0f,0); mesh.setTarget(1,1,0,-k,0); mesh.setTarget(2,1,0,-k,0); mesh.setTarget(3,1,1,k,0); mesh.setTarget(4,1,2,k,0); We have a tutorial on Adding morph targets here https://developer.unigine.com/en/docs/1.0/tutorials/morph/ Also, the skinned_07 sample can be useful, it is located in data/samples/objects/skinned_07 Hope, it'll help you :) Don't hesitate to ask, if something isn't clear :) Link to comment
anthony.liot2 Posted March 12, 2015 Author Share Posted March 12, 2015 Hi Andrey, Thank you for the explanation, that's help me, my rigged model it's working now. Link to comment
ianyyin Posted March 17, 2015 Share Posted March 17, 2015 does the morph targets supports more than two blending animiations? Does the total weight have to be less than or equal to 1? we tested a mesh with a lot of different blendshapes (more than 3), but when we enable three blendshapes, it is ok. However, if we enable four or more blendshapes, the mesh itself will scale based on the total weight. Is this a bug or is there any way we can work around this problem? Link to comment
silent Posted March 17, 2015 Share Posted March 17, 2015 ianyyin we tested a mesh with a lot of different blendshapes (more than 3), but when we enable three blendshapes, it is ok. However, if we enable four or more blendshapes, the mesh itself will scale based on the total weight. If you can provide us minimal test scene for reproduction it could really help us in investigation and finding the real cause of this behavior. Please, don't hesitate to create a separate thread for it. Thank you! 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
ianyyin Posted March 17, 2015 Share Posted March 17, 2015 Hi silent, I checked the manual, it says up to 7 active morph target per surface, so it means only 7 targets could be enabled for one surface? that may be the cause for this behaviour.? Link to comment
silent Posted March 17, 2015 Share Posted March 17, 2015 Yes, it can (if you have more than 7 targets per surface). We need to check your actual model and code to be 100% sure that you met this kind of limitation and it is not a bug. 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
ianyyin Posted March 18, 2015 Share Posted March 18, 2015 I tested with a standard model, with about 73 blendshapes, and the code is very simple, just like below: If I comment out //mesh.setTarget(4,1,0,-k1,0); //mesh.setTarget(8,1,4,k1,0); It is ok. Otherwise, it will scale based on the total weight for these targets. Also, enable only 7 active targets are not enough for most of the facial animation. A lot of complex facial expressions have more than 7 active morph targets with different weights. Is there any plan for Unigine to support more targets in one surface? // Calculate weights of targets float k0 = clamp(sin(i), 0.0f, 1.0f); float k1 = clamp(cos(i), 0.0f, 1.0f); mesh.setTarget(0,1,0,1.0f,0); mesh.setTarget(1,1,0,-k0,0); mesh.setTarget(2,1,0,-k1,0); mesh.setTarget(3,1,0,-k0,0); mesh.setTarget(4,1,0,-k1,0); mesh.setTarget(5,1,1,k0,0); mesh.setTarget(6,1,2,k1,0); mesh.setTarget(7,1,3,k0,0); mesh.setTarget(8,1,4,k1,0); // Change the argument of sin() and cos() functions i = i + 0.01; Link to comment
koshachy Posted March 18, 2015 Share Posted March 18, 2015 Hi! :) does the morph targets supports more than two blending animiations? Does the total weight have to be less than or equal to 1? we tested a mesh with a lot of different blendshapes (more than 3), but when we enable three blendshapes, it is ok. However, if we enable four or more blendshapes, the mesh itself will scale based on the total weight. Is this a bug or is there any way we can work around this problem? Morph targets support more than two animations blending, as you can see :) About weights: you should take into account that 1 is used to get expected result (when the weight is equal to 1 that means the end of interpolation). To show you the difference: As you can see in the picture above, I've created a blend shape in Maya. And when I set the range of the weight (0;1) the result will be the following: If I set the range (0;5) the result will be: It is definitely NOT the blend shape that we created in Maya, right?). The final position of the vertex has been multiplied by 5. To recap: if you set the weight more than 1 you'll get a result which you didn't create in 3d editor. Go further: Unfortunately, the max number of active morph targets is 7. They were added in alpha version as demonstration and now we are working on increasing this number (and it surely will be increased). Probably, the large number of morph targets will be available in the next SDK update and for sure in the stable version (soon). About model scaling: In you code you create more than 7 morph targets, and it seems like "extra" targets have influence on the scale of the model. Don't get upset about this behavior, we will increase the number of morph targets soon. Sorry for inconvenience. If you have the same weights for different blend shapes, you can do the following: // Set targets with parameters mesh.setTarget(0,1,0,1.0f,0); mesh.setTarget(1,1,0,-k0 * 4,0); mesh.setTarget(2,1,5,k0,0); mesh.setTarget(3,1,6,k0,0); mesh.setTarget(4,1,7,k0,0); mesh.setTarget(5,1,4,k0,0); As you can see, I multiplied the -k0 weight by 4, because I have 4 targets with the same weight. If you have any question, don't hesitate to ask! :) 1 Link to comment
ianyyin Posted March 20, 2015 Share Posted March 20, 2015 Thanks, koshachy. Looking forward to the new stable SDK release. :) Link to comment
anthony.liot2 Posted April 15, 2015 Author Share Posted April 15, 2015 About the number of target do you have more information about the max number in the next SDK ?. Currently I am doing some lips tracking movement and with 7 Target the result is not accurate at all. At least 14 will be a minimum to have something better but ideally 30 Target will be good. Tony Link to comment
silent Posted April 16, 2015 Share Posted April 16, 2015 Sorry, but number of morph targets per surfaces will not be increased in the next SDK update. 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
anthony.liot Posted April 18, 2015 Share Posted April 18, 2015 :( Bad news for my next demo, with 7 target the result is not good for facial expression. Link to comment
ianyyin Posted April 30, 2015 Share Posted April 30, 2015 When will unigine increase max number of active targets? Link to comment
werner.poetzelberger Posted July 22, 2015 Share Posted July 22, 2015 Hello, is there any news on the morph target topic? Our current project needs morphing and we would be more than happy to see this limitation beeing resolved. Thx.Werner Link to comment
ianyyin Posted July 23, 2015 Share Posted July 23, 2015 Hi, Same here, hope to get the limitation issue resolved in the stable 2.0 release, otherwise morphing is useless with the current limitation. Thanks, Ian Link to comment
Recommended Posts