﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3ARevzin%2FShapesProposal2</id>
	<title>利用者:Revzin/ShapesProposal2 - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3ARevzin%2FShapesProposal2"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Revzin/ShapesProposal2&amp;action=history"/>
	<updated>2026-12-02T10:33:15Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Revzin/ShapesProposal2&amp;diff=146903&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Revzin/ShapesProposal2&amp;diff=146903&amp;oldid=prev"/>
		<updated>2018-06-28T21:08:17Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 21:08時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Revzin/ShapesProposal2&amp;diff=146902&amp;oldid=prev</id>
		<title>wiki&gt;Revzin: /* Midterm */</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Revzin/ShapesProposal2&amp;diff=146902&amp;oldid=prev"/>
		<updated>2014-06-15T15:51:59Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Midterm&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= List of what&amp;#039;s good about the [[User:Revzin|original proposal]] =&lt;br /&gt;
&lt;br /&gt;
# Under-the-hood&lt;br /&gt;
## Speeding up shape key recalculations by avoiding doing total mesh recalculations if topology didn&amp;#039;t change is probably good&lt;br /&gt;
## Memory undo optimizations via storing only the changed shape key if possible are hardly bad&lt;br /&gt;
## Compressing shapekey data by storing only the changed vertices (from the Key-&amp;gt;refkey) can deflate the files by some percent&lt;br /&gt;
## Proportional editing for blending is good&lt;br /&gt;
# User Interface&lt;br /&gt;
## Scratch is a good concept by itself&lt;br /&gt;
## Improving Blend from Shape is a good thing, quick blending in editmode is a good thing&lt;br /&gt;
&lt;br /&gt;
= List of what&amp;#039;s bad about the original proposal =&lt;br /&gt;
# Over-engineered and complicated&lt;br /&gt;
## Too much checkboxes, need as few as possible&lt;br /&gt;
## Blending with sliders is inconsistent with other parts of Blener&lt;br /&gt;
## Scratch key doesn&amp;#039;t have that many applications to be in the user&amp;#039;s face&lt;br /&gt;
# Introduces some complicated local UI in one place&lt;br /&gt;
# Four-way slider is probably useless and not Blender-ish&lt;br /&gt;
## Modifier keys already taken and we don&amp;#039;t want to break them, same with Y-dragging&lt;br /&gt;
&lt;br /&gt;
= List of things than aren&amp;#039;t decided to be useful or not yet =&lt;br /&gt;
# Having an alternative mix in Edit Mode in case there is animation&lt;br /&gt;
# &amp;lt;s&amp;gt;Do we need a fast way to preview a shape key while working on top of a mix?&amp;lt;/s&amp;gt; -- seems there already is a way!&lt;br /&gt;
# &amp;lt;s&amp;gt;Is Apply Shape Keys in Edit Mode worth getting rid of?&amp;lt;/s&amp;gt; -- this needs to be reverted back to master. The only thing we actually need is recalc speedup, not emulation of Shapekey Modifier. Why would I do it in the first place? :|&lt;br /&gt;
&lt;br /&gt;
= List of things considered useful that weren&amp;#039;t in the original proposal =&lt;br /&gt;
# Make shape keys that come from linked library animatable with a proxy (suggested by an artist via email)&lt;br /&gt;
# Add in a system to define custom evaluation routines for a shapekey (see [http://lists.blender.org/pipermail/bf-animsys/2014-April/000138.html this email])&lt;br /&gt;
# Allow local deformations to act as drivers for further deformations (see [http://lists.blender.org/pipermail/bf-animsys/2014-May/000139.html this other email])&lt;br /&gt;
# Make driving Shape Keys easier by adding a Value Range &lt;br /&gt;
# Add support for Shape Key grouping in the list - add support for groups in UILists in general. (these last ones are suggested  [http://docs.google.com/presentation/d/1dQYsBAkyFG0ZORUbrwLzILs1K_i9W_3boLkWRDNP5Aw in here] by [http://plus.google.com/u/0/110416199144653349024 Derek Root])&lt;br /&gt;
# Add a &amp;quot;Shape Key Brush&amp;quot; brush that blends in the selected shape key in the active shape key (suggested by qurq on IRC)&lt;br /&gt;
&lt;br /&gt;
= What is going to make it and how? =&lt;br /&gt;
== Midterm ==&lt;br /&gt;
# Having an alternative animation-independent mix is a good idea&lt;br /&gt;
# Proportional editing and quick editmode blending can make it in form in a modal Blend from Shape operator conceptually doing the same as the slider (how do we choose the shape key to blend to/from here?)&lt;br /&gt;
# Shapekey compression on disk save&lt;br /&gt;
# Undo memory optimizations&lt;br /&gt;
# Value Ranges&lt;br /&gt;
# Scratch key can be internal and concealed from the user (minus one checkbox - Auto-Commit). If the user accidently edits the wrong key, we can have a special operator that reverts the current key and commits the edit into a new one. &amp;#039;&amp;#039;Commit to Different Shape Key&amp;#039;&amp;#039; or in the likes of that.&lt;br /&gt;
# Fix [http://developer.blender.org/T40505 T40505]&lt;br /&gt;
# Fix [http://developer.blender.org/T35170 T35170] Kinda already fixed this (in patch tracker for a bunch of months), but still&lt;br /&gt;
# Make the added shape keys have value = 1.0 after adding in them Sculpt Mode (small thing, suggested by qurq)&lt;br /&gt;
&lt;br /&gt;
== Finals ==&lt;br /&gt;
# Make shape keys that come from linked library animatable with a proxy.&lt;br /&gt;
# Add a &amp;quot;Shape Key Brush&amp;quot; brush that blends in the selected shape key in the active shape key &lt;br /&gt;
# Add in a system to define custom evaluation routines for a shape key.&lt;br /&gt;
# Add support for groups in UILists in general.&lt;br /&gt;
# ???&lt;br /&gt;
&lt;br /&gt;
= Midterm Deliverable Detials =&lt;br /&gt;
&lt;br /&gt;
== Alternative anim-independent mix for editmode ==&lt;br /&gt;
&lt;br /&gt;
The user, while sculpting on top of a mix in edit mode, can switch to an alternative mix values, in case the &amp;#039;main&amp;#039; mix is already driven by animation.&lt;br /&gt;
&lt;br /&gt;
[[Image:Gsoc-shapes-alternative-mix.png|600px|alt=]]&lt;br /&gt;
&lt;br /&gt;
This is already in the shapekey branch: [http://developer.blender.org/rB63a7fbe3a0c500991b2dfacfa0651564a2ffb234 63a7fbe3a0]&lt;br /&gt;
&lt;br /&gt;
== More efficient shapekey recalculation ==&lt;br /&gt;
&lt;br /&gt;
In the master branch, switching between different shapekeys in editmode is internally re-entering editmode with a different shape key loaded. Offset propagation is done by a heavy-duty function from bmesh_mesh_conv.c. While this is a very safe method that accounts for topology and customdata changes, it&amp;#039;s slow due to memory reallocations.&lt;br /&gt;
&lt;br /&gt;
It is uncommon to edit topology while sculpting shape keys. It happens, of course, but not often, so it&amp;#039;s rather pointless to run heavy-duty conversion functions each time (and reallocate everything) since&lt;br /&gt;
&lt;br /&gt;
Most shape keys don&amp;#039;t change in a deform-only edit, just the current one. Usually the number of basis shape keys is very small compared to the total number of keys.&lt;br /&gt;
If the mesh topology can be assumed to be unchanged, we can avoid rebuilding the whole RealMesh, but only edit the affected shape keys.&lt;br /&gt;
To help determine if the topology has been changed, a hash of the BMesh topology-related data is computed (see this commit. This is a cheat somewhat, as it doesn&amp;#039;t check the topology itself, but the memory layout, so a copy of the current editmesh will be treated as a different mesh... but that doesn&amp;#039;t seem to be a problem, editmesh reallocation doesn&amp;#039;t happen much without real topology changes.&lt;br /&gt;
&lt;br /&gt;
This is already in shapekey branch, though not really final. Benchmark results can be seen later on this page; it suggest it is a good idea!&lt;br /&gt;
&lt;br /&gt;
== PE for Blend from Shape and quick blending in editmode ==&lt;br /&gt;
&lt;br /&gt;
Blend from Shape is to recieve Proportional Editing (all types of it) and modal behavior which will be reminiscent of the planned four-way slider: horizontal drag adjusts mix intensity; vertical drag -- falloff distance (can change that to Mousewheel for consistency with other Editmode operations...) The shapekey to blend from can be chosen on op invoke from a dropdown and then changed with some other key (maybe PgUp/PgDown or some other).&lt;br /&gt;
&lt;br /&gt;
== Shapekey compression on disk save ==&lt;br /&gt;
&lt;br /&gt;
While saving shape keys, we&amp;#039;re going to write only the vertices positions that are changed from the reference key (after a certain total vertex count). Store an int for the vertex index and a float for the vertex&amp;#039;s position. Compressing is to be done on file write and uncompress on file read.&lt;br /&gt;
&lt;br /&gt;
== Optimization of mesh editmode undo memory usage ==&lt;br /&gt;
Currently mesh editmode undo stores the whole mesh after any edit, that includes full copy of all keyblocks. This is not very efficient. We&amp;#039;re going to use editmesh topology hashing to check if there weren&amp;#039;t topo changes and store only the affected keyblocks then. Just a bit more logic in undo push and pull.&lt;br /&gt;
&lt;br /&gt;
== Adding a Value Range for Shape Keys ==&lt;br /&gt;
&lt;br /&gt;
As suggested [http://docs.google.com/presentation/d/1dQYsBAkyFG0ZORUbrwLzILs1K_i9W_3boLkWRDNP5Aw in here], add a Value Range property to the keyblocks. The idea is that a shape&amp;#039;s value can go anywhere in the user-defined range and then gets clamped to [0-1]. This allows for easier driver setup.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;[I’m not sure at all about that… imho it’s not that hard to make clamping/mapping in drivers, don’t really see the point in adding that here? Just adds useless data and UI cluttering in my point of view., --[[User:Mont29|Mont29]] 15:19, 15 June 2014 (UTC)]&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== Commit to New Shape Key ==&lt;br /&gt;
&lt;br /&gt;
A small remain of the Scratch Shape Key, this operator is to revert the current shape to its original position and copy the edit coordinates to a new key. This is useful when you find out you&amp;#039;ve just edited the wrong shape key...&lt;br /&gt;
&lt;br /&gt;
== Bug fixes / TODOs == &lt;br /&gt;
# &amp;lt;s&amp;gt;[http://developer.blender.org/T40505 T40505]&amp;lt;/s&amp;gt; - make the manipulator handles and constraint lines draw at the deformed (modifier) vertex position. In soc-2014-shapekey now: [https://developer.blender.org/rB516038c983e7eb6236252c65e5db8b287fbdc2ec 516038c983e] &amp;#039;&amp;#039;[I would suggest you add this as a patch asap, you can assign me and ideasman as reviewers - the soonest this goes to master, the better! :) --[[User:Mont29|Mont29]] 15:18, 15 June 2014 (UTC)]&amp;#039;&amp;#039;&lt;br /&gt;
# [http://developer.blender.org/T35170 T35170] - won&amp;#039;t be needed after the undo system upgrades come into place, but poke people for review&lt;br /&gt;
&lt;br /&gt;
= Implementation notes =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Shape key compression on disk save ==&lt;br /&gt;
&lt;br /&gt;
It has been noted that usually when using shape keys to animate a character&amp;#039;s face, only a bunch of vertices are changed from the rest position in each shape key. In the image below, only the vertices that change from the rest position are highlighted:&lt;br /&gt;
&lt;br /&gt;
[[Image:gsoc-keys-shape-storage.png|400px]]&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s obvious that the current system of storing each vertex&amp;#039;s position in each shape key is not exactly space-effective. It has the important bonus of being able to access each vertex&amp;#039;s position in O(1), but that isn&amp;#039;t exactly needed while storing shape keys on disk (or for undo purposes). &lt;br /&gt;
&lt;br /&gt;
The idea is to store only the changed vertices&amp;#039; positions in the file and in object mode undo. On a [http://dl.dropboxusercontent.com/u/91422001/liz_headonly_masterbranch.blend test file] (4.5 kvert character head mesh with 157 shapes), the size reduction was almost 3x ([http://dl.dropboxusercontent.com/u/91422001/liz_headonly_masterbranch.blend compressed test file - open only with soc-2014-shapekey branch]).&lt;br /&gt;
&lt;br /&gt;
In a compressed shape key, a float3 for coordinates and and int for original vertex index is stored, so it&amp;#039;s not a perfect win. &lt;br /&gt;
&lt;br /&gt;
The compression logic checks if there will be a space gain from saving shape key in a compressed format and does that in case there is the gain.&lt;br /&gt;
&lt;br /&gt;
Downside is that master Blender won&amp;#039;t be able to open the compressed data correctly. A User Preference was added in File preferences to disable compression.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is already in soc-2014-shapekey: {{GitCommit|4c56a47730b93f4}}&lt;br /&gt;
&lt;br /&gt;
== T40505 == &lt;br /&gt;
&lt;br /&gt;
=== What&amp;#039;s the problem? ===&lt;br /&gt;
&lt;br /&gt;
Fixing that is somewhat non-trivial since there can be different modifier situations that require us to use different DerivedMeshes, e. g.:&lt;br /&gt;
# If there&amp;#039;re only deform modifiers, we just need to use the final cage, and the vertex indeces will be in sync to the editmesh&lt;br /&gt;
# If there&amp;#039;re some generate modifiers, some vertices can be mapped back to editmesh ones by index (subdiv) or not (remesh). &lt;br /&gt;
&lt;br /&gt;
=== Solution ===&lt;br /&gt;
# Setup:&lt;br /&gt;
## Determine the situation: if there&amp;#039;re only deform modifiers, just use the final cage.&lt;br /&gt;
## If there&amp;#039;re some generate modifiers, try to map new vertices to old vertices. If all vertices are mapped, use the final cage in proceeding calculations.&lt;br /&gt;
# Calculation:&lt;br /&gt;
## If there&amp;#039;s a vert map, use it to get every selected vertex&amp;#039;s derived position&lt;br /&gt;
## If no vert map, just use the current vertex&amp;#039;s index to get the derived position&lt;br /&gt;
&lt;br /&gt;
The setup phase must be a dedicated function since it&amp;#039;s gonna be needed in manipulator draw and TransCon drawing too.&lt;br /&gt;
&lt;br /&gt;
== Mesh topology hashing ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Comparison of execution times ===&lt;br /&gt;
&lt;br /&gt;
The testfile I used is [http://dl.dropboxusercontent.com/u/91422001/liz_general_blender_test.blend here].&lt;br /&gt;
&lt;br /&gt;
Tests were done on i7 4770K + GTX 760 Win7 machine, built using VS 2013 in Release configuraions. &lt;br /&gt;
&lt;br /&gt;
Master branch was at [http://developer.blender.org/rBce460c61791c7735c64d62061bcdcd0bc207320e ce460c617], soc-2014-shapekey was at [http://developer.blender.org/rB31a1d1cad4d420aacabe74d5bb4de51cbfb5fe28 31a1d1cad].&lt;br /&gt;
&lt;br /&gt;
liz_head_rel is a 4.5 KVert mesh with 157 shape keys.&lt;br /&gt;
liz_head_rel_40 is a 4.5 KVert mesh with 40 shape keys.&lt;br /&gt;
liz_body_yound is a 4.8 KVert mesh without shapes.&lt;br /&gt;
&lt;br /&gt;
Sampled a dozen values for each cell to avoid noise.&lt;br /&gt;
&lt;br /&gt;
==== Table ====&lt;br /&gt;
&lt;br /&gt;
{|  {{Css/prettytable|60%}}&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Task&amp;#039;&amp;#039;&amp;#039; || &amp;#039;&amp;#039;&amp;#039;Master branch&amp;#039;&amp;#039;&amp;#039; exec time, in sec || &amp;#039;&amp;#039;&amp;#039;soc-2014-shapekey&amp;#039;&amp;#039;&amp;#039; exec time, in sec &lt;br /&gt;
|- &lt;br /&gt;
| Editmesh-to-mesh (liz_head_rel), one shape affected &amp;lt;br /&amp;gt; Timed OB_MESH case of ED_object_editmode_load_ex() || avg 0.0848 &amp;lt;br /&amp;gt; max 0.1164 &amp;lt;br /&amp;gt; min 0.0453  || avg 0.0839 &amp;lt;br /&amp;gt; max 0.1447 &amp;lt;br /&amp;gt; min 0.0486&lt;br /&gt;
|- &lt;br /&gt;
| Editmesh-from-mesh (liz_head_rel) &amp;lt;br /&amp;gt;  Timed OB_MESH case of ED_object_editmode_enter(). || avg 0.0471 &amp;lt;br /&amp;gt; max 0.0843 &amp;lt;br /&amp;gt; min 0.0268 || avg 0.0532063 &amp;lt;br /&amp;gt; max 0.07304 &amp;lt;br /&amp;gt; min 0.026406&lt;br /&gt;
|-&lt;br /&gt;
| Editmesh-to-mesh (liz_body_young) || avg 0.0849 &amp;lt;br /&amp;gt; max 0.1348 &amp;lt;br /&amp;gt; min 0.0344   || avg 0.07498 &amp;lt;br /&amp;gt; max 0.1239 &amp;lt;br /&amp;gt; min 0.027  &lt;br /&gt;
|-&lt;br /&gt;
| Editmesh-from-mesh  (liz_body_young) || avg 0.032 &amp;lt;br /&amp;gt; max 0.0383 &amp;lt;br /&amp;gt; min 0.0172 || avg 0.0313 &amp;lt;br /&amp;gt; max 0.0407 &amp;lt;br /&amp;gt; min 0.0102&lt;br /&gt;
|- &lt;br /&gt;
| Shape switch, no topology change, no recalc (liz_head_rel). &amp;lt;br /&amp;gt; Timed OB_MESH case in rna_Object_active_shape_update(). || avg 0.1261 &amp;lt;br /&amp;gt; max 0.2462  &amp;lt;br /&amp;gt;min 0.088585 || avg 0.0589 &amp;lt;br /&amp;gt; max 0.0750 &amp;lt;br /&amp;gt; min 0.0223&lt;br /&gt;
|- &lt;br /&gt;
| Shape switch, no topology change, no recalc (liz_head_rel_40). || avg 0.0813 &amp;lt;br /&amp;gt; max 0.1147 &amp;lt;br /&amp;gt; min 0.055  || avg 0.0426 &amp;lt;br /&amp;gt; max 0.0604 &amp;lt;br /&amp;gt; min 0.0335&lt;br /&gt;
|-&lt;br /&gt;
| Shape switch, no topology change, 157 shapes recalc (liz_head_rel) || avg 0.139 &amp;lt;br /&amp;gt; max 0.2166  &amp;lt;br /&amp;gt; min  0.1076  || avg 0.0665 &amp;lt;br /&amp;gt; max 0.0817 &amp;lt;br /&amp;gt; min 0.0525 &lt;br /&gt;
|- &lt;br /&gt;
| Shape switch, topology change, no recalc (liz_head_rel). || same as &amp;#039;no topology change&amp;#039; || same as &amp;#039;no-topology-change&amp;#039; in master&lt;br /&gt;
|-&lt;br /&gt;
| Shape switch, topology change, 157 shapes recalc (liz_head_rel) || same as &amp;#039;no topology change&amp;#039; || same as &amp;#039;no-topology-change&amp;#039; in master&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|  {{Css/prettytable|30%}}&lt;br /&gt;
|+ Extra: mesh hash (Murmur2) execution time, sampled from 100 runs, sepereated by 10 ms of sleeping. &lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Mesh&amp;#039;&amp;#039;&amp;#039; || &amp;#039;&amp;#039;&amp;#039;exec time, in usec&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
|- &lt;br /&gt;
| liz_head_rel || avg 970 &amp;lt;br /&amp;gt; max 1350 &amp;lt;br /&amp;gt; min 240&lt;br /&gt;
|- &lt;br /&gt;
| liz_body_young || avg 1040 &amp;lt;br /&amp;gt; max 1740  &amp;lt;br /&amp;gt; min 560&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Notes and conclusions ====&lt;br /&gt;
&lt;br /&gt;
# On a mesh with shape keys, shape switch operations which happen without topology change are sped up 1.8-2.1 (40 shapes and 1by using the simpler recalculation routines in deform only cases.&lt;br /&gt;
# Hashing does not add a significant performance penalty; and there is room for even faster hashing, e. g. loop unrolling since the hash data sizes are constant&lt;br /&gt;
&lt;br /&gt;
Conclusion: using hashing to determine if the mesh&amp;#039;s topology hasn&amp;#039;t changed and using &amp;#039;lightweight&amp;#039; shape key recalculations in this case offers 2x speedup on shape key switching. Since most shapekey-related editing operations aren&amp;#039;t changing the topology, this is a good thing.&lt;/div&gt;</summary>
		<author><name>wiki&gt;Revzin</name></author>
		
	</entry>
</feed>