Different gpu line drawing in 3.5.0 #106459

Closed
opened 2023-04-02 15:29:38 +02:00 by Eugene Du · 9 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1650 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.29

Blender Version
Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: 1be25cfff18b
Worked: 3.4.1

Short description of error
Lines are drawn differently in 3d view:

  • In 3.4.1: The lines are the same width, all uniform, regardless of the object rotation.
  • In 3.5.0: Uses an updated GPU module for drawing. The blue line looks different than the others, as if the others had a width = 2.
  • In 3.5.0: The blue line looks like it's not getting anti-aliasing from gpu.state.blend_set("ALPHA")
  • In 3.5.0: If you rotate Cube so that the green line becomes vertical to the view, then this line will look like it has no anti-aliasing.
  • In 3.5.0: If I use POLYLINE_UNIFORM_COLOR it does not display lines until the object is rotated or moved after first lunch of modal operator, unlike UNIFORM_COLOR or 3D_UNIFORM_COLOR.
  • In 3.5.0: Changing gpu.state.line_width_set(1) to 10 for POLYLINE_UNIFORM_COLOR have no effect, unlike UNIFORM_COLOR or 3D_UNIFORM_COLOR.

Probably solution
make gpu.state.blend_set("ALPHA") support for UNIFORM_COLOR or for 3D_UNIFORM_COLOR (if it still used), it doesn't have that drawing problem except for anti-aliasing support.

Exact steps for others to reproduce the error

Lines in 3.4.1 Lines in 3.5.0
lines_in_3.4.1.png lines_in_3.5.0.png
blend file with code blend file with code
in attachment in attachment

P.S. sliding between images is not supported :(

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1650 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.29 **Blender Version** Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: `1be25cfff18b` Worked: 3.4.1 **Short description of error** Lines are drawn differently in 3d view: - In 3.4.1: The lines are the same width, all uniform, regardless of the object rotation. - In 3.5.0: Uses an updated GPU module for drawing. The blue line looks different than the others, as if the others had a width = 2. - In 3.5.0: The blue line looks like it's not getting anti-aliasing from `gpu.state.blend_set("ALPHA")` - In 3.5.0: If you rotate Cube so that the green line becomes vertical to the view, then this line will look like it has no anti-aliasing. - In 3.5.0: If I use `POLYLINE_UNIFORM_COLOR` it does not display lines until the object is rotated or moved after first lunch of modal operator, unlike `UNIFORM_COLOR` or `3D_UNIFORM_COLOR`. - In 3.5.0: Changing `gpu.state.line_width_set(1)` to 10 for `POLYLINE_UNIFORM_COLOR` have no effect, unlike `UNIFORM_COLOR` or `3D_UNIFORM_COLOR`. **Probably solution** make `gpu.state.blend_set("ALPHA")` support for `UNIFORM_COLOR` or for `3D_UNIFORM_COLOR` (if it still used), it doesn't have that drawing problem except for anti-aliasing support. **Exact steps for others to reproduce the error** | Lines in 3.4.1 | Lines in 3.5.0 | | -------- | -------- | | ![lines_in_3.4.1.png](/attachments/57426ca7-a6f2-457c-b9ba-2fe701f8eddc) | ![lines_in_3.5.0.png](/attachments/705fa4fb-8dec-42ec-953e-80b498de32e6) | | blend file with code | blend file with code | | in attachment | in attachment | P.S. sliding between images is not supported :(
Eugene Du added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-04-02 15:29:39 +02:00
Contributor

In 3.5.0: Changing gpu.state.line_width_set(1) to 10 for POLYLINE_UNIFORM_COLOR have no effect, unlike UNIFORM_COLOR or 3D_UNIFORM_COLOR.

POLYLINE_UNIFORM_COLOR shader is using different method to draw lines and you can use uniform lineWidth to set the line width.

> In 3.5.0: Changing gpu.state.line_width_set(1) to 10 for POLYLINE_UNIFORM_COLOR have no effect, unlike UNIFORM_COLOR or 3D_UNIFORM_COLOR. `POLYLINE_UNIFORM_COLOR` shader is using different method to draw lines and you can use uniform `lineWidth` to set the line width.
Iliya Katushenock added the
Interest
EEVEE & Viewport
label 2023-04-03 11:19:58 +02:00
Author

POLYLINE_UNIFORM_COLOR shader is using different method to draw lines and you can use uniform lineWidth to set the line width.

Yes, thanks, using shader.uniform_float("lineWidth", 1) solve an issue partially but it still some AA problem for vertical lines and not drawn at first run.

Also look at this example with shader.uniform_float("lineWidth", 20):
vertical line drawn thinner than others (maybe this is an issue for AA in vertical lines).

POLYLINE_UNIFORM_COLOR.png
POLYLINE_UNIFORM_COLOR.mp4
P.S. nice...video also not supported.

> `POLYLINE_UNIFORM_COLOR` shader is using different method to draw lines and you can use uniform `lineWidth` to set the line width. Yes, thanks, using `shader.uniform_float("lineWidth", 1)` solve an issue partially but it still some AA problem for vertical lines and not drawn at first run. Also look at this example with `shader.uniform_float("lineWidth", 20)`: vertical line drawn thinner than others (maybe this is an issue for AA in vertical lines). ![POLYLINE_UNIFORM_COLOR.png](/attachments/60fa0d95-d5dc-49e2-bbf6-7be44cf639bf) [POLYLINE_UNIFORM_COLOR.mp4](/attachments/45aa242a-3637-45ad-9508-df035e5e98c5) P.S. nice...video also not supported.
Contributor

are you sure you setup viewportSize uniform for POLYLINE_UNIFORM_COLOR shader?

are you sure you setup viewportSize uniform for `POLYLINE_UNIFORM_COLOR` shader?
Author

are you sure you setup viewportSize uniform for POLYLINE_UNIFORM_COLOR shader?

what is the proper code for this? shader.uniform_float("viewportSize", vec2)
what vec2 should be?
So complicated shader for only AA support... I suppose vec2 is width x height of my current VIEW_3D or monitor resolution? In any case, this did not solve the issue with the thin vertical line.

But I need to note that after shader.uniform_float("viewportSize", (1920, 1080)) it start to draw lines at first run now.

> are you sure you setup viewportSize uniform for `POLYLINE_UNIFORM_COLOR` shader? what is the proper code for this? `shader.uniform_float("viewportSize", vec2)` what `vec2` should be? So complicated shader for only AA support... I suppose `vec2` is width x height of my current VIEW_3D or monitor resolution? In any case, this did not solve the issue with the thin vertical line. But I need to note that after `shader.uniform_float("viewportSize", (1920, 1080))` it start to draw lines at first run now.
Member

This could probably be closed as a duplicate of #103176

Does the example from blender/blender-manual#103176 (comment) help?

This could probably be closed as a duplicate of #103176 Does the example from https://projects.blender.org/blender/blender-manual/issues/103176#issuecomment-1004 help?
Philipp Oeser added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-04-03 13:04:34 +02:00
Author

Ok, close it. I'll ask questions there.

Ok, close it. I'll ask questions there.
Member

Well, I would only close it if the "right" usage of the API does NOT cause a regression. Would still be good to know if this all works nicely as before (if the API is used correctly)

Well, I would only close it if the "right" usage of the API does NOT cause a regression. Would still be good to know if this all works nicely as before (if the API is used correctly)
Author

I tried example code from there

region = bpy.context.region
shader.uniform_float("viewportSize", (region.width, region.height))
shader.uniform_float("lineWidth", 1)

and it seems all fine, except it become more complicated to code.

P.S. you have some troubles with uploading files. Not always it generate link to copy link

I tried example code from there ``` region = bpy.context.region shader.uniform_float("viewportSize", (region.width, region.height)) shader.uniform_float("lineWidth", 1) ``` and it seems all fine, except it become more complicated to code. ![](https://i.imgur.com/xl6X5zo.png) P.S. you have some troubles with uploading files. Not always it generate link to `copy link`
Member

OK then, if it works correctly, then lets continue discussion in #103176 (will close as duplicate).

P.S. you have some troubles with uploading files. Not always it generate link to copy link

Havent stumbled upon this one directly, but something along the lines was reported in infrastructure/blender-projects-platform#12 (see my last comment about attachments missing, might be related, feel free to post there if this is somehow reproducable)

OK then, if it works correctly, then lets continue discussion in #103176 (will close as duplicate). > P.S. you have some troubles with uploading files. Not always it generate link to copy link Havent stumbled upon this one directly, but something along the lines was reported in https://projects.blender.org/infrastructure/blender-projects-platform/issues/12 (see my last comment about attachments missing, might be related, feel free to post there if this is somehow reproducable)
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2023-04-03 13:54:02 +02:00
Philipp Oeser added
Status
Duplicate
and removed
Status
Archived
labels 2023-04-03 13:54:13 +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
3 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#106459
No description provided.