Commit Graph

191 Commits

Author SHA1 Message Date
Jeroen Bakker 38a0896f15 Overlay: Mesh Analysis
Enabling the drawing of the mesh analysis overlay.
Currently the settings are part of the scene toolsettings. What makes sense,
for 3d printing, but does not fit well with the per viewport blender 2.80
overlays.

Reviewers: brecht, fclem

Differential Revision: https://developer.blender.org/D4707
2019-04-25 11:25:22 +02:00
Campbell Barton 2753959ed7 Cleanup: sort CMake include paths 2019-04-24 14:41:12 +10:00
Campbell Barton e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Campbell Barton edc1b01675 CMake: add libs needed for gtests 2019-04-16 08:07:01 +02:00
Campbell Barton 5498e7f193 CMake: add library deps to CMakeLists.txt
Tested to work on Linux and macOS.

This will be enabled once all platforms are verified.

See D4684
2019-04-16 06:20:52 +02:00
Campbell Barton 47adab4f99 CMake: prepare for BLENDER_SORTED_LIBS removal
No functional change, this adds LIB definition and args to cmake files.
Without this it's difficult to migrate away from 'BLENDER_SORTED_LIBS'
since there are many platforms/configurations that could break when
changing linking order.

Manually add and enable WITHOUT_SORTED_LIBS to try building
without sorted libs (currently fails since all variables are empty).
This check will eventually be removed.

See T46725.
2019-04-14 15:37:24 +02:00
Clément Foucault f12040e088 DRW: Opti: Fix hotspot in DRW_mesh_batch_cache_get_surface_shaded
The hotspot was generated by mesh_cd_layers_type_overlap who was testing
way more data than it should have.

Here we reduce the whole CD layer mask to a 32bit bitflag that is easily
or'ed and tested.

Bonus point: We use atomic operation to merge the mask in order to allow
future multi-threading. (this was a TODO)

In the scene attached to T58188 this removes 5% of CPU time.
2019-04-06 01:55:21 +02:00
Campbell Barton 168d3fd528 Cleanup: file rename lamp -> light 2019-02-27 12:36:32 +11:00
Campbell Barton caa8e7ff28 DRW: de-duplicate vertex & weight paint engines
These were almost exact duplicates, use one engine for drawing both
kinds of vertex color.
2019-02-14 15:22:58 +11:00
Campbell Barton dbd7f36da8 GPU: refactor clipped drawing from DRW into GPU
Needed to fix T61196, supporting clipped back-buffer in the 3D view
which is done outside the draw module.

It was also inconvenient having DRW_shader_* versions of GPU_shader_*
API calls.

- Clipping distances are now supported as a shader configuration
  for builtin shaders.
- Add shader config argument when accessing builtin shaders.
- Move GPU_shader_create_from_arrays() from DRW to GPU.
2019-02-06 09:15:16 +11:00
Clément Foucault 773f3428cf Edit Mesh: Add workaround for system that does not support wide lines
This adds a new geometry shader (specific to edit mesh for now) that
reproduces the effect of glLineWidth > 1.0, since this is not supported on
all platform.

This fix could be generalized to other shaders later.
2019-02-05 15:02:15 +01:00
Clément Foucault 112cf6eadf Edit Mesh: Remove old unused code and files
Cleanup after recent refactor.
2019-02-05 15:02:15 +01:00
Campbell Barton ab5e69e660 Cleanup: remove contributors for CMake files
Following removal from C source code.

See: 8c68ed6df1
2019-02-05 09:10:32 +11:00
Clément Foucault 3f6e14e667 Workbench: Depth Of Field: Initial Commit
The algorithm used is borrowed from :
http://tuxedolabs.blogspot.com/2018/05/bokeh-depth-of-field-in-single-pass.html

This makes it possible to have a decent blur for foreground over defocused
background in one pass only.

The algorithm is using a gather approach that is much faster
than the scatter approach used in Eevee. This makes it possible to have
custom bokeh shapes (not implemented yet) which would be impossible with
a separable gaussian technique.

The blur is done in 2 steps. The first one define the shape of the bokeh
and the second that fill the undersampling.

A downsample max-CoC tile texture speed up the gathering process.
2019-01-25 15:02:49 +01:00
Campbell Barton 2218bf02dd Cleanup: sort cmake file lists 2019-01-25 08:30:33 +11:00
Campbell Barton e72fa714a8 Cleanup: remove duplicated shaders that only added clipping checks
Originally I wanted to avoid adding draw manager specific ifdef's all
over generic shaders however this isn't needed in so many places.

Also there are shaders that are only used by the draw manager so
duplicating them only to have the original unused doesn't make sense.
2019-01-25 08:01:07 +11:00
Campbell Barton 04d18b117c DRW: API for own versions of builtin GPU shaders
DRW_shader_get_builtin_shader can replace GPU_shader_get_builtin_shader
when we need to support clipping.

Use this for loose point & wire drawing in object mode,
clips edges in lattice edit mode.
2019-01-24 16:14:00 +11:00
Campbell Barton 9bc47ed0f6 Fix clipping shaders with some AMD/Intel drivers
Caused:
    error: unsized array index must be constant

Use hard coded number of clipping planes, copying the 4th to 5 & 6
when only 4 are used.
2019-01-21 23:55:53 +11:00
Clément Foucault 4cd558b711 Mesh Batch Cache: Port Texture paint wires to new batch request 2018-12-17 17:11:45 +01:00
Clément Foucault 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
Clément Foucault 1d23024014 Object Mode: Make point clouds a bit less like uniform blobs
Also this display is optimized. It does not use blending and pixel discard.
Working with scanned data should be more pleasant with this.

A better option would be to use gl_FragDepth to have a better sense of
volume but this discards early depth test.
2018-12-10 23:17:20 +01:00
Clément Foucault 9f5a27c5be GPU: Remove EXT and add assert
Some drivers accept shaders with only vertex stage, but some just silently
fails.
2018-12-07 05:33:46 +01:00
Clément Foucault 223c1a107a Workbench: Make object ID pass optionnal
We separate the background and foreground shading passes to be able to make
the object id pass optionnal if we don't need it.

This saves a bit more memory. Also not clearing all rendertargets saves
some GPU time too.
2018-12-03 17:19:11 +01:00
Antonioya 99f7934e19 GP: New Blend Layers functionality
Now it's possible define the blend mode between layers including the option to clamp the layer using underlying layers.

Also a new Simplify option has been added to disable blend layers.
2018-11-26 18:12:39 +01:00
Lukas Stockner c0816cd03b Workbench: Add Curvature overlay for better visibility of surface detail for e.g. sculpting
The approach is fairly simple, just apply an edge detection filter to the view normal and scale the brightness based on that.

The overlay is disabled at object boundaries to avoid dark lines around objects.

Generally, this implementation follows the proposal of @monio at https://blender.community/c/rightclickselect/J9bbbc.
The changes are:
- Dynamic filter radius (on high-DPI displays, a radius of two is used)
- Options to reduce the strength of both ridges and valleys
- Tweaked function for the strength reduction (the original method actually had a local maximum, resulting in a brighter line inside valleys)
- Multiplication for blending instead of overlay, which doesn't work reliably with scene-referred intensities
- Renamed to point out the distinction between it and the SSAO-based cavity overlay

Reviewers: jbakker

Reviewed By: jbakker

Subscribers: billreynish, manitwo, linko, monio

Differential Revision: https://developer.blender.org/D3617
2018-11-26 17:31:18 +01:00
mano-wii 1f458895f8 Fix crash when rendering a scene first and then goes to eevee preview modes and cleanup
The crash only occurs with Intel 3rd generation GPUs.
It occurs because the program needs to be used at least once in the opengl context in which it is created.
2018-11-16 13:46:13 -02:00
Clément Foucault 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
Antonioya c2519d8521 GP: New Glow Shader FX (wip)
New shader to simulate a glow of the color.

The glow can be generated by luminance threshold or using a selection color.
2018-10-10 23:00:56 +02:00
Clément Foucault 89c30ff746 Pose Mode: Add back IK Degrees of freedom display 2018-10-03 15:44:12 +02:00
Antonioya f1afa6f6a7 GP: implement Shadow FX (wip)
Initial implementation of effect to create a drop shadow of the strokes
2018-09-30 11:49:02 +02:00
Jeroen Bakker 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
Clément Foucault 586ec7588f Cleanup: Edit Surface & Curve engines unused code 2018-09-26 16:42:57 +02:00
Clément Foucault 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
Campbell Barton 1450a37555 CMake: add missing headers 2018-09-06 21:23:25 +10:00
Clément Foucault c05b9bbcc0 Fix T56692: The edges are not highlighted in Mark Freestyle Edge
This was not ported yet.
2018-09-05 19:00:12 +02:00
Clément Foucault 0ba3a1a686 Sculpt: Optimize Mask Overlay drawing
* Remove support for diffuse color in the pbvh buffers.
* Upload raw data to GPU.
* Only draw nodes that have mask data when drawing the overlay.

This should fix T56466
2018-08-24 16:46:59 +02:00
Clément Foucault 435f308eed Object Mode: Use same empty (arrow) drawing as the bone axes display 2018-08-17 13:04:26 +02:00
Clément Foucault c761153f64 Overlays: Support for wireframes and edit mode overlay on xray objects 2018-08-16 23:57:59 +02:00
Clément Foucault 485b8d41be Workbench: Add support for the xray object option
Xray object can be see through other objects. They cast shadows as well
but cannot receive then.
2018-08-14 21:38:13 +02:00
Antonioya 66da2f537a New Grease Pencil object for 2D animation
This commit merge the full development done in greasepencil-object branch and include mainly the following features.

- New grease pencil object.
- New drawing engine.
- New grease pencil modes Draw/Sculpt/Edit and Weight Paint.
- New brushes for grease pencil.
- New modifiers for grease pencil.
- New shaders FX.
- New material system (replace old palettes and colors).
- Split of annotations (old grease pencil) and new grease pencil object.
- UI adapted to blender 2.8.

You can get more info here:

https://code.blender.org/2017/12/drawing-2d-animation-in-blender-2-8/
https://code.blender.org/2018/07/grease-pencil-status-update/

This is the result of nearly two years of development and I want thanks firstly the other members of the grease pencil team: Daniel M. Lara, Matias Mendiola and Joshua Leung for their support, ideas and to keep working in the project all the time, without them this project had been impossible.

Also, I want thanks other Blender developers for their help, advices and to be there always to help me, and specially to Clément Foucault, Dalai Felinto, Pablo Vázquez and Campbell Barton.
2018-07-31 10:50:43 +02:00
Brecht Van Lommel 644fadf2f0 Render: add "OpenGL" render engine.
This is intended for quick renders for previsualization, animation previews
or sequencer previews. It provides the same settings as found in the 3D view
Shading popover in solid display mode, but in the scene render properties.

The "Workbench" engine was removed, and this name no longer appears in the
user interface, it's purely an internal name. We might come up with a better
name for this OpenGL engine still, but it's good to be consistent with the
OpenGL Render operator name since this has a similar purpose.
2018-07-17 16:46:09 +02:00
Clément Foucault 7a693626d6 Smoke: Port display to Workbench + object mode
This does not fix the smokesim. It only port the drawing method.

The Object mode engine is in charge of rendering the velocity debugging.

Things left to do:
- Flame rendering.
- Color Ramp coloring of volume data.
- View facing slicing (for now it's only doing sampling starting from the
  volume bounds which gives a squarish look)
- Add option to enable dithering (currently on by default.
2018-07-16 20:08:09 +02:00
Clément Foucault 1a43e08187 Eevee: LightCache: Initial Implementation
This separate probe rendering from viewport rendering, making possible to
run the baking in another thread (non blocking and faster).

The baked lighting is saved in the blend file. Nothing needs to be
recomputed on load.

There is a few missing bits / bugs:
- Cache cannot be saved to disk as a separate file, it is saved in the DNA
  for now making file larger and memory usage higher.
- Auto update only cubemaps does update the grids (bug).
- Probes cannot be updated individually (considered as dynamic).
- Light Cache cannot be (re)generated during render.
2018-07-10 15:31:34 +02:00
Jeroen Bakker 2b4c7600b7 Workbench: Anti-aliasing refactor
- TAA is also enabled for Forward rendering
- Uses less GPU memory (removed one history buffer)
- TAA is done after the color management
- consolidated the aa code between forward and deferred rendering
(workbench_effects_aa.c)
2018-06-28 14:39:15 +02:00
Jeroen Bakker cf8a059769 Workbench: Tempural Anti Aliasing
- FXAA is now also done in the workbench_forward engine.
- User can enable TAA8 in the userpref by setting their max
viewport AA to TAA8. FXAA will still be used when navigating
2018-06-26 16:35:47 +02:00
Jeroen Bakker e552247489 MeshEditMode: refactor
- added a lib for shaded functions
- decreased active face inner size
2018-06-15 15:37:13 +02:00
Jeroen Bakker 0276abbcf7 Workbench: FXAA
FXAA implementation in the deferred renderpass of the workbench.
Can be enabled per 3dview. Eventually this will also be a user setting
as it is more a system/performance setting than a scene setting.
2018-06-15 13:02:16 +02:00
Jeroen Bakker b6b1e0f56c T55454: removal of clay engine
The ClayEngine was introduced to test the blender2.8 architecture during
development. As currently we have the wanted features implemented with
matcaps we are going to remove the clay engine as it was never intended
to be an official releasable engine

Note: The test cases are never run. But when enabled will be skipped as
they were implemented over the Clay Engine
2018-06-12 15:32:31 +02:00
Clément Foucault 542462d35c Workbench: Xray: Add selected/active non-occluded outlines
This Fix the problem when multiple objects are selected and one of them
occlude the others. You cannot see clearly what is selected.

With this option, selection is more clear when Xray mode is enabled.
2018-06-10 20:06:26 +02:00
Clément Foucault 95894421cb Workbench: Xray: Optimize and fix implementation.
There was a method explained in the Weighted Blended Order-Independent
Transparency paper to support hardware that does not support per render
target blending function.

So now only 2 geometry passes are required instead of 3 (one being the
outline/depth fill pass).

This also fix how the blending is done. There was some premult confusion
in the implementation.
2018-06-10 20:06:26 +02:00