Dev:Source/Modifiers/Stack/TweakModifier

提供: wiki
< Dev:Source‎ | Modifiers‎ | Stack
2010年3月9日 (火) 19:21時点におけるwiki>Mindronesによる版 (moved Dev:Source/Blender/Modifiers/Stack/TweakModifier to Dev:Source/Modifiers/Stack/TweakModifier)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Introduction

The tweak modifier provides the ability to tweak the output of the modifier stack at the position of the tweak modifier. Only mesh deformations are supported - no topology changes are allowed.

Functionality

To use the tweak modifier, the user applies the modifier, enters a special "Tweak" mode, and deforms the mesh as desired. These deformations are saved either as absolute positions or as offsets from the vertices' base positions. Every time the modifier stack is evaluated, the deformations are applied to the output of the modifiers preceding the tweak modifier in the stack.

Issues

The picking problem

The main problem that arises when implementing this modifier is that of picking the correct vertices to apply the deformation to. If the input mesh topology or vertex order has changed since the mesh was tweaked (i.e. since the deformation data was created), the results could be seriously screwed. Some possible methods are outlined below.


Index-based
Just assume the vertices are in the same order as they were when the mesh was tweaked.
  • Breaks if the base mesh topology or vertex order changes
  • Breaks if the output of any of the preceding modifiers changes in topology or vertex order
  • Could possibly just ignore deformation data that doesn't have a valid index, or disable the modifier if this condition is detected
ID-based
Generate unique IDs for vertices in the base mesh, and store deformation data indexed by base mesh ID and duplicate number (e.g. "offset the nth duplicate of vertex with ID x with this vector").
  • Survives changes in the base mesh topology or vertex order (just ignore IDs that don't exist)
  • Breaks if any of the preceding modifiers change the order in which they make duplicates (or the number of duplicates they make)
  • What to do with vertices that aren't duplicates of base mesh verts (e.g. subsurf)?
  • Possibly use face ID as well
Combination
Store multiple identifying characteristics, and use the "best fit" vertex.
  • Index
  • Base vertex ID
  • Base face ID
  • Last known position
  • Problem: if you try to be too smart, you end up being stupid in unpredictable ways, and irritating the user