GPv3: Convert radius to blender units #113770

Merged
Falk David merged 5 commits from filedescriptor/blender:gpv3-fix-radius-size into main 2023-10-17 17:00:47 +02:00
Member

Previously, Grease Pencil used a radius convention where
1 "px" = 0.001 units. This "px" was the brush size which would be
stored in the stroke thickness and then scaled by the point pressure
factor. Finally, the render engine would divide this thickness value by
2000 (we're going from a thickness to a radius, hence the factor of
two) to convert back into blender units.

Store the radius now directly in blender units. This makes it
consistent with how hair curves handle the radius.

  • Removes the scaling in the render engine.
  • Makes sure the grease pencil primitives use the correct radii
  • Changes the drawing tool to work with screen space radius
  • Draws the drawing tool cursor in screen space
  • Makes sure the scaling is done when converting from legacy
    grease pencil objects
  • Makes sure the scaling is done when loading previous files

Consequences for the draw tool:

  • Since the tool has a radius input in pixels, it now works in screen space. This is a pretty big change to how it works by default before, so a new option will have to be added that allows the brush to be in "Scene" space. This is similar to how it works in sculpt mode. But this is a bigger change, so I would like to split that into a separate PR.
Previously, Grease Pencil used a radius convention where 1 "px" = 0.001 units. This "px" was the brush size which would be stored in the stroke thickness and then scaled by the point pressure factor. Finally, the render engine would divide this thickness value by 2000 (we're going from a thickness to a radius, hence the factor of two) to convert back into blender units. Store the radius now directly in blender units. This makes it consistent with how hair curves handle the radius. * Removes the scaling in the render engine. * Makes sure the grease pencil primitives use the correct radii * Changes the drawing tool to work with screen space radius * Draws the drawing tool cursor in screen space * Makes sure the scaling is done when converting from legacy grease pencil objects * Makes sure the scaling is done when loading previous files Consequences for the draw tool: * Since the tool has a radius input in pixels, it now works in screen space. This is a pretty big change to how it works by default before, so a new option will have to be added that allows the brush to be in "Scene" space. This is similar to how it works in sculpt mode. But this is a bigger change, so I would like to split that into a separate PR.
Falk David added 1 commit 2023-10-16 12:30:32 +02:00
9931cf82b3 GPv3: Convert radius to blender units
Previously, Grease Pencil used a radius convention where
1 "px" = 0.001 units. This "px" was the brush size which would be
stored in the stroke thickness and then scaled by the point pressure
factor. Finally, the render engine would divide this thickness value by
2000 (we're going from a thickness to a radius, hence the factor of
two) to convert back into blender units.

Store the radius now directly in blender units. This makes it
consistent with how hair curves handle the radius.

* Removes the scaling in the render engine.
* Makes sure the grease pencil primitives use the correct radii
* Changes the drawing tool to work with screen space radius
* Draws the drawing tool cursor in screen space
* Makes sure the scaling is done when converting from legacy
grease pencil objects
* Makes sure the scaling is done when loading previous files
Falk David added 1 commit 2023-10-16 12:31:07 +02:00
Falk David added 1 commit 2023-10-16 12:48:21 +02:00
Falk David requested review from Clément Foucault 2023-10-16 12:49:48 +02:00
Falk David requested review from Bastien Montagne 2023-10-16 12:49:56 +02:00

It seems to be working well on my simple tests with geometry nodes.

It seems to be working well on my simple tests with geometry nodes.
Bastien Montagne requested changes 2023-10-16 16:06:04 +02:00
Bastien Montagne left a comment
Owner

Besides the fact that this versioning needs a blendfile subversion bump, LGTM from quick look over.

Besides the fact that this versioning needs a blendfile subversion bump, LGTM from quick look over.
@ -1691,5 +1715,8 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
*/
{
/* Keep this block, even when empty. */
LISTBASE_FOREACH (GreasePencil *, grease_pencil, &bmain->grease_pencils) {

You need to raise the blendfile subversion for this, otherwise you risk re-applying that conversion more than once, which is not a desired behavior I'd assume.

You need to raise the blendfile subversion for this, otherwise you risk re-applying that conversion more than once, which is not a desired behavior I'd assume.
filedescriptor marked this conversation as resolved
Falk David added 1 commit 2023-10-16 17:59:28 +02:00
Falk David added 1 commit 2023-10-16 18:02:56 +02:00
Falk David requested review from Bastien Montagne 2023-10-16 18:03:09 +02:00
Bastien Montagne approved these changes 2023-10-16 18:17:00 +02:00
Clément Foucault approved these changes 2023-10-17 16:50:32 +02:00
Clément Foucault left a comment
Member

Thanks for tackling this. This always bugged me from the 1st day I encountered this hack.

Thanks for tackling this. This always bugged me from the 1st day I encountered this hack.
Falk David merged commit 07749b389d into main 2023-10-17 17:00:47 +02:00
Falk David deleted branch gpv3-fix-radius-size 2023-10-17 17:00:49 +02:00
Sign in to join this conversation.
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
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#113770
No description provided.