Commit Graph

1476 Commits

Author SHA1 Message Date
Clément Foucault
d89f9d70c5 Eevee: Fix bug with transparent object + volume rendering.
This was because the main_fb was not bound back to be updated.
Following draw calls were drawn without depth buffer.
2018-05-08 14:31:17 +02:00
Jeroen Bakker
cc8672b95e Fix T54999: error when entering edit mode in texture shading
When entering edit mode the texture coordinates is not calculated by
drawcachemesh. For now fallback to solid mode. This gives wrong
artifacts when disabling overlays when in edit mode. We should make it
possible to calculate the UVLOOP from bmesh. This will be done in a next
patch
2018-05-08 14:02:45 +02:00
Clément Foucault
9a79178c2e Armature: Add back Stick bone draw type.
The actual code is a bit convoluted but allows good and "pseudo efficient"
drawing. (pseudo efficient because rendering instances with that amount of
vertices is really inneficient. We should go full procedural but need to
have bufferTexture implemented first) But drawing speed is not a bottleneck
here and it's already a million time less crappy than the old (2.79) immediate
mode method.

Instead of drawing actual wires with different width we render a triangle
fan batch (containing 3 fans: bone, head, tail) which is then oriented in
screen space to the bone direction. We then interpolate a float value
accross vertices giving us a nice blend factor to blend the colors and
gives us really smooth interpolation inside the bone.

The outside edge still being geometry will be antialiased by MSAA if enabled.
2018-05-08 12:18:35 +02:00
Sergey Sharybin
9401021f8b Clay: Simplify matcap manipulation
No need to hard-coded handling of every individual matcap.

They are in the continuous index range anyway.
2018-05-08 11:56:58 +02:00
Sergey Sharybin
1fd1d061ac Clay: Don't use hardcoded constant in the string
Stringify the actual constant instead.
2018-05-08 11:56:58 +02:00
Campbell Barton
86b9311926 Cleanup: quiet warning, whitespace 2018-05-08 10:58:04 +02:00
Clément Foucault
3c79043f1b DRW: Fix incorrect blending function reset. 2018-05-07 18:29:45 +02:00
Clément Foucault
b0b2a47853 Armature: Transparent Bone: Fix envelope not being alpha blended. 2018-05-07 17:12:04 +02:00
Clément Foucault
8ab3697e21 Armature: Add new Transparent Bone overlay option.
This is half the replacement of the old wireframe mode. It's not doing any
XRay drawing at the moment.
2018-05-07 17:00:10 +02:00
Clément Foucault
2f76e95b96 DRW: Do not multiply alpha or color by alpha if not in blend more. 2018-05-07 17:00:10 +02:00
Clément Foucault
29c650c3cc DRW: Add DRW_pass_state_add and DRW_pass_state_remove 2018-05-07 17:00:10 +02:00
Jeroen Bakker
9f4d92bb92 Workbench: Texture Shading mode
- draws the active texture of the material
- if the texture cannot be found it will fallback to solid/material
2018-05-07 15:00:16 +02:00
Jeroen Bakker
f09d3a7a40 Workbench: Texture Shading mode 2018-05-07 14:59:27 +02:00
Clément Foucault
b029cc5d74 Eevee: Hair: Fix wrong color when shader is compiling. 2018-05-07 13:08:21 +02:00
Clément Foucault
9215b41dd3 Armature: Fix BBones base face winding.
Was producing wrong outline and backface culling.
2018-05-07 13:08:21 +02:00
Clément Foucault
5c728358ec Armature: Remove big outlines for active bones & reduce axes color. 2018-05-07 13:08:21 +02:00
Clément Foucault
e3d30ffb92 Armature: Add back relationship lines. 2018-05-07 00:24:41 +02:00
Clément Foucault
17370a27a3 Object Mode: Use stipple shader for relationship lines. 2018-05-07 00:24:41 +02:00
Clément Foucault
c769b1a553 Armature: Add a special Pass for bone axes.
In object mode, the axes are drawn like any other wire objects with
depth test and depth write. Thus enabling MSAA to work but not their xray
behaviour.

In edit armature/pose mode, draw smooth line without depth testing. This
produces wrong draw ordering problem but still gives the desired xray
behaviour. We do it outside of the MSAA pass since the xray behaviour is not
compatible with it. But we are drawing smoothed lines so no need for MSAA.
The lines are 2px thick and improve readability.
2018-05-06 18:42:23 +02:00
Clément Foucault
48ddb2b98a Armature: Fix bone axes not using bone color. 2018-05-06 18:36:47 +02:00
Clément Foucault
1c3f953565 Armature: Put passes in a struct easier to pass around. 2018-05-06 18:36:47 +02:00
Clément Foucault
2bc0c4ec59 DRW: Add DRW_STATE_WIRE_SMOOTH to draw smooth wires.
This is only useful if depth test/wire is disabled.
2018-05-06 18:36:47 +02:00
Clément Foucault
c472936074 Armature: Fix/Change bone axes display.
Now the axes are displayed correctly at the tip of the bone and with the
axes names.

I've made some modifications though:
- Axes are colored. (should not be in object mode but that's TODO)
- Axes ends are not flat arrows anymore. Replaced with a small diamond.
- Axes names are now scale by their respective axes instead of being
  affected by other axes.
- Changed axes names "font" to be a bit more sexy.
2018-05-06 18:36:47 +02:00
Brecht Van Lommel
37c5145ef2 Workbench: if no material is available, use color 0.8 like default material. 2018-05-06 16:08:12 +02:00
Dalai Felinto
f4e9620eff Fix crash on armature drawing 2018-05-06 00:23:13 +02:00
Clément Foucault
e1e7915233 Armature: Fix object mode display.
Don't show wires if not selected.
Bone outline size match meshes outlines.
2018-05-05 22:58:46 +02:00
Clément Foucault
759ff83e88 Armature: Change Bone drawing.
This makes a few changes:
- Remove the old "overlay" wires.
- Add constraints colors to bones.
- Specify a a new "hint" color per bone. Making selection/Active state
  more obvious.
- Unify Octahedral/B-Bones/Envelope shading and colors.
- Change outline size depending on the selection/active state of the bone.

Note that thoses changes are not final and needs review.
2018-05-05 21:04:21 +02:00
Clément Foucault
817cf2a317 Armature: Rename bone shaders and add 2 colors smooth blending.
This will enable us to do more nice stuff in future commits.

This commit is a temporary commit, it will compile but will crash if
trying to display any armature. Next commit does work.
2018-05-05 21:04:21 +02:00
Clément Foucault
b2188d631a Armature: Outline: Fix outline detection in critical cases.
Outline was not generated because the normal was completely orthogonal to
the view.
2018-05-05 21:04:21 +02:00
Clément Foucault
3b075d0c8d Armature: Make bone outlines thickness variable. 2018-05-05 21:04:21 +02:00
Clément Foucault
eec3fc1273 Armature: Set outline width to 2.0.
Correspond roughly to 1px width.
2018-05-05 21:04:21 +02:00
Clément Foucault
1107223a63 Workbench: Temporary fix washed out background color.
Save our eyes until proper color management is implemented.
2018-05-05 21:04:20 +02:00
Brecht Van Lommel
1ddedfb2af 3D viewport: rename ambient to shadow intensity, default single color to 0.8. 2018-05-05 16:01:45 +02:00
Brecht Van Lommel
b365cc017a 3D Viewport: move overlay settings from collections to 3D viewport.
For some we may add per object overrides, but for most we plan to keep them
strictly per viewport settings. Display settings from the mesh still need to
be moved here, only collections were done to remove that code.
2018-05-05 15:54:43 +02:00
Brecht Van Lommel
2094b45447 3D Viewport: make shading and overlay DNA match UI names.
We should use consistent naming between the internal code and UI whenever
possible, only reason not to is file compatibility.
2018-05-05 15:54:36 +02:00
Brecht Van Lommel
cfd39887d1 Cleanup: fix compiler warnings. 2018-05-05 15:51:13 +02:00
Brecht Van Lommel
309e9521f8 Groups: remove drawing group objects in a different color.
With the upcoming unification of groups and collections this will make
no sense anymore, as all objects will be in a collection.
2018-05-05 15:51:13 +02:00
Jeroen Bakker
d979f1fc62 Workbench: Fix reading and testing from depth buffer 2018-05-05 15:32:48 +02:00
Clément Foucault
3b0475bc64 Eevee: Shadows: Don't allocate more CSM layer than we need. 2018-05-04 19:24:13 +02:00
Campbell Barton
0503f31c66 Cleanup: trailing space 2018-05-04 19:22:38 +02:00
Clément Foucault
3f6fac91ff Eevee: Fix Cascaded shadow map calculation.
The first one was done correctly but the second was wrong due to the matrix
being overwritten.
2018-05-04 19:09:12 +02:00
Clément Foucault
bb063ec31e DRW: Add DRW_viewport_far/near_distance_get functions. 2018-05-04 19:09:12 +02:00
Jeroen Bakker
a73c02a17b Workbench: Color selector when in single color mode 2018-05-04 17:26:10 +02:00
Jeroen Bakker
d85fd8feeb T54953: Use OCIO for display color management 2018-05-04 16:27:14 +02:00
Jeroen Bakker
50c5e2aa08 Workbench: Random color generation
Now the colors are determined from the name and library name of the
object. This should make more consistent random colors
2018-05-04 16:27:14 +02:00
Clément Foucault
39050f6eee Eevee: Shadows: Compute Octahedron size from CubeMap size.
This was the otherway around before. But since we can have a different size*
for cube texture now, we can compute the correct-ish texture size.

This will give us on average the same texture appearance when we will add
support for real cubemap shadows.
2018-05-04 16:22:23 +02:00
Clément Foucault
e6ce78895d Eevee: Cap Shadow resolution to 4096px^2.
As much as I want to give freedom to the user, 1.5G of vram for a
single shadow is a big of a stability issue.

So limiting to 4096 for now, we may remove this limit in the future.
2018-05-04 16:22:23 +02:00
Clément Foucault
f48e53f562 Eevee: Shadows: Separate Cube and Cascade shadow maps into 2 texture array.
This mean we can now have different shadow resolutions for both.

However each shadow type keep the same size accross all lamps because of
future "real" Cube Shadowmaps limitation and to save texture sampler slots.

That said the cascade shadow resolution could (in the future) still be
changed to be adjustable per sun lamp.
2018-05-04 16:22:23 +02:00
Clément Foucault
d4dd872d56 Eevee: Simplify shadow test code with macros. 2018-05-04 16:22:23 +02:00
Jeroen Bakker
3f95daa31f Workbench: Shadows
Initial review of the shard shadows in the workbench engine.

Speed optimizations like transform feedback are not implemented yet. I first want this part to be reviewed and merged.

@fclem please check the note in drw_stencil_set it was holding back nequal == 0 as by default DST.stencil_mask was set to 0. questioin is should we remove the whole check or not.

Also I am still looking for a better name (or split the enum) for DRW_STATE_STENCIL_DEPTH_FAIL_INCR_DECR_WRAP

Reviewers: fclem

Reviewed By: fclem

Tags: #code_quest

Differential Revision: https://developer.blender.org/D3198
2018-05-04 14:08:40 +02:00