Commit Graph

207 Commits

Author SHA1 Message Date
f371e633f9 Curve Batch Cache: Add support for loose edges and curve/surf modifier
Fixes T58298 Nurbs circle and curve dont draw in objectmode
Fixes T58107 Modified curves/surfaces/fonts do not show their eval mesh
2018-12-14 16:17:29 +01:00
2afed99da3 Curve Batch Cache: Rework Implementation to use new batch request
Shaded triangles are not yet implemented (request from gpumaterials).

This also changes the mechanism to draw curve normals to make it not
dependant on normal size display. This way different viewport can
reuse the same batch.
2018-12-14 16:17:29 +01:00
dd4c87cd04 Merge branch 'master' into blender2.8 2018-12-14 11:09:42 +11:00
10eb92035c Fix T59234: Crash when enter in Edit mode
Edit mode triangles does always need to have access to faces for visibility
and select/active flags.
2018-12-12 15:19:21 +01:00
cf92795953 Mesh Batch Cache: Fix crash when using edit mode normal display. 2018-12-12 15:19:21 +01:00
b87b6e8e28 Fix T59211: Edit-mesh display crashes
Caused by ae1f563899
2018-12-12 11:16:56 +11:00
c7ec1fa5e6 Cleanup: use BKE_object_* prefix for object API
Also minor style cleanup.
2018-12-11 15:09:09 +11:00
834bf357c8 Edit Mesh: Draw inner edge selected in vert edit mode if both verts selected
This only make the edge fully selected. There is still no gradient like in
2.79 when only one vertex is selected.
2018-12-10 19:02:17 +01:00
f7b558cbdc DRW: Batch Cache: Mesh: Port edit mesh batches to batch request method
This also do some renaming/cleanups.
2018-12-10 19:02:17 +01:00
ae1f563899 DRW: Batch Cache: Mesh: Port more batches to batch request method 2018-12-10 19:02:17 +01:00
1d92888ee8 DRW: Batch Cache: Add batch request system
This makes it possible for engines to ask for batches and only fill their
data after all engine populate functions have run.
This means that, when creating the batches data we already know all the
batches that are needed for this redraw and the needed data.

This allows for less redundant data preparation and better attrib masking.
Ideally, we should run all viewports populate function before executing
the batch construction but this is not the scope of this patch.

Conversion from the old request method will be progressive and both can
coexist (see uses of mesh_create_pos_and_nor()).
2018-12-10 19:02:17 +01:00
942e9835a9 Fix/workaround crash opening almost any Spring file
The issue was caused mpoly array urequired by the cache filling,
but the pointer was never set when preparing render data.

Seems this change is safe enough, in terms it shouldn't be
causing slowdown, since the assignment of mpoly is cheap, but
hard to tell if there is anything else affected by thing underneath.
2018-12-07 12:41:46 +01:00
0c6d5232a3 DRW: Remove the use of GPUTexture buffers for edit wire rendering
See previous commit for detail as why.
2018-12-07 05:33:53 +01:00
e929cad706 DRW: Rework wireframe overlay implementation
The shader is way simpler and run way faster on lower end hardware
(2x faster on intel HD5000) but did not notice any improvement on AMD Vega.

This also adds a few changes to the way the wireframes are drawn:
- the slider is more linearly progressive.
- optimize display shows all wires and progressively decrease "inner" wires
  intensity. This is subject to change in the future.
- text/surface/metaballs support is pretty rough. More work needs to be done.

This remove the optimization introduced in f1975a4639.
This also removes the GPU side "sharpness" calculation which means that
animated meshes with wireframe display will update slower.
The CPU sharpness calculation has still room for optimization. Also
it is not excluded that GPU calculation can be added back as a
separate preprocessing pass (saving the computation result [compute or
feedback]).

The goal here was to have more speed for static objects and remove
the dependency of having buffer textures with triangle count. This is
preparation work for multithreading the whole DRW manager.
2018-12-07 05:33:53 +01:00
b0726b31e6 DRW: Mesh: Make uvs use the final mesh display 2018-12-06 14:43:09 +01:00
b576e14902 DRW: Fix Uvs not working in solid mode + edit mesh 2018-12-06 14:42:25 +01:00
5bc7b9c3c6 Cleanup: unused var, style 2018-12-06 08:45:41 +11:00
5103fa4ae7 DRW: Optimize adjacency data creation a bit
This is a very small improvement and only concerns wireframe update.

My tests.
old 6fps > new 7fps > baseline (wireframe disabled) 10fps
2018-12-05 22:43:15 +01:00
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