Commit Graph

66 Commits

Author SHA1 Message Date
Clément Foucault
eef6e1cca1 StudioLight: Fix codestyle 2018-07-16 20:08:09 +02:00
Clément Foucault
43593e846b Matcap: Fix missing pixel on preview icons 2018-07-16 20:08:09 +02:00
Clément Foucault
dfd192ce41 GPUTexture: Refactor of texture creation & new feature
- Texture creation now requires explicit data type.
- GPU_texture_add_mipmap enable explicit mipmap upload.
- GPU_texture_get_mipmap_size can be used to get the size of a mipmap level
  of an existing GPUTexture
- GPU_texture_read let you read back data from a gpu texture.
2018-07-10 15:31:34 +02:00
Campbell Barton
9536f920e3 Cleanup: style 2018-07-10 09:29:30 +02:00
Jeroen Bakker
ccca2c0164 Workbench: Spherical Harmonics tests
Added a compile directive in order to test SH4 in stead of SH2Win.
For now I disabled SH4, it is a bit more clear, but has a small
performance impact. Will check later for a better approach
2018-06-29 14:59:30 +02:00
Campbell Barton
29c1069244 Cleanup: code style 2018-06-25 12:06:51 +02:00
Jeroen Bakker
dfca352294 StudioLight: Better API
In stead of a single refresh function that re-init the whole system. The
API now supports adding and removing. Which will be much faster and less
flickering of missing icons when adding/removing lights
2018-06-22 14:49:49 +02:00
Jeroen Bakker
b6b7c83dd8 StudioLight: Only apply windowing when SH level is 2
It does not make much sense for the other levels
2018-06-22 12:37:03 +02:00
Jeroen Bakker
e402c36388 Studiolight: Spherical Harmonics Windowing
Apply Windowing on the Spherical Harmonics result. This would lead to
better results.
2018-06-22 12:31:19 +02:00
Jeroen Bakker
00d52376f7 CodeStyle: Comments 2018-06-21 09:22:34 +02:00
Jeroen Bakker
e60d4d6a0c Code cleanup: Added newline 2018-06-21 09:05:31 +02:00
Jeroen Bakker
54c4a107b1 Missed warning is previous commit 2018-06-21 09:04:03 +02:00
Jeroen Bakker
032c741214 Studiolight: Calculation of irradiance buffer
The calculation of the irradiance buffer was slow. Now it is only
calculated when it is being used (background_alpha > 0.0)
this solves the freeze when switching to LookDev mode.

Also changed the default calculation to use the Spherical Harmonics
calculation. This is able to generate the irradiance buffer fast, but is
less accurate. As the irradiance buffer is only used for visual
guidance speed is more important than accuracy.

Added compile directive to switch between the implementations.
(see STUDIOLIGHT_IRRADIANCE_METHOD)

Disabled caching the irradiance buffer when
STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS is used as it is not
needed.
2018-06-21 09:02:12 +02:00
Jeroen Bakker
a3428131b6 Studiolight: Spherical harmonics
Compile time option to reduce the level of the SH
2018-06-20 16:08:11 +02:00
Jeroen Bakker
0fb1093b14 Studiolight: fixed diffuse lighting
- Orientation of the cubemap were not conform cycles and eevee
- one side of the cubemap was flipped, so one side was overlit and the
other side was to dark.
2018-06-20 15:00:23 +02:00
Campbell Barton
9f9756ec35 Cleanup: strip space 2018-06-20 10:14:04 +02:00
Jeroen Bakker
e3052ecb0d Studiolight: removed raise condition
Happened when deleting many studiolights at the same time when the
previews were still beging calculated in the background.

Added a free function callback that is filled when the preview is being
generated. This free function will then kill the preview job

This patch also removes icons that are not valid anymore so the user
cannot accidentally render an icon where the studiolight is invalid.

In the end we should use a add/remove function in the studiolight as
currently icons are recalculated too much.
2018-06-20 09:29:40 +02:00
Jeroen Bakker
0116c95d4c Studiolight: Temp Mutex issue
This is a temp fix for a better system.
Currently the studiolights can be referenced by a WM_job and being freed
via the API. This can happen when removing a studiolight via the
interface.

As the studiolight has no relation with the job, it is hard to detect if
it is still being used. I tried with a Mutex and a Thread Queue but they
were failing.

So the current temp fix is to keep the studiolights in memory until you
close blender. This Must be fixed ASAP! I added this fix so normal cases
can workish.
2018-06-19 16:37:23 +02:00
Jeroen Bakker
de748bbedf Studiolight: Background Generation of icons 2018-06-19 14:04:51 +02:00
Jeroen Bakker
65b3c7b72c Studiolight: Add SH2 cache
- the result of the SH2-coeffiecients are stored in a bin file (3*9
floats). As the file is a local file we do not care about the
architecture.
- solved issue that also for internal lights the irradiance file were
stored. We don't want that as it could be in a not accessible location
2018-06-19 09:06:35 +02:00
Campbell Barton
643370b10f Cleanup: code-style 2018-06-18 20:58:08 +02:00
Jeroen Bakker
7356cec0c6 Studiolights: Radiance icons were inverted. 2018-06-18 15:45:55 +02:00
Jeroen Bakker
7747d4cecf Workbench: increased Quality of the diffuse lighting model
- implemented Spherical Harmonics L2 for diffuse shading.

TODO: caching the precalculated harmonics so it won't take soo long to
open the popover
2018-06-18 15:32:53 +02:00
Campbell Barton
06a1a66a9b Merge branch 'master' into blender2.8 2018-06-17 17:10:19 +02:00
Campbell Barton
56173e512c Merge branch 'master' into blender2.8 2018-06-17 16:18:15 +02:00
Campbell Barton
ab20901c9e Cleanup: codestyle 2018-06-17 12:03:22 +02:00
Clément Foucault
fe98124a98 Custom Hdri: Use same AntiAliasing as Matcaps 2018-06-16 23:28:39 +02:00
Clément Foucault
b503dd7747 StudioLights: Fix preview icon.
Use same antialiasing method as the matcaps and fix the normal computation.
2018-06-16 23:28:39 +02:00
Clément Foucault
48adf90367 Matcap: Make matcap preview the same size as the other StudioLights 2018-06-16 23:28:39 +02:00
Clément Foucault
224daf55ac Matcaps: Add AntiAlias alpha mask to icon preview. 2018-06-16 23:28:39 +02:00
Clément Foucault
0332d338ea Studio Light: Fix typo 2018-06-16 23:28:39 +02:00
Campbell Barton
0ff87e3a60 Cleanup: code style 2018-06-15 20:55:37 +02:00
Jeroen Bakker
64bfa4b300 T55486: use GPU_R11F_G11F_B10F for Matcaps 2018-06-15 13:02:15 +02:00
Campbell Barton
51f1ed8221 Cleanup: style 2018-06-14 22:44:53 +02:00
Jeroen Bakker
17b029d80e T55406: Flip Matcap
- Icon represent the flipped matcap in the shading menu
- Added template_icon to display any icon in scale.
2018-06-14 11:44:36 +02:00
Jeroen Bakker
866127d9f2 StudioLight: Use texel size as input size
Bettter light distribution for diffuse shading
2018-06-12 16:18:50 +02:00
Jeroen Bakker
d72ddb81ae Studiolight: add rim lighting to the default light setup 2018-06-12 15:17:01 +02:00
Jeroen Bakker
ab0daa1866 Studiolight: Disabled irradiance icons 2018-06-12 11:53:34 +02:00
Jeroen Bakker
8cca1abcb1 Studiolight: Bumped the radiance buffer to RGBA16F
Fixes issue reported at
https://devtalk.blender.org/t/lookdev-ibl-result/890/3
2018-06-12 11:51:04 +02:00
Jeroen Bakker
e1f24a8615 Studiolight: cache irradiance buffer 2018-06-12 11:51:04 +02:00
Jeroen Bakker
3926ec6aa1 Studiolight: Segment when using float based matcaps 2018-06-08 12:11:05 +02:00
Jeroen Bakker
b3c8ffcb3e Workbench: UI for custom studio lights/matcaps
- all known image types are supported
- BpyAPI for studiolights added
- added open user pref operator in shading menu
- possible to add multiple files in a single run

For now refreshing studio lights will free all studiolights and reinit
the whole mechanism. This can be improved by only freeing deleted, reset
updated and add new custom studiolights.

details to show currently only shows the path we perhaps want to add
other information also
2018-06-08 10:41:24 +02:00
Campbell Barton
3c9e2e82fa Cleanup: style 2018-06-05 21:32:49 +02:00
Jeroen Bakker
a3815f8777 Workbench: Matcaps T55291
- users can use their own matcaps
.config/blender/2.80/datafiles/studiolights/matcap/ folder
- upto 100 matcaps can be loaded
- color of the matcap is influenced by the color of the material/single
color etc. To show the plain matcap use single color at 1.0
- chosing a matcap is at lighting level (flat/studio/matcap)
- matcap only possible in solid mode
- also works for X-Ray mode

As the old matcaps are still in used by the clay engine I didn't remove
it yet.
2018-06-05 11:38:33 +02:00
Campbell Barton
297bf7235b Cleanup: whitespace 2018-06-01 18:10:43 +02:00
Jeroen Bakker
56dc2bf0c5 Workbench: Updated the internal light to have a bit of back lighting 2018-06-01 17:15:35 +02:00
Campbell Barton
14c55a5828 Cleanup: long lines 2018-06-01 11:59:15 +02:00
Dalai Felinto
e35dab0fec Fix building for workbench in windows (BLI_INLINE) 2018-06-01 11:55:50 +02:00
Jeroen Bakker
c450966e95 Workbench: Material specific settings for the specular
- Uses the roughness setting of the basic eevee material
- renamed gloss_mir to roughness
- set default of roughness to 0.25
- renamed ray_mirror to metallic
- cleaned up material rna (BI mirror struct)
- use BLINN phong model
- normalize incoming/outgoing specular light
- when using camera oriented studiolight, the SolidLight will be used
for specular highlights
- EXPERIMENT: when in world oriented studiolight only the shadow direction will be used.
- change the settings of the internal light to make scenes more
readable
2018-06-01 11:01:55 +02:00
Campbell Barton
1f693aefca Cleanup: style/whitespace
Also use 'uint'.
2018-05-30 19:49:33 +02:00