Commit Graph

75472 Commits

Author SHA1 Message Date
Campbell Barton
f5cb96704b WM: add function to access last_properties 2018-05-03 07:09:22 +02:00
Germano
e4774c0b2d Metaball: pointers used in DRW_shgroup_call_dynamic_add don't need to hold the reference. 2018-05-02 21:26:43 -03:00
Clément Foucault
36bbf80929 Armature: Envelope: Small cleanup + don't smooth the distance display.
The actual weighting calculation is not smooth as the bone display.

The bone itself can be smooth for esthetic purpose but the distance display
should match the underlying weighting formula.
2018-05-02 20:49:38 +02:00
Clément Foucault
46662a289b Armature: Envelope: Optimize outline shader. 2018-05-02 20:49:38 +02:00
Clément Foucault
0ea329d32d Armature: Envelope: Revisit envelope drawing again.
Past shader was too slow and had bad artifacts. This method is much simpler
and eficient and only exhibit some popping when the raidus of the head/tail
is changed.
2018-05-02 20:49:38 +02:00
Clément Foucault
73cb83d48f GPUShader: Remove unused envelope shaders. 2018-05-02 20:49:38 +02:00
Clément Foucault
e764d2b6ba Armature: More work and cleanup on envelope bones drawing.
- Draw tail & head sphere with point shader (no needs for another way).
- Use the same function for issuing the calls for wire and solid envelope.
2018-05-02 20:49:38 +02:00
Clément Foucault
a76d27f694 Armature: Add envelope outline shader. 2018-05-02 20:49:38 +02:00
Clément Foucault
01cec3e0c5 Armature: Envelope Bones: Change drawing method.
We now use a more pleasant and efficient way to display enveloppe bones
and their radius.

For this we use a capsule geometry that is displaced (in the vertex shader)
to a signed distance field that represents the bone shape.

The bone distance radius are now drawn in 3D using a "pseudo-fresnel" effect.
This gives a better understanding of what is inside the radius of influence.

When capsules are not needed, we switch to default raytraced points.
The capsules are not distorded by the bone's matrix (same as their actual
influence radius) and are correctly displayed even with complex scaled
parents hierarchy.
2018-05-02 20:49:38 +02:00
Clément Foucault
18071f4e0e Armature: Draw envelope on non MSAA buffer.
Appart from the performance issue, the MSAA resolve pass is not compatible
with additive passes.
2018-05-02 20:49:38 +02:00
Clément Foucault
d0d282bf2f Armature: Add multisampling to posemode. 2018-05-02 20:49:38 +02:00
Clément Foucault
6f5bf23c98 DRW: Convert DRW_cache_circle_get to use GWN_PRIM_LINE_LOOP 2018-05-02 20:49:38 +02:00
Clément Foucault
8c2a6f957a Armature: "Raytrace" bones endpoint spheres.
Here is how it works:
We render a high poly disc that we orient & scale towards the camera so that
it covers the same pixel of the sphere it's supposed to represent.

Then the pixel shader raytrace the sphere (effectively starting from
the poly disc depth) and outputs the depth to gl_FragDepth.

This approach has many benefit:
- high quality obviously: per pixel accurate depth!
- compatible with MSAA: since the sphere horizon is delimited by polygons,
  we get the coverage computed by the rasterizer. However we still gets
  aliasing if the sphere intersect directly other meshes.
- virtually no overdraw: there is no backface to shade but we still get
  overdraw because by little triangle [gpus rasterize pixel by groups of 4].
- allows early depth test: since the poly disc is set at the nearest depth
  we can output, we can use GL_ARB_conservative_depth to enable early depth
  test and discard pixels that are already behind geometry.
- can draw outline pretty easily without geometry shader.
2018-05-02 20:49:38 +02:00
Clément Foucault
a56561dcd2 DRW: Make use of new multisample resolve pass. 2018-05-02 20:49:38 +02:00
Clément Foucault
33356b7be0 DRW: Add DRW_multisamples_resolve function
This manually resolve the content of a multisample FB to a single sample FB.

It resolves color (combine the 2 framebuffers in a logical maner keeping
depth buffer occlusion etc..) instead of a plain glBlitFramebuffer copy.
2018-05-02 20:49:38 +02:00
Clément Foucault
6d8e308eae GPUShader: Optimize Multisample resolve shader.
Group all fetches together without interleived alu to let compiler optimize.

Also do the color samples only if needed.

Went from 3.86ms to [1.11-2.22]ms [min-max] for the 16samples resolve pass
on my nvidia card.
2018-05-02 20:49:38 +02:00
Clément Foucault
1fff3e02c2 DRW: Add DRW_STATE_BLEND_PREMUL blend mode. 2018-05-02 20:49:38 +02:00
Clément Foucault
12570c7373 GPUShader: Add GPU_SHADER_2D_IMAGE_MULTISAMPLE_2/4/8/16
This shader is used instead of blitting back and forth to a single sample
buffer.

This means it resolves the color and depth samples and outputs a fragment
which can be depth tested and blended on top of an existing framebuffer.

We do static shader variation with manual loop unrolling for performance
reason. In my test I get 25% more perf with intel integrated gpu and 75%
performance gain with dedicated nvidia card compared to a single shader
with a uniform for sample count.
2018-05-02 20:49:38 +02:00
Clément Foucault
a8463284bb GPUShader: Fix simple lighting modulating alpha color 2018-05-02 20:49:38 +02:00
Clément Foucault
ad97ba3367 Object Mode: Draw non meshes before outline.
This makes the outlines occluded by the other objects. This was a problem
before the outline refactor but now there is no need for it.
2018-05-02 20:49:38 +02:00
Clément Foucault
e493a1a1ae DRW: Armature: New bone outline shader.
This fix the issue with the zfighting we were getting at bones edges.

Moreover, this enables us to render arbitrarly large outline with
varying thickness.
2018-05-02 20:49:38 +02:00
Clément Foucault
77b481fd5a DRW: Add Adjacency info for bone shapes.
Only for cube and octahedral shapes for now.
2018-05-02 20:49:38 +02:00
Clément Foucault
3f9f27e5a8 GPUTexture: Fix wrong multisample texture size. 2018-05-02 20:49:38 +02:00
Bastien Montagne
7d384bcdbb Static Override: Lock 'edition' of constraints & modifiers from overridden data.
Means that you cannot move or delete constraints/modifiers coming from
the overriden linked datablock. Local inserted ones can be fully edited.
2018-05-02 18:45:22 +02:00
Clément Foucault
fd23c42faa Paint Vertex Mode: Fix shader not free. 2018-05-02 18:39:53 +02:00
Clément Foucault
1ff2646d58 Eevee: Add Lamp Specular multiplier.
It's usefull in some scenario to tweak the specular intensity of a light
without modifying the diffuse contribution.

Cycles allows it via lamps material which we currently not support in Eevee.

This is a good workaround for now.
2018-05-02 18:39:53 +02:00
Dalai Felinto
965e6ed54f Fix T54864: Assert when changing interface display scale
The asserts were introduced on rB5f6c45498c92 (top-bar).

Although the asserts are technically correct, they would fail even in master.
And the commit simply added the asserts without fixing the situation itself
(as you can see in the report, it is really simple to reproduce this issue).

I propose we remove the asserts and bring them back only when the situation
itself is fixed. It doesn't make sense to introduce asserts that would fail
with the current state of the code.
2018-05-02 18:32:44 +02:00
Bastien Montagne
0fb5a39baf Static Override: add insertion for modifiers and one constraints, fix editing of inserted items in collections.
Now insertable collection items have a flag to say they are 'local' (and
hence can be freely edited).
2018-05-02 18:14:19 +02:00
Jeroen Bakker
d877831115 Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-05-02 17:37:37 +02:00
Jeroen Bakker
f0d67d8f6a Workbench: Linear => srgb conversion 2018-05-02 17:37:11 +02:00
Dalai Felinto
b6b17338c2 Fix mysterious crash on tooltips
This was a hard to reproduce bug, but it happens often enough.
Basically the tooltip of the active tool was been invoked when
context had no valid ScrArea which would lead to a crash.

We now just return no tooltip in these cases.
2018-05-02 17:37:05 +02:00
Sergey Sharybin
3fa6b6ed4c Depsgraph: Add function to iterate over all original IDs 2018-05-02 17:09:44 +02:00
Sergey Sharybin
7c32ef84aa Use meaningful debug name for render depsgraph 2018-05-02 17:09:44 +02:00
Sergey Sharybin
6560a96232 Depsgraph: Show log message when tagging specific depsgraph ID 2018-05-02 17:09:44 +02:00
Sergey Sharybin
b6aa8a71fd Depsgraph: Add per-depsgraph debug name which is shown in the logs
This way we can see for which depsgraph datablock is being evaluated for.
2018-05-02 17:09:44 +02:00
Sergey Sharybin
651a255931 Depsgraph: Cleanup, naming conventions 2018-05-02 17:09:44 +02:00
Sergey Sharybin
bb75c4cbe9 Depsgraph: Make all print messages to respect per-depsgraph debug flags 2018-05-02 17:09:44 +02:00
Sergey Sharybin
65e6654c85 Depsgraph: Allow per-depsgraph debug flags
Currently only affects EVALUATION debug messages, rest are to be
supported on per-depsgraph level.
2018-05-02 17:09:44 +02:00
Sergey Sharybin
2f4dea0ef9 Depsgraph: Use utility function to print CoW update function 2018-05-02 17:09:44 +02:00
Sergey Sharybin
c7e0bb0b90 Depsgraph: Make bAction a part of dependency graph
There are various values which depends on context in there, for example
current driver value and original DNA value f-curve is applied for.

This partially fixes issue with not being able to tweak keyed values
when material preview is open.

The material preview is not being currently updated against non-keyed
changes since every tweak of material property does full preview scene
depsgraph evaluation.
2018-05-02 17:09:44 +02:00
Jeroen Bakker
98461aa5dc Workbench: Fix interface change in draw maanger 2018-05-02 17:08:42 +02:00
Jeroen Bakker
9cfbdff71c Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2018-05-02 16:59:42 +02:00
Clément Foucault
befbf7eb9b Vertex Paint: Use Linear colors for interpolation.
This matches Cycles and Eevee's behaviour.
2018-05-02 16:45:08 +02:00
Clément Foucault
a2b05accea Eevee: Fix vertex color being in srgb space.
Now they are properly converted to Linear space before interpolation.

Since the only way to get vertex color in eevee and cycles is via the
attribute node with the CD_AUTO_FROM_NAME flag, we have to know at binding
time which type of buffer will be connected to this auto input.

We store this information inside the batch cache (together with the according
uniform name) and pass it as uniform to the shader which does conversion if
needed. The same shader can then be reused to draw another mesh with
different auto layers configuration.
2018-05-02 16:45:08 +02:00
Sybren A. Stüvel
648de1be52 Modifiers: ported Skin modifier DerivedMesh → Mesh 2018-05-02 16:39:22 +02:00
Sybren A. Stüvel
3f2f27642e Renamed 1st parameter of BKE_bmesh_to_mesh from me to be
It's a BMesh, it shouldn't be called `me`
2018-05-02 16:39:22 +02:00
Bastien Montagne
6a9e6b1448 Merge branch 'blender2.8' into tmp-static-override-insertion 2018-05-02 16:16:17 +02:00
Bastien Montagne
ce7575c823 Static Override: Move 'auto' flag into override struct, expose it to RNA. 2018-05-02 16:15:52 +02:00
Sybren A. Stüvel
40771a0e9e Modifiers: ported Solidify modifier DerivedMesh → Mesh 2018-05-02 16:03:16 +02:00
Campbell Barton
2450b70efa Mesh: add runtime customdata dirty flags 2018-05-02 15:52:59 +02:00