Clipping region fails in 3.5 Beta using Metal backend #105280

Closed
opened 2023-02-28 04:40:35 +01:00 by Artem · 4 comments

System Information
Operating system: macOS-13.2.1-arm64-arm-64bit 64 Bits
Graphics card: Metal API Apple M1 Max 1.2

Blender Version
Broken: version: 3.5.0 Beta, branch: blender-v3.5-release, commit date: 2023-02-27 23:28, hash: 0965341dcf53
Worked: (newest version of Blender that worked as expected)

Short description of error
Using alt+b (clipping region tool) with Metal enabled gives you broken results.
image
image

Exact steps for others to reproduce the error
Just add a cube, use alt+b on part of it (there is no need for a .blend file from my side, it's super easy to reproduce.)

**System Information** Operating system: macOS-13.2.1-arm64-arm-64bit 64 Bits Graphics card: Metal API Apple M1 Max 1.2 **Blender Version** Broken: version: 3.5.0 Beta, branch: blender-v3.5-release, commit date: 2023-02-27 23:28, hash: `0965341dcf53` Worked: (newest version of Blender that worked as expected) **Short description of error** Using alt+b (clipping region tool) with Metal enabled gives you broken results. ![image](/attachments/8dec4be6-5e70-4086-b62d-c0f9be99edae) ![image](/attachments/9ccf7291-1dc8-41f9-8187-121500fcf476) **Exact steps for others to reproduce the error** Just add a cube, use alt+b on part of it (there is no need for a .blend file from my side, it's super easy to reproduce.)
281 KiB
126 KiB
Artem added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-02-28 04:40:36 +01:00

Thanks for raising, I'll look into this, likely something has gone wrong somewhere with clipping region support, perhaps distances flag. It looks like the overlay may be clipping correctly, but main workbench is not.

Thanks for raising, I'll look into this, likely something has gone wrong somewhere with clipping region support, perhaps distances flag. It looks like the overlay may be clipping correctly, but main workbench is not.

From closer inspection, it looks like the drw_clipping_ UBO has the correct data when used within the overlay engine, but this data is incorrect when rendering with the workbench_opaque_mesh_tex_none_clip shader.

Looks like an incorrect buffer binding is being applied instead of the drw_clipping_ UBO for workbench shaders. Will narrow down where this is coming from and prepare a patch.

From closer inspection, it looks like the `drw_clipping_` UBO has the correct data when used within the overlay engine, but this data is incorrect when rendering with the `workbench_opaque_mesh_tex_none_clip` shader. Looks like an incorrect buffer binding is being applied instead of the `drw_clipping_` UBO for workbench shaders. Will narrow down where this is coming from and prepare a patch.

Looks like it is because:

if (clipping_ubo_location) {
    drw_shgroup_uniform_create_ex(shgroup,
                                  clipping_ubo_location,
                                  DRW_UNIFORM_BLOCK,
                                  G_draw.clipping_ubo,
                                  GPU_SAMPLER_DEFAULT,
                                  0,
                                  1);
  }

Requires clipping_ubo_location to be > 0. In this isntance, clipping_ubo_location for workbench in Metal is 0, which is a valid location:

clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped
clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped
clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped
clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped
clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped
clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped
clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped
clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped
clipping UBO location: 0 for shader workbench_opaque_mesh_tex_none_clip
Looks like it is because: ``` if (clipping_ubo_location) { drw_shgroup_uniform_create_ex(shgroup, clipping_ubo_location, DRW_UNIFORM_BLOCK, G_draw.clipping_ubo, GPU_SAMPLER_DEFAULT, 0, 1); } ``` Requires `clipping_ubo_location` to be > 0. In this isntance, clipping_ubo_location for workbench in Metal is `0`, which is a valid location: ``` clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped clipping UBO location: 2 for shader overlay_wireframe_custom_depth_clipped clipping UBO location: 0 for shader workbench_opaque_mesh_tex_none_clip ```
Germano Cavalcante added
Module
EEVEE & Viewport
Status
Confirmed
Interest
Metal
and removed
Status
Needs Triage
labels 2023-03-02 01:51:56 +01:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-03-03 11:24:45 +01:00
Author

I'm still getting strange results even after the patch (tried 00ca7c5221 build).
The faces aren't showing when clipping, only the outline.
image

I'm still getting strange results even after the patch (tried 00ca7c5221eb build). The faces aren't showing when clipping, only the outline. ![image](/attachments/694a1226-3c9e-4a2a-8658-a978cfbbfe43)
501 KiB
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
2 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#105280
No description provided.