GPv3: Add Catmull-Clark option in subdivide modifier #117382
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117382
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChengduLittleA/blender:gp3-mod-subdiv-smooth"
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?
The subdivide modifier of Grease Pencil v3 was lacking catmull smoothing option when it
was merged at first due to no apparent API for doing that directly. Now re-implemented
using
CURVE_TYPE_CATMULL_ROM
andcurves.evaluated_positions()
.@ChengduLittleA Unfortunately, this does not seem to work like in GPv2 :/ I'll think about this some more.
This is a direct port of the old implementation, but it has some issues
mmd.level
is treated as a power of 2 again so anything higher than 5 gets very slow.We could add a seperate
level
input for theCatmull-Clark
mode and change the limits for it, but that doesn't seem like the best idea.@HooglyBoogly Anything you can think of maybe? I'm not sure if there is a good way to compute the "final" catmull-clark positions. That would be ideal because then we can just do the normal
geometry::subdivide_curves
and call something likegeometry::smooth_curves_catmull_clark
after.I think it would be hard to use the linear
level
for Catmull-Clark, since to do that perfectly you'll then need to have a "limit curve" and sample the points along it, like in OpenSubdiv you can get a limit surface without actually having to subdivide the geometry.I would recommend just porting the old modifier's logic. It seems important to frame our efforts with the modifiers in the right context. The main goal of adding the modifiers is compatibility. If we get better performance that's nice, but long term these things should be implemented with nodes anyway. So I'd suggest not overthinking this and just doing the simplest thing.
@filedescriptor does the "direct port" of the algorithm work exactly the same way as the old one? If so I think we could use 3 modes:
Simple
,Subdiv Smooth
(the linear subdiv mode that's current, with mid-point smooth), andCatmull-Clark
(for the old behaviour). Thoughts?@ -90,2 +97,4 @@
/* Simple subdiv first, then we can catmull smooth positions. */
drawing.strokes_for_write() = geometry::subdivide_curves(
drawing.strokes(), strokes, std::move(cuts), {});
Argument
cuts
is taken by const reference, you can deletestd::move
and backconst
to variable declaration.@ChengduLittleA Yes, the code above will give the same results as the old one.
I'm not sure what you mean with
Subdiv Smooth
. Seems like that would be the same thing asCatmull-Clark
.I think we should stick to having the two modes as before
Simple
andCatmull-Clark
. But becauseCatmull-Clark
subdivides exponetially, we have to do the same in theSimple
mode. Basically restoring the old behavior exactly.So to summarize:
Catmull-Clark
.math::pow(2, mmd.level)
forgeometry::subdivide_curves
inSimple
mode.Thanks for updating. Just one cleanup comment.
@ -7766,6 +7766,12 @@ static void rna_def_modifier_grease_pencil_subdiv(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem gpencil_subdivision_type_items[] = {
Can just be
subdivision_type_items
GPv3: Catmull smoothing in Subdiv modifierto GPv3: Add Catmull-Clark option in subdivide modifier