Commit Graph

216 Commits

Author SHA1 Message Date
e6605d5f37 Fix depth offset in paint mode wireframe.
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.
2018-11-29 17:51:43 +03:00
32ab0647a5 DRW: Implement Hair Weight drawing
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).
2018-11-27 13:49:22 +01:00
0b0322099c Fix T57930 : Wrong hair shading in particle edit mode
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.
2018-11-26 21:25:33 +01:00
14ea3130ee DRW: Hair: Fix hairs not working properly with duplis
Fix T55355 Instanced hair not working well for EEVEE and workbench
2018-11-26 21:25:33 +01:00
f30271e3d4 Image Empties: Potential Fix for T57696
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
2018-11-22 18:31:03 +01:00
566a4a96cb Fix T57891: Radius of strip hair doesn't scale with object scale
Note that this only works fine with uniformly scaled objects.
Otherwise, the hair thickness will vary in a weird way depending on viewing
angles.
2018-11-20 13:09:27 +01:00
23c3124b56 Edit Mesh: Improve mesh cage drawing / fix errors and cleanup
* 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
2018-11-16 00:13:06 +01:00
d546269de8 Cleanup: Double semicolon at the end of line 2018-11-15 16:32:18 +01:00
36e6a41f6f Object Mode: Grid: Make antialiasing more grounded
Went a bit anal on this but at least we will have a decent AA reference
for lines in the future.
2018-11-09 15:35:31 +01:00
2ae88c4d78 UI: Make the grid alpha themable
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.
2018-11-05 16:31:12 +01:00
050e91340d Edit Mesh: Fix wire opacity when not rotating the view in Xray mode 2018-11-05 16:31:11 +01:00
46d88c5850 Edit Mesh Mode: Improve edge drawing
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.
2018-11-02 15:45:13 +01:00
a3802f66e2 Image Empties: More visibility settings
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
2018-10-31 13:42:33 +01:00
ffcf193653 UI: Make Wireframe size respect DPI settings 2018-10-30 19:07:49 +01:00
26223f8d9a Object Mode: Grid: Reduce line thickness a tiny bit and apply UI scaling 2018-10-30 16:44:23 +01:00
b31fc40fcd DRW: Fix missing uniform warning in debug mode
Fix T57318
2018-10-22 15:56:12 +02:00
a20c590966 DRW: Fix crash on startup for old Nvidia drivers
This should fix T57296 once and for all.
2018-10-22 15:56:12 +02:00
769b979abb Cleanup: trailing space 2018-10-21 16:23:15 +11:00
905921d2b5 Fix function using same local variable name as output variable
This may fix issues with certain compiler.
2018-10-19 18:13:22 +02:00
642b77e874 Edit Mesh: Decrease the depth bias on vertices 2018-10-18 20:42:32 +02:00
a2922f9840 Optimization: Edit Mesh Overlay
In tests with edit_cage: performance jumped from 9.37ms to 9.17ms.
2018-10-17 15:46:58 -03:00
f666be6edf EditMesh: Fix uninitialized value causing red outline on edges 2018-10-17 18:49:27 +02:00
41ad845531 Optimization: Edit Mesh Overlay: Avoid computing fixvec unnecessarily.
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.
2018-10-16 20:42:50 -03:00
1f1da26840 Edit Mesh Overlay Geometry Shader: Ignore correction geometry for loops that are not part of an edge.
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
2018-10-16 23:04:57 +02:00
22814ca555 Fix related to T55961: Glitch in selecting loose edges on some AMD drives. 2018-10-15 09:54:24 -03:00
c2afa3ef46 Edit Mesh: Add comments explaining weirdness in the code. 2018-10-15 09:50:31 -03:00
0c39453071 Cleanup: Edit Mesh shader: Remove unecessary varying 2018-10-15 10:43:49 +02:00
9a38a91f41 Fix T55961: Anomalous edges cage on some AMD buggy drivers.
Reviwed on irc by @fclem.
2018-10-14 14:07:45 -03:00
55e3c17ccc Edit Mesh: Optimize the overlay triangle geometry shader
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.
2018-10-13 23:55:30 +02:00
de76a809f9 Edit Mesh: Do not use barycentric coord in EDGE_FIX shader and ...
... 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.
2018-10-13 23:48:19 +02:00
4e168e0036 Edit Mesh: Fix and increase the depth bias on vertices 2018-10-13 23:48:19 +02:00
77653d97fb Edit Mesh: Fix issue with Edit cage on some buggy drivers 2018-10-12 17:21:04 +02:00
03d0219d7a Edit Mesh: Refactor edit mesh drawing
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).
2018-10-12 16:43:40 +02:00
fe4840ed4d Wireframe Overlay: Use Barycentric coord to optimize shader
This also fix a driver bug I was having on Linux + Mesa + AMD Vega.
2018-10-12 16:38:55 +02:00
5e9afe5018 Missed when bumping flags
Ideally these wouldn't be repeated in multiple places.
2018-10-11 17:02:42 +11:00
d74b89aed0 DRW: add ability to skip drawing vertices 2018-10-11 16:43:38 +11:00
ba3ef44a6b Implement display of weight isoline contours in the fragment shader.
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
2018-10-08 14:15:47 +03:00
7c443ded1e Vertex Paint: multiply vertex paint overlay
Fixes the first part of T56999.

Reviewer: brecht

Differential Revision: https://developer.blender.org/D3768
2018-10-05 14:05:48 +02:00
a2d633316b Cleanup: Remove some unneeded code
Reviewers: fclem

Differential Revision: https://developer.blender.org/D3767
2018-10-04 18:54:08 +02:00
89c30ff746 Pose Mode: Add back IK Degrees of freedom display 2018-10-03 15:44:12 +02:00
f36efe0e2a Fix mysterious crash when using textureGather on Intel drivers.
The crash occurs in a shader with uniform block of a certain size and misaligned.
2018-09-29 16:56:47 -03:00
3da46a8d8d Implement a new dedicated weight painting shader.
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
2018-09-27 17:33:33 +03:00
f7a81abe19 Edit Surface: Use edit curve engine to display edit surface
It's so similar in practice that we don't need a separate engine for edit
surface overlays.
2018-09-26 16:42:57 +02:00
1407a11138 Edit Curve: Fix "show handles" option hiding nurbs segments 2018-09-26 16:42:57 +02:00
5158da9e37 Curve Edit: Cleanup/Improve/Fix handles drawing
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.
2018-09-26 00:49:50 +02:00
d2dba449fe Edit Mesh Mode: Increase Face dot Z bias 2018-09-21 15:45:03 +02:00
5c20161f81 Fix compilation error in the stick bones shader for some Intel gpus. 2018-09-20 12:11:23 -03:00
6b433f4eb3 Merge branch 'master' into blender2.8 2018-09-19 18:20:50 +02:00
b2d82d096a Fix T56706: Lattice crash when enter in edit mode 2018-09-06 15:00:44 +02:00
41997d171b Edit Mesh: Add back the option to not highlight selected faces/edges
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.
2018-09-05 19:00:13 +02:00