Anim: Rounded caps for thick bone wires #122481

Open
Christoph Lendenfeld wants to merge 48 commits from ChrisLend/blender:bone_wire_rounded_caps into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

This PR draws points at the vertex positions of custom bone shape wires
in order to cover up the gaps that are produced at thick wire widths.

The points are drawn in a separate step from the wires since they don't rely
on a geometry shader

Before After
image image
This PR draws points at the vertex positions of custom bone shape wires in order to cover up the gaps that are produced at thick wire widths. The points are drawn in a separate step from the wires since they don't rely on a geometry shader | Before | After | | - | - | | ![image](/attachments/ba79edf9-f431-45d1-8075-6619bb0e5b5b) | ![image](/attachments/04522c8a-c82f-482a-aabb-217fed1f2e5a) |
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2024-05-30 12:03:18 +02:00
Christoph Lendenfeld added 36 commits 2024-05-30 12:03:30 +02:00
now it properly creates the geometry based on the
direction of the line
Christoph Lendenfeld added 3 commits 2024-05-30 17:34:07 +02:00
Christoph Lendenfeld added 1 commit 2024-05-30 17:38:28 +02:00
Christoph Lendenfeld added 1 commit 2024-05-30 17:39:22 +02:00

If I understood @Jeroen-Bakker correctly, verticies are drawn as circles. So for edit mode wireframes they currently just draw verticies of each point of the lines to make them appear to be connected to each other.

So instead of rounding off the wireframe edges, I think he suggested to keep the edges sharp as before, but draw verticies.

If I understood @Jeroen-Bakker correctly, verticies are drawn as circles. So for edit mode wireframes they currently just draw verticies of each point of the lines to make them appear to be connected to each other. So instead of rounding off the wireframe edges, I think he suggested to keep the edges sharp as before, but draw verticies.
Author
Member

I am not quite sure what you mean.
edit mode has the same issue: image

or do you mean that we should draw circles matching the wire width and color almost like so
image

I am not quite sure what you mean. edit mode has the same issue: ![image](/attachments/5badc1e0-402b-4771-bafe-4fc7e14b6aa9) or do you mean that we should draw circles matching the wire width and color almost like so ![image](/attachments/c186456c-f88b-4864-8545-337847b9b5bf)

Hmm, I'm not sure. I think we have to wait for @Jeroen-Bakker to clarify what he meant.

Hmm, I'm not sure. I think we have to wait for @Jeroen-Bakker to clarify what he meant.
Member

Yes we should draw the vertices with the same color and width as the edges.
This will work on all platforms

Yes we should draw the vertices with the same color and width as the edges. This will work on all platforms
Christoph Lendenfeld added 4 commits 2024-07-04 14:10:20 +02:00
Christoph Lendenfeld added 1 commit 2024-07-04 14:14:07 +02:00
Christoph Lendenfeld changed title from WIP: Anim: Rounded caps for thick bone wires to Anim: Rounded caps for thick bone wires 2024-07-04 14:19:38 +02:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2024-07-04 14:20:26 +02:00
Christoph Lendenfeld requested review from Jeroen Bakker 2024-07-04 14:20:26 +02:00
Jeroen Bakker reviewed 2024-07-04 15:02:17 +02:00
@ -246,0 +249,4 @@
OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
if (!sh_data->armature_wire) {
sh_data->armature_wire = GPU_shader_create_from_info_name(
(draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_shape_wire_point" :
Member

Or we miss the clipping shader, or this can be shortened. Would follow what the rest does. IIRC clipping should be supported.

Or we miss the clipping shader, or this can be shortened. Would follow what the rest does. IIRC clipping should be supported.
Author
Member

indeed thanks for spotting that

indeed thanks for spotting that
ChrisLend marked this conversation as resolved
Jeroen Bakker reviewed 2024-07-04 15:06:36 +02:00
@ -186,0 +191,4 @@
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(2, Type::MAT4, "inst_obmat")
Member

Add comment that this is per instance.
keep numbers sequential.

Add comment that this is per instance. keep numbers sequential.
ChrisLend marked this conversation as resolved
Sybren A. Stüvel approved these changes 2024-07-05 08:16:56 +02:00
Sybren A. Stüvel left a comment
Member

LGTM, so once it has Jeroen's approval, it can land :)

LGTM, so once it has Jeroen's approval, it can land :)
Christoph Lendenfeld added 2 commits 2024-07-05 10:37:43 +02:00
Author
Member

@Jeroen-Bakker I addressed the comments.
Would still like to know if its ok to land this in 4.2 as suggested. If yes I have to rebase the PR onto the release branch

@Jeroen-Bakker I addressed the comments. Would still like to know if its ok to land this in 4.2 as suggested. If yes I have to rebase the PR onto the release branch
Member

On Metal devices the dots have an edge:
image
On Linux I also saw them, but they were not that annoying. Might check the alpha blending for this shader to improve the rendering. Think the issue is that the alpha is set to 1.0 in the shader.

Best way to do this is to calculate the distance from each fragment to the center of the vert in pixels and change the alpha for the outer most pixel. In edit mode we do something similar. The center of the vert can is know in the vertex shader and can be added to the interface with the fragment shader same.

I think we need some time to clean up these drawing issues. As 4.2 is an LTS release we can also back port it.

On Metal devices the dots have an edge: ![image](/attachments/b07fec70-0d5e-425e-b832-40f9ddd97136) On Linux I also saw them, but they were not that annoying. Might check the alpha blending for this shader to improve the rendering. Think the issue is that the alpha is set to 1.0 in the shader. Best way to do this is to calculate the distance from each fragment to the center of the vert in pixels and change the alpha for the outer most pixel. In edit mode we do something similar. The center of the vert can is know in the vertex shader and can be added to the interface with the fragment shader same. I think we need some time to clean up these drawing issues. As 4.2 is an LTS release we can also back port it.
8.2 KiB
Author
Member

@Jeroen-Bakker I thought I am using the fragment shader from edit mode.
I am using overlay_point_varying_color_frag.glsl which is added to overlay_edit_mesh_vert in overlay_edit_mode_info.hh.
Or is that not the one that is used?

@Jeroen-Bakker I thought I am using the fragment shader from edit mode. I am using `overlay_point_varying_color_frag.glsl` which is added to `overlay_edit_mesh_vert` in `overlay_edit_mode_info.hh`. Or is that not the one that is used?
Member

I'll check with Clement. I thought we did a mask to improve the alpha blending and fix these issues.

I'll check with Clement. I thought we did a mask to improve the alpha blending and fix these issues.
Member

I've discussed with Clement. And he wants to postpone this PR until overlay next is done. Changes like this would need to be redone in the new engine. Although it fixes a render glitch it is not easy to fix all cases in the way it is future proof.

I would suggest to note this limitation in the release notes.

I've discussed with Clement. And he wants to postpone this PR until overlay next is done. Changes like this would need to be redone in the new engine. Although it fixes a render glitch it is not easy to fix all cases in the way it is future proof. I would suggest to note this limitation in the release notes.
Author
Member

thanks for checking. Will do :)

thanks for checking. Will do :)
Merge conflict checking is in progress. Try again in few moments.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u bone_wire_rounded_caps:ChrisLend-bone_wire_rounded_caps
git checkout ChrisLend-bone_wire_rounded_caps
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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#122481
No description provided.