Commit Graph

10380 Commits

Author SHA1 Message Date
Campbell Barton fc08fe82ae Cleanup: spelling 2021-03-01 11:00:22 +11:00
Kévin Dietrich 5c6cd5f8cd Cleanup: unused class member 2021-02-26 20:57:24 +01:00
Kévin Dietrich 72370b92be Fix T85926: Cycles missing viewport updates when making materials single user
This issue seems to be caused by the reallocation flag not being set on
the device shader data array so it was never updated on the GPU although
the host memory was modified.
2021-02-25 02:18:02 +01:00
Ray Molenkamp 4fb0c83c1c Cmake/deps: Update OSL to 1.11.10.0
This bumps OSL to 1.11.10.0. OSL Has a new build time
dependency: Clang, and more importantly it expects
clang and llvm to share a library folder, which it
previously for us did not.

This patch changes:

-OSL Update to 1.11.10.0

-refactor the llvm/clang/clang-tools-extra builds into the llvm
 build using the llvm-project tarball for building that has all
 of the subprojects in it.

-update ispc/openmp builds since clang no longer its own dependency
 and they have to depend on the llvm build now.

-Update the windows builder to use the 64 bit host tools since it
 ran out of ram linking clang

-Since OSL now needs clang to link successfully a findclang.cmake
 has been provided for linux/OSX

Differential Revision: https://developer.blender.org/D10212

Reviewed By: brecht, sebbas, sybren
2021-02-24 07:13:37 -07:00
Nicholas Rishel eb554051e7 Revert Automatic Tablet API dynamic fallback.
Removes fallback to Windows Ink when Wintab reports no devices present.
Returns to old behavior of using only Wintab if Wintab.dll exists.
2021-02-23 13:29:59 -08:00
Nicholas Rishel ee4f306509 Fix T85844: high pressure at start of line.
m_tabletInRange is no longer set for Wintab after 2e81f2c01a
reverted Wintab changes. This reverts most button processing to
behavior present in 2.91.2.

Left in place is a bugfix for Windows Ink: button events while a
Windows Ink pen is in range should still be processed. Events processed
by Windows Ink and not passed to DefWindowProc do not create WM_*BUTTON
events, but button events from e.g. tablet pad express keys do create
WM_*BUTTON events and should be handled.
2021-02-23 13:29:59 -08:00
Nicholas Rishel f227a69a87 Revert high fequency mouse input for Windows.
Windows mouse history function GetMouesMovePointsEx has well documented
bugs where it receives and returns 32 bit screen coordinates, but
internally truncates to unsigned 16 bits. For mouse (relative position)
input this is not a problem as motion events and the resulting screen
coordinates reliably fit within 16 bit precision.

For tablets (absolute position) the 16 bit truncation results in
corrupt history when tablet drivers use mouse_event or SendInput from
the Windows API to move the mouse cursor. Both of these functions take
absolute mouse position as singed 32 bit value on the range of 0-65535
(or 0x0-0xFFFF) inclusive. Values larger than 0x7FFF (the largest
signed 16 bit value) are reliably corrupt when retrieved from
GetMouesMovePointsEx history. This is true regardless of whether mouse
history is retrieved using display resolution (GMMP_USE_DISPLAY_POINTS)
or high resolution points (GMMP_USE_HIGH_RESOLUTION_POINTS), the latter
of which should return points in range 0-65535.

Reviewed By: brecht

Maniphest Tasks: T85874

Differential Revision: https://developer.blender.org/D10507
2021-02-23 13:29:51 -08:00
Nicholas Rishel 8d02fdc7e0 WM_MOUSEMOVE cleanup. 2021-02-23 11:47:53 -08:00
Patrick Mours b2e1b13abd Cycles: Add option to change input passes for viewport denoising
There are cases where the default input passes of color+albedo do not yield useful results
and while this was possible to change that for final frame rendering (in the layer settings),
viewport denoising always used a fixed color+albedo. This adds an option to change the
input passes for viewport denoising too, so that one can use it in scenes that otherwise
wouldn't work well with it.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D10404
2021-02-23 11:45:02 +01:00
Kévin Dietrich 82605093e9 Alembic procedural: avoid storing constant hair topology for each frame
Only store the curve keys and radiuses for each frame if the topology does not change through time, this helps saving quit a bit of memory.
2021-02-23 06:06:54 +01:00
Kévin Dietrich 87ef037459 Alembic procedural: cleanup, demultiply Object and Geometry Node
creation
2021-02-23 06:06:50 +01:00
Kévin Dietrich 3d5e290ee0 Alembic procedural: use an enumeration to discriminate IObjects
Using the various IObject::matches() to do so was expensive and would
show up in profiles as requires creating std::strings for each call.
2021-02-23 05:31:34 +01:00
Kévin Dietrich d9abcee47e Alembic procedural: fix crash when accessing data out of frame bounds 2021-02-23 05:16:49 +01:00
Harley Acheson beb1f1b805 Win32: Do not (yet) set window styles for Dialog
Remove the setting of Dialog window styles until we confirm expected behavior between platforms.

Differential Revision: https://developer.blender.org/D10470

Own Code
2021-02-22 12:46:45 -08:00
Pascal Schön 277b4f4b93 Fix Principled BSDF specular color for black base color
Specular color is set to black instead of white inside the Principled BSDF
when the base color is set to fully black. This is contradictory to the sample
code of the Disney BRDF in BRDF Explorer. This patch aligns both
implementations.

Differential Revision: https://developer.blender.org/D10448
2021-02-22 18:33:05 +01:00
Harley Acheson 46bdf6d59f Fix T85768: Win32 Full-Screen Owned Windows
Improvements to how window states are determined and changed.

Differential Revision: https://developer.blender.org/D10470

Reviewed by Brecht Van Lommel
2021-02-22 09:32:15 -08:00
Brecht Van Lommel af940c68cb Fix Cycles world volume scattering missing light in some cases
With very large distances there were precision / overflow errors, normalize
the average albedo to avoid that. This was causing test failures on macOS
Arm, but also other architectures had slightly wrong results.

Ref T78710
2021-02-22 00:22:20 +01:00
Campbell Barton 08dbc4f996 PyAPI: use postponed annotations to support Python 3.10
Support Python 3.10a5 or 3.9x with support explicitly enabled.

- Enable Python's postponed annotations for Blender's RNA classes
  types registered on startup.

- Using postponed annotations has implications for how they are defined,
  since they must evaluate in the modules name-space instead of the
  classes name-space. See changes to annotations in `release/scripts`.

- Use `from __future__ import annotations` at the top of the module
  to ensure the script will run with Python 3.10.

- Old logic is kept since it could be used if PEP-649 is supported.

Resolves T83626

Ref D10474
2021-02-21 22:37:53 +11:00
Jacques Lucke 5dced2a063 Geometry Nodes: expose float2 attribute in rna
This also fixes the issue reported in T85651.

Differential Revision: https://developer.blender.org/D10477
2021-02-20 11:33:43 +01:00
Campbell Barton 7bb2b910c0 Cleanup: doxygen sections 2021-02-20 15:35:00 +11:00
Campbell Barton 7e11595364 Cleanup: clang-format 2021-02-19 02:19:53 +11:00
Campbell Barton 10a54bbd06 Cleanup: spelling, correct doc-string arguments 2021-02-19 02:19:53 +11:00
Ray Molenkamp 74383a332b Cleanup: Fix unused variable warning
exception was not used and can be safely removed
2021-02-18 08:09:08 -07:00
Ray Molenkamp 8095aad47e Cycles: Fix build error on windows
Function __bsf was in util/util_simd.h twice

problem located by @EAW on chat.
2021-02-17 10:21:00 -07:00
Brecht Van Lommel 4d28a1d75f Fix OpenColorIO 2.0 GPU shader error in uniform assignment
And fix a (harmless) compiler warning.
2021-02-17 18:03:52 +01:00
Brecht Van Lommel 351d8bfc41 Fix T85694: Cycles incorrect grayscale conversion with some OpenColorIO configs 2021-02-17 16:26:24 +01:00
Brecht Van Lommel 0e9497e886 Cycles: add support for Arm Neon instructions using sse2neon
Based on patch contributed by Apple and Stefan Werner.

Ref D8237, T78710
2021-02-17 16:26:24 +01:00
Brecht Van Lommel 68dd7617d7 Cycles: add utility functions for zero float2/float3/float4/transform
Ref D8237, T78710
2021-02-17 16:26:24 +01:00
Brecht Van Lommel 8119f0aad2 Cycles: refactor intrinsic functions implementation
* Add processor independent fallbacks
* Use uint32_t and uint64_t types
* Remove unused functions
* Better comments and less indentation

Ref D8237, T78710
2021-02-17 16:26:24 +01:00
Brecht Van Lommel db28411fd9 BLI: use sse2neon to emulate SSE instructions with Arm Neon
* WITH_CPU_SSE was renamed to WITH_CPU_SIMD, and now covers both SSE and Neon.
* For macOS sse2neon.h is included as part of the precompiled libraries.
* For Linux it is enabled if the sse2neon.h header file is detected. However
  this library does not have official releases and is not shipped with any Linux
  distribution, so manual installation and configuration is required to get this
  working.

Ref D8237, T78710
2021-02-17 16:26:24 +01:00
Brecht Van Lommel 5b6a3a57fb Merge branch 'blender-v2.92-release' 2021-02-17 15:56:24 +01:00
Brecht Van Lommel 2217719feb Fix T85440: crash with displacement shaders and updating geometry in viewport
When primitive offsets change we need to rebuild or refit BVHs, however this
was also tagging other data as modified too late in the geometry update process.
Now ensure only the BVHs are updated.

Ref D10441
2021-02-17 15:22:37 +01:00
Jacques Lucke 3a6d6299d7 Cycles: support accessing custom mesh attributes
This makes custom mesh attributes available in Cycles. Typically,
these attributes are generated by Geometry Nodes, but they can also
be created with a Python script.

* The `subdivision` code path is not yet supported.
* This does not make vertex weights and some other builtin attributes
  available in Cycles, even though they are accesible in Geometry Nodes.
  All attributes generated in Geometry Nodes should be accessible though.
* In some cases memory consumption could be removed by not storing all
  attributes in floats. E.g. booleans and integer attributes for which
  all values are within a certain range, could be stored in less than
  4 bytes per element.

Differential Revision: https://developer.blender.org/D10210
2021-02-17 12:13:30 +01:00
Jacques Lucke 9419452f85 Cycles: detect when attributes have changed
This patch has originally been written by Kévin Dietrich, thanks!
It is part of D10210.

As Brecht noted in D10210, this might not handle all cases yet.
I better solution should come soonish.
2021-02-17 12:06:10 +01:00
Campbell Barton 20a6255d49 Cleanup: spelling 2021-02-17 15:04:29 +11:00
Nicholas Rishel 5c523c6578 Merge branch 'blender-v2.92-release' 2021-02-16 18:10:42 -08:00
Nicholas Rishel ab21009842 Fix T84701: Popup closes on release while dragging parameter.
Windows Ghost cursor movement was previously changed to use SendInput
because SetCursorPos sporadically allows the cursor to escape the
window. This is now reverted because SendInput causes mouse history via
GetMouseMovePointsEx to contain invalid movement history, likely due to
interaction with mouse acceleration. This resulted in popups closing
when the cursor appeared to leave their range.
2021-02-16 17:45:57 -08:00
Brecht Van Lommel c9c4802c1c Fix T85671: color management crash with Medium Contrast look 2021-02-16 23:29:06 +01:00
Campbell Barton c03650073e Cleanup: spelling 2021-02-16 21:15:45 +11:00
Nicholas Rishel dd79a715c9 Merge branch 'blender-v2.92-release'
# Conflicts:
#	intern/ghost/intern/GHOST_SystemWin32.cpp
#	intern/ghost/intern/GHOST_WindowWin32.cpp
#	intern/ghost/intern/GHOST_WindowWin32.h
2021-02-15 23:27:21 -08:00
Nicholas Rishel 2e81f2c01a Revert Wintab High Frequency Input.
This revert removes handling of cursor move and button press events
during Wintab's WT_PACKET event, instead storing pressure and tilt
information to be combined with Window's WM_MOUSEMOVE events.

This also reverts dynamic enabling and disabling of Wintab, dependent
on the chosen Tablet API. If the Tablet API is not explictly Windows
Ink during startup, Wintab is loaded and enabled.

Left in place is a fallback to Windows Ink when the Tablet API is set
to Automatic and no Wintab devices are present. This allows devices
with Wintab installed but not active to fallback to Windows Ink.

Using position provided by Wintab was found to have too many
regressions to include in Blender 2.93. The primary source of
regressions was tablets which mapped coordinates incorrectly on multi-
monitor and scaled displays. This resulted in an offset between what
the driver controlled Win32 cursor position and the Wintab reported
position. A special case of this included tablets set to mouse mode,
where Wintab reported absolute position while the system cursor moved
as a relative mouse with mouse acceleration.
2021-02-15 23:06:00 -08:00
Harley Acheson 4a784f32fe Calm Win32 Window Creation Warning
Removing warning that 'GHOST_TUns32' to 'LONG' requires a narrowing conversion.

Differential Revision: https://developer.blender.org/D9971

Own Code
2021-02-15 17:44:49 -08:00
Brecht Van Lommel ae370e292a macOS: add Embree, OpenImageDenoise and sse2neon libraries for ARM
This required using a fork of Embree, newer LLVM version, unreleased ISPC
version and sse2neon directly from Git. Hopefully over time all the required
changes end up in official releases. For now we deviate from other platforms.

Based on contributions by Apple and Stefan Werner.

Ref D9527, D8237, T78710
2021-02-15 20:22:34 +01:00
Brecht Van Lommel 4ce57f6eb8 macOS: fix Cycles not detecting 64 bit and failing to build with Embree
Contributed by Apple

Ref D9527, T78710
2021-02-15 20:22:34 +01:00
Lukas Stockner 2f6d62bf88 Cycles: Implement Dwivedi guiding for path-traced subsurface scattering
Cycles has supported path-traced subsurface scattering for a while, but while it's
more accurate than other approaches, the increase in noise makes it an expensive option.

To improve this, this patch implements Dwivedi guiding, a technique that is based on
zero-variance random walk theory from particle physics and helps to produce shorter
random walks with more consistent throughput.

The idea behind this is that in non-white materials, each scattering event inside the
medium reduces the path throughput. Therefore, the darker the material is, the lower the
contribution of paths that travel far from the origin is.
In order to reduce variance, Dwivedi guiding uses modified direction and distance sampling
functions that favor paths which go back towards the medium interface.
By carefully selecting these sampling distributions, variance can be greatly reduced, and
as a neat side effect shorter paths are produced, which speeds up the process.

One limitation of just blindly applying this is that the guiding is derived from the
assumption of a medium that covers an infinite half-space. Therefore, at corners or thin
geometry where this does not hold, the algorithm might lead to fireflies.
To avoid this, the implementation here uses MIS to combine the classic and guided sampling.
Since each of those works on one of the three color channels, the final estimator combines
six sampling techniques. This results in some unintuitive math, but I tried to structure
it in a way that makes some sense.

Another improvement is that in areas where the other side of the mesh is close (e.g. ears),
the algorithm has a chance to switch to guiding towards the other side. This chance is based
on how deep the random walk is inside the object, and once again MIS is applied to the
decision, giving a total of nine techniques.

Combining all this, the noise of path-traced subsurface scattering is reduced significantly.
In my testing with the Rain character model and a simple lighting setup, the path-traced
SSS is now actually less noisy than the Christensen-Burley approximation at same render time
while of course still being significantly more realistic.

Differential Revision: https://developer.blender.org/D9932
2021-02-14 17:07:19 +01:00
Campbell Barton 67c8d97db3 Cleanup: spelling 2021-02-14 20:58:04 +11:00
Campbell Barton dae445d94a Fix T85573: Building with Python 3.10a5 fails
Replace deprecated _PyUnicode_AsString{AndSize} usage.

T83626 still needs to be resolved before 3.10 is usable.
2021-02-13 23:09:55 +11:00
Campbell Barton 474947c465 Cleanup: clang-format 2021-02-13 17:40:10 +11:00
Campbell Barton 69e9e45744 Cleanup: macro hygiene, use parenthesis around operators 2021-02-13 17:40:10 +11:00
Harley Acheson ba03f7f0b1 Fix T85562: Remove Win32 RIM_INPUTSINK
Removal of Win32 code that allows background windows to receive raw input.

Differential Revision: https://developer.blender.org/D10408

Reviewed by Brecht Van Lommel
2021-02-12 10:40:20 -08:00
Brecht Van Lommel 1b4961b318 OpenColorIO: upgrade to version 2.0.0
Ref T84819

Build System
============

This is an API breaking new version, and the updated code only builds with
OpenColorIO 2.0 and later. Adding backwards compatibility was too complicated.

* Tinyxml was replaced with Expat, adding a new dependency.
* Yaml-cpp is now built as a dependency on Unix, as was already done on Windows.
* Removed currently unused LCMS code.
* Pystring remains built as part of OCIO itself, since it has no good build system.
* Linux and macOS check for the OpenColorIO verison, and disable it if too old.

Ref D10270

Processors and Transforms
=========================

CPU processors now need to be created to do CPU processing. These are cached
internally, but the cache lookup is not fast enough to execute per pixel or
texture sample, so for performance these are now also exposed in the C API.

The C API for transforms will no longer be needed afer all changes, so remove
it to simplify the API and fallback implementation.

Ref D10271

Display Transforms
==================

Needs a bit more manual work constructing the transform. LegacyViewingPipeline
could also have been used, but isn't really any simpler and since it's legacy
we better not rely on it.

We moved more logic into the opencolorio module, to simplify the API. There is
no need to wrap a dozen functions just to be able to do this in C rather than C++.
It's also tightly coupled to the GPU shader logic, and so should be in the same
module.

Ref D10271

GPU Display Shader
==================

To avoid baking exposure and gamma into the GLSL shader and requiring slow
recompiles when tweaking, we manually apply them in the shader. This leads
to some logic duplicaton between the CPU and GPU display processor, but it
seems unavoidable.

Caching was also changed. Previously this was done both on the imbuf and
opencolorio module levels. Now it's all done in the opencolorio module by
simply matching color space names. We no longer use cacheIDs from OpenColorIO
since computing them is expensive, and they are unlikely to match now that
more is baked into the shader code.

Shaders can now use multiple 2D textures, 3D textures and uniforms, rather
than a single 3D texture. So allocating and binding those adds some code.

Color space conversions for blending with overlays is now hardcoded in the
shader. This was using harcoded numbers anyway, if this every becomes a
general OpenColorIO transform it can be changed, but for now there is no
point to add code complexity.

Ref D10273

CIE XYZ
=======

We need standard CIE XYZ values for rendering effects like blackbody emission.
The relation to the scene linear role is based on OpenColorIO configuration.

In OpenColorIO 2.0 configs roles can no longer have the same name as color
spaces, which means our XYZ role and colorspace in the configuration give an
error.

Instead use the new standard aces_interchange role, which relates scene linear
to a known scene referred color space. Compatibility with the old XYZ role is
preserved, if the configuration file has no conflicting names.

Also includes a non-functional change to the configuraton file to use an
XYZ-to-ACES matrix instead of REC709-to-ACES, makes debugging a little easier
since the matrix is the same one we have in the code now and that is also
found easily in the ACES specs.

Ref D10274
2021-02-12 19:06:35 +01:00
Brecht Van Lommel 6b40ee608c OpenColorIO: remove default display workaround
A fix for this is in 2.0 (and recent 1.1.x versions), no need for this anymore.

Differential Revision: https://developer.blender.org/D10275
2021-02-12 19:06:35 +01:00
Brecht Van Lommel dad32cbd17 Merge branch 'blender-v2.92-release' 2021-02-12 15:22:21 +01:00
Brecht Van Lommel 9febda912b Baking: support vertex color baking of normal material, UV discontinuities
Baking vertex colors per-corner leads to unwanted discontinuities when there is
sampling noise, for example in ambient occlusion or with a bevel shader node for
normals. For this reason the code used to always average results per-vertex.

However when using split normals, multiple materials or UV islands, we do want to
preserve discontinuities. So now bake per corner, but make sure the sampling seed
is shared for vertices.

Fix T85550: vertex color baking crash with split normals, Ref D10399
Fix T84663: vertex color baking blending at UV seams
2021-02-12 15:01:29 +01:00
Jeroen Bakker ed667e344d Merge branch 'blender-v2.92-release' 2021-02-12 11:55:42 +01:00
Jeroen Bakker 26481eabe1 Cycles: Use Blender Settings For AOV
This patch will share the AOV settings between Cycles and Eevee.
It enable using the AOV name conflict detection of Blender. This
means that unlike how Cycles used to work it isn't possible to add an
AOV with a similar name. Conflicts with internal render pass names will
be indicated with an Warning icon.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D9774
2021-02-12 11:35:05 +01:00
Campbell Barton 9d3d2fa031 Cleanup: don't subclass 'Panel' for mix-in classes
This reports warnings with `--debug-python` since all panel
sub-classes are expected to be registered.
2021-02-12 16:35:16 +11:00
Campbell Barton 35ddcb4041 Cleanup: clang-format, spelling 2021-02-12 07:49:40 +11:00
Kévin Dietrich 349c17cf54 Fix T85462: crash in render mode while removing instances
This crash is caused by accessing object data in the kernel at an out of bound index from a deleted instance.

Cycles represents instances as Object nodes sharing the same Geometry node, so we need to tag the GeometryManager for an update if some objects are added or removed as no geometry might have been added or removed in order to properly update the BVH and its associated data arrays.

Regression caused by rBbbe6d4492823.
2021-02-11 12:03:26 +01:00
Brecht Van Lommel 677e63d518 TBB: fix deprecation warnings with newer TBB versions
* USD and OpenVDB headers use deprecated TBB headers, suppress all deprecation
  warnings there since we have no control over them.
* For our own TBB includes, use the individual headers rather than the tbb.h that
  includes everything to avoid warnings, rather than suppressing all.

This is in anticipation of the TBB 2020 upgrade in D10359. Ref D10361.
2021-02-10 19:32:24 +01:00
Harley Acheson 1c4ae8a11c UI: Removal of GHOST_CreateDialogWindow
Simplification of window creation code to allow greater flexibility.

Differential Revision: https://developer.blender.org/D10311

Reviewed by Brecht Van Lommel
2021-02-09 16:14:31 -08:00
Kévin Dietrich 5213b18eb2 Cycles: fix wrong flags used to tag device data as dirty
Also fixes missing modified tag for float2 and float3 attributes arrays.
2021-02-09 14:50:00 +01:00
Sebastian Parborg be636f72dc Cleanup: Remove LibAV support
Ubuntu and Debian dropped libav in 2015 in favor of ffmpeg.
Development stopped of libav in 2018, so it should be save to remove.
2021-02-05 14:30:35 +01:00
Campbell Barton 17e1e2bfd8 Cleanup: correct spelling in comments 2021-02-05 16:23:34 +11:00
Campbell Barton 7e850ffa73 Cleanup: cmake indentation, white-space 2021-02-05 09:45:16 +11:00
Harley Acheson 261fa052ac UI: Win32 Window Creation Refactor
Simplification of Win32 GHOST_WindowWin32 with improved support for owned windows.

Differential Revision: https://developer.blender.org/D9971

Reviewed by Brecht Van Lommel
2021-02-03 17:44:24 -08:00
Kévin Dietrich 55c88e5582 Alembic procedural: fix crash when cancelling a render during
synchronization
2021-02-03 19:15:49 +01:00
Sebastián Barschkis 1a5b988509 Merge branch 'blender-v2.92-release' 2021-02-02 17:51:18 +01:00
Sebastián Barschkis 8c36f6becf Fix T84649: Quick liquid causing crash on scale operation
This commit makes use of the updated fluid sources files (previous commit rB9ad828dbad94d279521875db47a3472a38cc9b29)
2021-02-02 17:50:08 +01:00
Miguel Pozo 1428544528 Python API: option for render engines to delegate Freestyle render to Eevee
Eevee is now used for Freestyle rendering by default, since other engines are
unlikely to have support for this. Workbench and Cycles do their own rendering.

RenderEngine add-ons can do their own Freestyle rendering by setting
bl_use_custom_freestyle = True.

Differential Revision: https://developer.blender.org/D8335
2021-02-02 14:19:04 +01:00
Kévin Dietrich d0f59d3842 Fix T85144: Cycles crashes when editing render properties in viewport
rendering

Issue was caused by the sample pattern LUT always being freed and not
rebuilt when properties driving its dimensions were modified.
2021-01-29 17:35:28 +01:00
Patrick Mours b2e00e8f8e Merge branch 'blender-v2.92-release' 2021-01-29 13:35:21 +01:00
Patrick Mours 9f89166b52 Fix T85148: OptiX viewport denoising regression
Commit 6e74a8b69f changed the denoiser input passes default to
include the normal pass. This does not always produce optimal images though, hence why the
default was previously set to only include the color and albedo passes. This restores that behavior, so
that viewport denoising with OptiX produces the same results as before.
2021-01-29 13:35:00 +01:00
Marco 0af512abdf Sky Texture: change Nishita Altitude to use unit system
Differential Revision: https://developer.blender.org/D9968
2021-01-27 16:48:50 +01:00
Patrick Mours 9b80291412 Merge branch 'blender-v2.92-release' 2021-01-27 15:29:39 +01:00
James Horsley 4fbeb3e6be Fix T85089: Crash when rendering scene that does not fit into GPU memory with CUDA/OptiX
The "cuda_mem_map_mutex" was potentially being locked recursively during the call to
"CUDADevice::move_textures_to_host", which crashed. This moves around the locking and
unlocking of "cuda_mem_map_mutex", so that it doesn't call a function that locks it while
still holding the lock.

Reviewed By: pmoursnv

Maniphest Tasks: T85089, T84734

Differential Revision: https://developer.blender.org/D10219
2021-01-27 15:27:57 +01:00
Campbell Barton fc669a4c3e Cleanup: spelling 2021-01-27 15:28:24 +11:00
Richard Antalik ae5c15bb43 Merge branch 'blender-v2.92-release' 2021-01-26 17:51:51 +01:00
Brecht Van Lommel c51a5b204c Fix T85048: Cycles sculpt vertex color issues after recent changes
Attribute fields were not fully copied.

Ref D10208
2021-01-26 15:32:05 +01:00
Charles Flèche 76ab0381d1 Fix Cycles standalone compilation following API changes
The changes to the socket API were not applied to the standalone app.

Also modify Camera.compute_auto_viewplane() to use Camera.full_width and Camera.full_height as it is not possible to publicly access Camera.width and Camera.height anymore, so the aspect ratio could be computed with stale data.

Differential Revision: https://developer.blender.org/D9961
2021-01-26 14:39:32 +01:00
Charles Flèche 532d3a103a Cycles standalone: fix missing dependencies in CMake files
Also set default CYCLES_INSTALL_PATH to CMAKE_INSTALL_PREFIX.

By default with a `make cycles` this will build to ${CMAKE_BINARY_DIR}/bin

Differential Revision: https://developer.blender.org/D9961
2021-01-26 14:39:32 +01:00
Campbell Barton 4fc54ddae1 Cleanup: spelling 2021-01-26 07:50:40 +11:00
Hans Goudey 93e3aed041 Merge branch 'blender-v2.92-release' 2021-01-25 11:48:53 -06:00
Jacques Lucke 8a77019474 Cycles: modernize usage of rna iterators
Using rna iterators in range-based for loops is possible since {rBc4286ddb095d32714c9d5f10751a14f5871b3844}.

This patch only updates the places that are easy to update
without more changes in surrounding code.

Differential Revision: https://developer.blender.org/D10195
2021-01-25 16:25:27 +01:00
Brecht Van Lommel 04f91bce53 Fix build error after Cycles Amembic procedural commit 2021-01-25 16:15:35 +01:00
Kevin Dietrich b64f0fab06 Cycles: internal support for Alembic procedurals
The implementation is currently optimized to load animation sequences once
and then quickly scrubbing through them. Later on an option should be added
to optimize for memory usage and only load the current frame into memory.

Currently mesh and curve objects are supported, including support for UV and
vertex color attributes. Missing still is support for arbitrary attributes and
motion blur, as well as better handling of changing topology. Shader assignments
are made using FaceSets found in the Alembic archive.

The animation (and constant) data of the objects inside the Alembic archive is
loaded at once at the beginning of the render and kept inside a cache. At each
frame change we simply update the right socket of the corresponding Cycles node
if the data is animated. This allows for fast playback in the viewport
(depending on the scene size and compute power).

Note this is not yet exposed in the Blender UI, it's a feature that is still under
development and not ready for general use.

Ref T79174, D3089
2021-01-25 15:51:42 +01:00
Kevin Dietrich 2e67191c86 Cycles: internal support for the concept of procedurals
Procedurals are nodes in the scene that can generate an arbitrary number of
other nodes at render time. This will be used to implement an Alembic procedural
that can load an Alembic file into Cycles nodes. In the future we also expect to
have a USD procedural.

Direct loading of such files at render time is a standard feature in other
production renderers. Reasons to support this are memory usage and performance,
delayed loading of heavy scene data until rendering, Cycles standalone rendering
using standard file formats beyond our XML files, and shared functionality for
Cycles integration in multiple 3D apps.

Ref T79174, D3089
2021-01-25 15:51:38 +01:00
Kevin Dietrich 3656fc3aee Cleanup: move code to find geometry shaders into own function
Ref D3089
2021-01-25 15:48:39 +01:00
Brecht Van Lommel ef6d652428 Fix T83344: Cycles baking with progressive refine fails on GPU 2021-01-25 14:27:01 +01:00
Kévin Dietrich 7a0281914e Fix T85010: Cycles viewport not showing certain material changes when using GPU compute
Modifications to triangle shader association were not considered when checking for updates and the associated device data array was not tagged as modified so it was not resent to the device(s).
2021-01-25 07:40:49 +01:00
Campbell Barton 9c088b1b97 Cleanup: spelling 2021-01-24 16:06:58 +11:00
Brecht Van Lommel aaa1d58054 Merge branch 'blender-v2.92-release' 2021-01-22 19:30:23 +01:00
Brecht Van Lommel a1f44e43a2 Fix T84745: more build errors with TBB 2021
* tbb::blocked_range moved to a different namespace and since the fix is
  non-trivial, remove some unused code that used this.
* Task group priorities are no longer supported. It's unclear if they are
  useful at all right now and even set correctly, for now all tasks are equal
  priority with TBB 2021.
2021-01-22 19:24:13 +01:00
Kévin Dietrich bbe6d44928 Cycles: optimize device updates
This optimizes device updates (during user edits or frame changes in
the viewport) by avoiding unnecessary computations. To achieve this,
we use a combination of the sockets' update flags as well as some new
flags passed to the various managers when tagging for an update to tell
exactly what the tagging is for (e.g. shader was modified, object was
removed, etc.).

Besides avoiding recomputations, we also avoid resending to the devices
unmodified data arrays, thus reducing bandwidth usage. For OptiX and
Embree, BVH packing was also multithreaded.

The performance improvements may vary depending on the used device (CPU
or GPU), and the content of the scene. Simple scenes (e.g. with no adaptive
subdivision or volumes) rendered using OptiX will benefit from this work
the most.

On average, for a variety of animated scenes, this gives a 3x speedup.

Reviewed By: #cycles, brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D9555
2021-01-22 16:08:25 +01:00
Sergey Sharybin 7e32bb8492 Merge branch 'blender-v2.92-release' 2021-01-22 14:32:01 +01:00
Sergey Sharybin 226eb5e366 Cycles: Fix usage of double floating precision in CNanoVDB
Double floating point precision is an extension of OpenCL, which might
not be implemented by certain drivers, such as Intel Xe graphics.

Cycles does not use double floating point precision, and there is no
need on keeping doubles unless there is an explicit decision to use
them.

This is a simple fix from Cycles side to replace double floating point
type with a type of same size and alignment rules. Inspired by Brecht
and Patrick.

Tested on NVidia Titan V, Radeon RX Vega M, and TGL laptop.

Differential Revision: https://developer.blender.org/D10143
2021-01-22 14:31:06 +01:00
Falk David 41982af6a0 Merge branch 'blender-v2.92-release' 2021-01-21 21:59:56 +01:00
Brecht Van Lommel 3fd92b5c22 Fix T83344: Cycles baking + progressive refine fails 2021-01-21 15:12:17 +01:00
Brecht Van Lommel f4d07196bd Merge branch 'blender-v2.92-release' 2021-01-21 13:20:58 +01:00
Brecht Van Lommel aff7d59986 Fix T84908: Cycles GPU + CPU and denoising failure after recent fix 2021-01-21 13:20:05 +01:00