Page MenuHome

Custom gizmos are lacking alpha and antialiasing
Closed, ArchivedPublic

Description

System Information
Operating system: Linux-4.15.0-52-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.26

Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-06-29 14:01, hash: rBf566212aa237

Description of issue
I don't know if this is intentional or not, but currently custom gizmos that define their own geometry don't appear antialiased in the 3D view and they also don't make use of the alpha channel defined in their corresponding properties, namely alpha and alpha_highlight.

I've found that the issue is solved when bgl.GL_BLEND is added to the gizmo draw method.
Here I show the example from the builtin template gizmo_custom_geometry.py for lamps, before and after adding bgl.GL_BLEND.

It seems that bgl.GL_POLYGON_SMOOTH and bgl.GL_LINE_SMOOTH are already in use internally for the gizmo, providing antialiasing, which is great, so I suspect that bgl.GL_BLEND may be missing from inclusion, and I don't see any reason why it shouldn't be used by default.

Details

Type
Bug

Event Timeline

yain vieyra (chaos) changed Type from Bug to OpenGL Error.

I did a compilation test and it works fine when adding GPU_blend(true) and GPU_blend(false) to the file ../source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c at the line 446, in the part that forces the antialiasing for gizmos.
I don't have any experience with C nor Blender architecture, so I don't know if that is the proper place for that change.

Brecht Van Lommel (brecht) changed Type from OpenGL Error to Bug.
Sebastian Parborg (zeddb) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.

I can reproduce this with the bundled python template. (Need to zoom out to see the widget though).

Clément Foucault (fclem) closed this task as Archived.Jul 1 2019, 3:34 PM

I'm not sure that GL_BLEND should be enabled by default. Just like we made the decision to disable depth test by default.

Using polygon smoothing is kindof a deprecated feature that does not even work on OSX. So I would encourage you to not use it. We are looking to also remove it from our codebase.

The AA is not done in the same way anymore that's why they are not AntiAliased by default.

But I agree the AA management needs more love. Ideally we would use the MSAA buffer for all gizmos.