serious optimization request for shape keys (huge memory waste detected) #39287

Closed
opened 2014-03-20 18:40:08 +01:00 by Alessandro Padovani · 7 comments

hi all, this is my first post here so wish me luck :)

Let's suppose we have a character and we use shape keys for facial animation. I noticed that the actual implementation of shape keys allocates the whole character for every shape key. That is, for example, even if the shape key is used to rise a corner of the mouth and affects only a few vertices, the whole body of the character is stored in the shape key array together with the corner of the mouth that is the only part the shape key needs.

Of course one easy workaround to optimize memory usage is to keep the head of the character in a separate object, this way the shape key will store only the head mesh and leave the body alone. But, this is a workaround and may give visual problems with some characters leaving a visible seam where we separated the head. To tell the thruth there are further workarounds that we can use to hide the seam but that's not the point.

The point is, why shape keys store the whole mesh when they only need a few vertices ? I come from Lightwave where shape keys are called endomorphs. An endomorph only stores vertices that are changed from the base mesh. This both saves memory and makes morph operations faster since less vertices are to be computed.

Just to undestand how heavy the problem is, I did some memory tests using the common Makehuman character. This test is for a character imported with facial shape keys only. The "optimized" version just cuts off the head as a separate object. You can see there's a huge waste in memory usage.

84 Mb empty scene
143 Mb makehuman character (takes 59 Mb)
100 Mb makehuman character with optimized shapekeys (takes 16 Mb, saves 43 Mb)

hi all, this is my first post here so wish me luck :) Let's suppose we have a character and we use shape keys for facial animation. I noticed that the actual implementation of shape keys allocates the whole character for every shape key. That is, for example, even if the shape key is used to rise a corner of the mouth and affects only a few vertices, the whole body of the character is stored in the shape key array together with the corner of the mouth that is the only part the shape key needs. Of course one easy workaround to optimize memory usage is to keep the head of the character in a separate object, this way the shape key will store only the head mesh and leave the body alone. But, this is a workaround and may give visual problems with some characters leaving a visible seam where we separated the head. To tell the thruth there are further workarounds that we can use to hide the seam but that's not the point. The point is, why shape keys store the whole mesh when they only need a few vertices ? I come from Lightwave where shape keys are called endomorphs. An endomorph only stores vertices that are changed from the base mesh. This both saves memory and makes morph operations faster since less vertices are to be computed. Just to undestand how heavy the problem is, I did some memory tests using the common Makehuman character. This test is for a character imported with facial shape keys only. The "optimized" version just cuts off the head as a separate object. You can see there's a huge waste in memory usage. 84 Mb empty scene 143 Mb makehuman character (takes 59 Mb) 100 Mb makehuman character with optimized shapekeys (takes 16 Mb, saves 43 Mb)

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @padone

Added subscriber: @padone

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2014-03-20 20:33:43 +01:00

This is not a bug report, but a feature request, has nothing to do here (and do not see what addons are doing here either, this is about core Blender code!).

Please take time to read what’s written on https://developer.blender.org/maniphest/task/create/?project=2&type=Bug next time…

This is not a bug report, but a feature request, has nothing to do here (and do not see what addons are doing here either, this is about core Blender code!). Please take time to read what’s written on https://developer.blender.org/maniphest/task/create/?project=2&type=Bug next time…

Thank you for your reply Bastien :)

Addons was a mistake, I just didn't find a way to remove it since the board doesn't seem to let me modify my own posts after publishing. I just found the option to add BF Blender.

I did read the manifest and all the old bug reports on shapekeys before posting. I just didn't know where to post since I'm not requesting a new feature, but just a different implementation of an already existing feature. I know this is not a bug, it is rather a design misconception on the shapekey feature. Since it has to do with the Blender core as you said yourself, this seemed to me the more appropriate place where to post.

Since you rejected the subject now I'll try to submit it as a feature request as you suggest, but I don't expect it will be accepted as a new feature either. Please understand this is not a minor issue, it really makes Blender a memory hog for most serious projects. If you could help in making this request visible to any developer it would be kind of you.

bye, Alessandro :)

Thank you for your reply Bastien :) Addons was a mistake, I just didn't find a way to remove it since the board doesn't seem to let me modify my own posts after publishing. I just found the option to add BF Blender. I did read the manifest and all the old bug reports on shapekeys before posting. I just didn't know where to post since I'm not requesting a new feature, but just a different implementation of an already existing feature. I know this is not a bug, it is rather a design misconception on the shapekey feature. Since it has to do with the Blender core as you said yourself, this seemed to me the more appropriate place where to post. Since you rejected the subject now I'll try to submit it as a feature request as you suggest, but I don't expect it will be accepted as a new feature either. Please understand this is not a minor issue, it really makes Blender a memory hog for most serious projects. If you could help in making this request visible to any developer it would be kind of you. bye, Alessandro :)
Added to our TODO list (http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/Tools#Mesh_Editing). :)

that's great, thank you for your patience and attention :)

that's great, thank you for your patience and attention :)
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#39287
No description provided.