The original offset was wrong because it applied a constant to
homogenous coordinates (the actual depth is z/w), which broke
totally if near clip distance was reduced.
A correct depth offset has to take slope into account like
glPolygonOffset in order to avoid dotted lines caused by
interpolation precision variations. When drawing wire lines
however only the slope of the line itself is accessible, so
also generally increase the offset when the object is close.
Fixes T57931 Particle weight edit mode is not supported.
There is a bug that prevent refresh of the toolsettings on which is based
the weight / non-weight display selection (see T58086).
Implement strand selection visualisation but without any shading.
I think this is not the overlay job to draw the strands shaded.
We can already view the children strands shaded for now but we might add
an option to draw the shaded strand instead of (or in addition to) the
guide strand.
So far this makes a new pass for image empties that does not write to the depth buffer.
Todo:
- Sort empties using `DRW_pass_sort_shgroup_z`.
- Calculate correct bounding boxes.
- fix bounding box memory leak.
Reviewers: fclem
Differential Revision: https://developer.blender.org/D3922
* Fixes vertices with bad coloring. Now vertices draw with depth write so
they occlude the underlying face geom overlay, avoiding double drawing the
vertex.
* Decrease the z_offset of edges so they don't poke too much through
geometry. Also delete this offset in ortho view.
* Add zoffset to active and selected vertices so they always draw on top
if they overlap a non selected vertex.
* Fix alpha of edge_fix in vertex selection mode
Now that the 3d grid is infinite, antialiased, not occluded, and overlaid
on top of rendered view, being able to decrease its opacity to reduce
visual strain is a must.
Make edge decoration a bit thinner and try to reduce missing edge segment
due to triangle barycentrics.
This invert the "edge fix" strip offset direction, meanning there is now
the possibility that these triangles poke through nearby geometry depending
on the viewport near/far clips distances.
Support for showing images in background/foreground and only in perspective/orthographic view.
Internally the depth of the image is modified in the fragment shader by setting `gl_FragDepth` explicitly.
The UI still needs some work to improve usability, see D3863 for details.
Currently there is one duplicated function, not sure how to best deduplicate it yet. (`is_image_empty_visible`)
Reviewer: fclem, brecht, campbellbarton
Differential Revision: https://developer.blender.org/D3863
This brings a big difference to meshes with edit cage adjusted for modifiers.
In my tests, the suzanne with subdivision modifier level 3 went from 4.80ms to 3.05ms.
By the tests I could only observe a considerable difference in the peformanse when the vertex size is 30.
Vertice 3 showed no difference in a suzzane with subdivision modifier level 3 + show-on-cage.
Point Size 30: 7.29ms vs 2.55ms
Reviewers: fclem
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D3805
On my test it's 30% faster than before.
Test case : Suzanne, subsurf lvl3, 64K tris, Edge select mode for fair
comparison.
0.95ms before optimization
0.64ms after optimization
Note that this only optimize the "nicest" display of edit mesh overlays,
not the one when rotating the view where half of the border edges are
missing.
... display vertex even when occluded.
Add back the vertex display because occluded vertex are not visible when
the triangle is almost parallel to the view.
The problem with the barycentric coord is that they are hard to work with
and their derivatives not enough precise to compute the vertex positions.
So we need to pass the vertices scree positions down to the fragment shader.
This decouple the vertex display from the face+edges.
This is to reduce the number of triangles required to fix the edges
artifacts (aliasing) and increase viewport reactivity when not actively
navigating (ie. mouse scroll).
Also it makes all vertices visible (not cut-off) even when navigating.
However it makes the navigation drawing a bit slower because it has to
render twice.
Also add a depth bias to the wires to avoid depth fighting when previewing
final mesh (modifiers applied).
Add an option to display contour lines tracing through points with the
same interpolated weight value in weight paint mode. This can be useful
for working on gentle gradients over a relatively high resolution mesh,
where the difference in color between adjacent vertices is very small.
The contour grid has 3 levels of detail going down to step 0.001,
which automatically fade in or out based on the weight gradient.
Fade out works by capping both screen space and weight space line
width, and reducing alpha when the screen space width becomes too
small for moire and noise-less rendering.
Reviewers: fclem
Differential Revision: https://developer.blender.org/D3749
Move the weight paint drawing to the fragment shader. The shader
uses a texture that uses the U.coba_weight custom color band, or
an internal color band.
In addition to actual weights, the shader has to display two
alert colors: missing vertex group, and zero weight. The zero
weight alert has to be blended with regular weight colors,
so that a single alert vertex surrounded by weighted ones is
still visible.
Reviewers: campbellbarton, fclem
Differential Revision: https://developer.blender.org/D3675
Now handles are drawn using index buffer instead of duplicating memory
requirement.
Also make use of shader tricks to draw handles antialiased, and respond to
UI scalling.
Make vertex point match edit mesh vertex size.
Do note that we force showing the face dot if we are in face select mode
but faces and edges overlays are disable to not loose the selected faces
entirely.