Add anti aliasing to transform constraints #107394
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#107394
Loading…
Reference in New Issue
No description provided.
Delete Branch "Yonatan-Maor/blender:fix_107038_add_anti_aliasing_to_transform_constraints"
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?
Transform constraints were being drawn on screen without anti-aliasing, now fixed to make them look smoother.
See #107038
Adding a comparison of before and after the change
fix_107038_add_anti_aliasing_to_transform_constraintsto Fix #107038: Add anti aliasing to transform constraintsFix #107038: Add anti aliasing to transform constraintsto Add anti aliasing to transform constraintsHi, #107038 isn't a bug, but todo design. So name for this PR shouldn't contain
Fix...
prefix, this just new feature.Thanks! I thought this was considered a bug, which is why I added Fix to the title.
If this is not a bug should I add a WIP prefix to the title?
WIP would say that this is not ready for review and approving and is still being developed. Some about this: https://wiki.blender.org/wiki/Style_Guide/Commit_Messages
Cool, I'll take a look
Works well, code looks correct.
Thanks!
I'm kind of new here, who should be authorizing the pull request?
The two reviewers you now have are fine I think, with Clément being the blocking reviewer who will probably have the last word and approval, and would be the one to commit. This process could take as little as a few days to weeks, and you should make another comment in this thread if nothing happens for a while.
Thanks for looking into it! However, this isn't a portable fix. It will not work on MacOS / Metal backend.
The portable fix is to replace the shader program by
GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
. Seesource/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
line 86 for an example of the uniforms to give to the shader.Note that
GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
also requiresGPU_BLEND_ALPHA
for correct anti-aliasing.Not sure that I'm well acquainted enough with the code to do this, but I'll take a look.
If you have any time, could you explain why this wouldn't work on other platforms? I simply took the code that is used to draw the global axes (I'm guessing that this code works on other platforms)
The function call
GPU_line_smooth(true);
enables the deprecated OpenGL featureGL_LINE_SMOOTH
that isn't available on Metal. We have a software workaround using a special shader (as mentionned) but it needs a bit more work. And, yes, anything usingGPU_line_smooth(true);
is currently not anti-aliased on Apple hardware.You can do it. If you look at the section of code that Clément referenced you will see there isn't a big difference, just a change of shader that needs a bit more information. It probably would look something like:
Add anti aliasing to transform constraintsto WIP: Add anti aliasing to transform constraintsI think that I'm getting the expected result using this code snippet (thanks @Harley )
Thing is, the lines are extremely thin, which makes them look aliased again (I tried increasing the linewidth to make sure my results look ok).
Is the required line width documented anywhere?
U.pixelsize should be consider our minimum feature size, so dots or lines shouldn't get smaller than that.
For most users you can just go to Preferences / Interface and set "Resolution Scale" to 1.0 and "Line Width" to "Default" and you should see most lines 1 pixel wide and U.pixelsize will be 1. Change to "Thick" lines and that value will be 2. A Mac user with a Retina (high DPI) display will get a U.pixelsize of 2 when scale is 1 and using default line width.
Although U.pixelsize is a float it is actually rounded to nearest int. That shader's "lineWidth" can accept any float value so you can really just eyeball it and set that to any multiplier against it that looks good to you, like
U.pixelsize * 1.12f
or whatever. I'd probably make it have the same fullness as the grid axes lines, but pick something you think looks good, just make sure to test at various sizes. If you pick badly we'll just let you know during review.Made the requested changes.
Adding new before/after images:
This looks good! Just need to cleanup the unused line and it's good to be merged.
@ -779,3 +779,3 @@
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
// immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
Remove the commented line.
WIP: Add anti aliasing to transform constraintsto Add anti aliasing to transform constraints