[WIP] GPencil: World Space Onion Skinning #102952
What is world space onion skinning?
Currently in grease pencil, when enabling onion skinning, all the ghost frames are rendered using the current transformation (object, layer parents, etc.) in the scene at that frame.
With world space onion skinning, the ghost frames would be transformed using the transformations at their scene time, so where they would actually show up on screen.
|Local Space||World Space|
Why is world space onion skinning needed?
World space onion skinning allows the artist to better understand their animation. As seen in the images above, if the object is animated, world space helps visualize the actual animation better.
How can we implement world space onion skinning for grease pencil?
- Introduce an “Onion Skinning Space” option that can be “Local Space” or “World Space”. Stored per grease pencil object data. (It might be better to store the onion skinning space in the overlay settings rather than on the object data.)
- Cache the transformation per frame. Store it in the runtime data of the frames in the original data block.
- The strokes should no longer be transformed on the CPU when copying to eval. They will be transformed on the GPU by the grease pencil render engine using the cached transformation matrix for ghost frames.
- The grease pencil render engine passes this matrix as a uniform to the shaders, which will no longer use the model matrix.
- All the operators that visually interact with strokes can no longer rely on the eval data being in the final space and need to account for it.
- An operator is used to populate the cache in the original frames. It uses a temporary minimal depsgraph to iterate over the relevant frames in the scene and calculates the world space transformation matrix and stores the cached transformation in all the grease pencil frames.
What are the current limitations of this design?
- The cache is stored on orig data block, meaning that it can only be valid for one object. Therefore, it is shared between all instances and we can't display per-instances world space onion skinning.
- We only cache a single transformation matrix, meaning armature deformations for example cannot be displayed for world space onion skinning.
- We do not have an automated update system to invalidate and compute the cache. It is unclear who is responsible for invalidating and recalculating the cache.
- Multi-frame editing only works in local space.
@filedescriptor About "The strokes should no longer be transformed on the CPU when copying to eval."... this is only for Onion strokes or for any stroke? and multiframe?
@antoniov Yes any stroke. All the strokes are in "local space". When multi-frame is enabled, the frames are also just shown in local space. Maybe I can add that to the list of limitations.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?