Commit Graph

189 Commits

Author SHA1 Message Date
0424ee86f0 Fix T58407: Wire frames are not showing with subdivision surfaces 2018-12-05 21:57:49 +01:00
34b73cb11c Fix T57620: display custom normals in Edit Mode.
Since it seems that CD_ORIGINDEX is not available for loops,
the only choice is to simply use the loop normals already
computed by depsgraph after evaluating modifiers.

This revealed a bug where the Auto Smooth settings would be lost
from the mesh after complex modifiers, or after edit mesh to mesh
conversion, so restoring them is needed to get correct results.
2018-12-04 19:53:14 +03:00
7e5f31be41 Fix T58609 Subdivision Surface modifier, "Optimal Display" not working
I tried to make it progressive using the wireframe slide but it did not
work well.

So taking the most straight forward way.
2018-12-04 17:52:32 +01:00
6f198f7851 Wireframe: Optimization: Only draw triangles that have edges
This only happens after a certain wireframe threshold.

We sort triangles into 2 bins (start and end of the buffer) based on a
threshold and just draw the first bin if the wireframe slider is low enough.

This optimization is disabled for deformed meshes when playback is active.
This optimization is only implemented for meshes object for now.

This should help resolve (to some extent) T58188.
2018-12-04 17:52:32 +01:00
f1975a4639 Wireframe: Optimization: Only draw triangles that have edges
This only happens after a certain threshold.

We sort triangles into 2 bins (start and end of the buffer) based on a
threshold and just draw the start bin if the wireframe slider is low enough.

This optimization is disabled for deformed meshes.

This should help resolve (to some extent) T58188.
2018-12-04 17:52:32 +01:00
ff3601b9ae Fix/workaround T58368: Crash w/ mapped mesh + autosmooth 2018-12-03 14:58:29 +11:00
02a4fc1395 Texture Paint: implement efficient face selection updates.
Fix the old code that propagates selection changes to the
evaluated mesh directly without rebuilding, and avoid tagging
DEG_TAG_COPY_ON_WRITE if it succeeds.
2018-12-01 15:40:48 +03:00
47ef301c76 Texture Paint: fix face selection with subsurface. 2018-12-01 14:38:11 +03:00
b0ec08cfa1 Texture Paint: emulate subsurf optimal display in paint mode wireframe.
The wireframe is intended for showing selected faces, and selection is
based on original faces, so the extra wireframe lines are pure noise.
2018-12-01 13:44:29 +03:00
7d32d87a86 Viewport: implement hiding faces in paint modes.
In 2.79 hiding works in paint modes with selection enabled,
so it is a missing feature. This implements it in texture
paint overlays and in workbench base shading.

Reviewers: fclem

Differential Revision: https://developer.blender.org/D3989
2018-11-26 20:26:29 +03:00
735ad525a6 Fix T53750: Mirrored UV have bad tangent space
I feel silly because it was my fault all along! (see the WATCH IT warning)
2018-11-17 14:56:18 +01:00
a915da221f Edit Mesh: Fixes display of custom normals
Should fix T57620
2018-11-16 00:45:22 +01:00
d941f40c21 Fix T57571: Blender crashes on UV transformation
That was caused by a thread safety issue on gpu_batch_presets_unregister()
which was not designed to be used for this kind of situation (managing 3D
meshes batches).
2018-11-12 18:07:01 +01:00
69dd58f210 Fix mapped mesh display skipping generated faces 2018-10-24 13:12:18 +11:00
7dfd3539d5 Cleanup: use bmesh index access functions 2018-10-24 13:07:21 +11:00
dbdf653f8e Fix bad origindex layers for editmode modifiers
Reverts workaround from last commit.
2018-10-23 13:53:42 +11:00
e3013fdc3b DRW: workaround for editmode crash w/ constructive modifiers
Actual cause is bad orig-index layer,
commit this to avoid crash for now.
2018-10-23 12:34:34 +11:00
6add652c38 Fix T57294: Modifiers cage ignore face visibility 2018-10-19 13:57:00 +11:00
96dc1ad308 Fix T56735: Autosmooth option corrupts UVs 2018-10-17 13:26:27 +11:00
c1b8ce3170 Fix crash in loose edge check 2018-10-16 15:02:30 +11:00
8a94425e96 Cleanup: redundant check for hidden edge 2018-10-16 09:01:52 +11:00
478899dee7 Edit Mesh: Fix missing loop normal display 2018-10-15 16:04:50 +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
5400d6a8fa DRW: correct loose edge hidden face check 2018-10-12 17:00:10 +11:00
db91414d7b Cleanup: minor mesh allocation changes 2018-10-12 16:47:43 +11:00
eef365a126 Cleanup: use const pointers 2018-10-12 16:42:11 +11:00
33e2cf2aab Cleanup: fill vertex buffer in order 2018-10-12 16:25:16 +11:00
8ef8b64fc6 DRW: edit-mesh cage loose edge/vert support 2018-10-12 16:05:31 +11:00
f4b0684a3f DRW: edit-mesh cage selection support 2018-10-12 13:05:18 +11:00
c901ebcd21 DRW: add mapped edit-mode face-dot drawing 2018-10-11 17:23:29 +11:00
641190adff DRW: Initial edit-mode cage support
Modifiers such as sub-surf and mirror now work with show-on-cage.

Selection and loose geometry still needs to be supported.
2018-10-11 16:53:25 +11:00
d74b89aed0 DRW: add ability to skip drawing vertices 2018-10-11 16:43:38 +11:00
bf455c2ca9 DRW: avoid edit-mode layer lookups for freestyle 2018-10-11 15:24:26 +11:00
fb79357b3e Cleanup: assign a var to check an edge is real
Makes code slightly more readable.
2018-10-11 15:15:30 +11:00
92a494ed51 DRW: remove redundant editmode mesh tessellation
Also re-order logic so loop indices are ensured to be valid.
2018-10-11 11:41:24 +11:00
Dalai Felinto
1b1702abb0 Fix runtime error: shift of uint
The warning was: runtime error: left shift of 1 by 31 places cannot be
represented in type 'int'

Patch by Clément Foucault.
2018-10-10 13:35:34 -03:00
84cf670d1d Modifier: Fix cage option for deform modifiers
Show-on-cage and show-in-editmode options now work as it did in 2.7x
(but only for deformation).
2018-10-10 15:53:52 +11:00
c630ce3f6d Fix T57097: Crash when adding a Texture Slot in Texture Paint mode
Was caused by the use of a batch that was using a discarded index buffer.
2018-10-09 17:55:19 +02:00
1b910082a0 Edit Mesh: replace DerivedMesh w/ Mesh
DerivedMesh is now removed from edit-mesh modifier evaluation.
2018-10-09 17:48:28 +11:00
772c4d6313 Edit Mesh: basic show in edit mode support
Note this is just using the derived-mesh data at the moment,
to support this properly we'll need to remove derived-mesh.
2018-10-08 17:31:32 +11:00
215c23590a Edit Mesh: use deformed mesh w/ face-dot & normals 2018-10-08 12:18:45 +11:00
d0b47ddd7d Fix UV select tools not refreshing
Add BKE_mesh_batch_cache_dirty_tag option for resetting UV's.
2018-10-04 16:03:51 +10:00
4c22807e69 Cleanup: style 2018-10-03 08:10:48 +10:00
212ce03aaf Edit UVs: Fix missing wires with multiple windows
All that was needed is a VAO refresh. It's not a performance problem
because it only concerns a handful of batches.
2018-10-01 15:14:46 +02:00
283f0ae9af Edit UVs: Refactor drawing Shadow UV in Image Editor
Currently it's not showing the subdivided mesh (if there is a subdiv mod)
and there is some sync issue if there is multiple uv image space opened.
But thoses will be tackled later on. The purpose of this commit is to fix
the overflow issue of IMM and speed issue.
2018-10-01 15:14:46 +02:00
781995a09c Edit UVs: Refactor drawing Edit UV in Image Editor
NOTE: This commit only concern edit UVs and not the "shadow" mesh displayed
when texture painting. This will be address in a future commit.

We now cache the uv mesh in the mesh batch cache and only reupload data on
changes.

Update could be more granular (and a bit faster) but it's not our main
concern ATM.

This should fix problem caused by the IMM api used to draw large meshes.
This makes performance skyrocket compared to previous implementation.
There is still a big CPU bottleneck when not in sync selection mode but it
is not related to the drawing function directly.
2018-10-01 15:14:46 +02: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
bb8023ff7f Fix misleading field naming.
This is not any kind of length, it is the number of true values.
2018-09-26 09:05:13 +03:00
741ed1029e Cleanup: naming of DRW mesh weight API 2018-09-26 10:16:17 +10:00
e40870c479 Cleanup: warnings, style 2018-09-26 10:01:32 +10:00