Commit Graph

9972 Commits

Author SHA1 Message Date
Sebastián Barschkis
55fd7f55bd Fluid: Enable new flood-fill helper function
The flood-fill helper serves as a sanity check for scenes with complex obstacles. Similarly to the holes filler function it ensures that there are no holes in obstacles.

In addition, it ensures that there will be no holes resulting from multiple intersecting obstacles.

In general, this commit should improve stability.
2020-10-06 18:35:13 +02:00
Patrick Mours
3df90de6c2 Cycles: Add NanoVDB support for rendering volumes
NanoVDB is a platform-independent sparse volume data structure that makes it possible to
use OpenVDB volumes on the GPU. This patch uses it for volume rendering in Cycles,
replacing the previous usage of dense 3D textures.

Since it has a big impact on memory usage and performance and changes the OpenVDB
branch used for the rest of Blender as well, this is not enabled by default yet, which will
happen only after 2.82 was branched off. To enable it, build both dependencies and Blender
itself with the "WITH_NANOVDB" CMake option.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8794
2020-10-05 15:03:30 +02:00
Matt McClellan
1d985159ad Fix Cycles OpenCL failing when extension string is long
This can happen for Intel OpenCL, now support arbitrary string length.

Differential Revision: https://developer.blender.org/D9020
2020-10-05 14:04:06 +02:00
Bastien Montagne
7e836bde11 Fix critical lens distortion bug in libmv after rB3a7d62cd1f5e.
Current libmv_modal_solver_test fails since rB3a7d62cd1f5e.

It appears that the issue is caused by the insertion of the new OFFSET_K4 parameter,
as, if camera intrinsics are not required to implement/use all of those deform
parameters, they absolutely have to keep order (values) matching those defined
in bundle.cc, otherwise `PackIntrinisicsIntoArray` and `UnpackIntrinsicsFromArray`
will mangle them around.
2020-10-05 11:47:32 +02:00
Lukas Stockner
cfa101c228 Cycles: Add command line option for overriding the compute device
The current way of setting the compute device makes sense for local
use, but for headless rendering it it a massive pain to get Cycles
to use the correct device, usually involving entire Python scripts.

Therefore, this patch adds a simple command-line option to Blender
for specifying the type of device that should be used. If the option
is present, the settings in the user preferences and the scene are
ignored, and instead all devices matching the specified type are used.

Differential Revision: https://developer.blender.org/D9086
2020-10-02 19:26:35 +02:00
Campbell Barton
41d2d6da0c Cleanup: pep8 (indentation, spacing, long lines) 2020-10-02 11:59:16 +10:00
Campbell Barton
bab9de2a52 Cleanup: pep8, blank lines 2020-10-02 11:59:16 +10:00
Kévin Dietrich
edd1164575 Cycles: add time statistics to scene update
Gathers information for time spent in the various managers or object (Film, Camera, etc.) being updated in Scene::device_update.

The stats include the total time spent in the device_update methods as well as time spent in subroutines (e.g. bvh build, displacement, etc.).

This does not qualify as a full blown profiler, but is useful to identify potential bottleneck areas.

The stats can be enabled and printed by passing `--cycles-print-stats` on the command line to Cycles, or `-- --cycles-print-stats` to Blender.

Reviewed By: brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D8596
2020-10-01 23:21:11 +02:00
Ray Molenkamp
84e122e38a Cycles: Fix broken 32 bit shift.
1ul << n will still be a 32 bit integer regardless
of the value of n, given the target here is 64 bits
the upper 32 bits will always be zero. Using 1ull
will yield the expected result.
2020-10-01 10:19:50 -06:00
Jacques Lucke
365bf103d1 Volumes: support lower resolution in viewport
The adds a new option to simplify volumes in the viewport.
The setting can be found in the Simplify panel in the render properties.

Volume objects use OpenVDB grids, which are sparse. For rendering,
we have to convert sparse grids to dense grids (for now). Those require
significantly more memory. Therefore, it's often a good idea to reduce
the resolution of volumes in the viewport.

Reviewers: brecht

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

Ref T73201.
2020-10-01 17:59:04 +02:00
Martijn Versteegh
f117966c4e Fix T80395: Cycles baking crash when Surfaces are disabled in the view layer
Always enable surfaces for baking, otherwise there is nothing to bake to.

Differential Revision: https://developer.blender.org/D9015
2020-10-01 14:37:59 +02:00
Brecht Van Lommel
2caa6dd7f8 Cleanup: clang-format 2020-10-01 14:29:45 +02:00
Nicholas Rishel
f187256624 Windows: workaround to make Windows Ink tablet API work
Now Wintab is not initialized when starting Blender with the tablet API
preference set to native, since that disables Windows Ink.

Note that changing the tablet API requires restarting Blender for changes
to take effect. This serves as a stopgap to allow use of Windows Ink until
runtime API switching is merged.

Differential Revision: https://developer.blender.org/D9051
2020-10-01 12:05:36 +02:00
Yevgeny Makarov
bcc6baec24 macOS: support for key repeat events in keymaps
Differential Revision: https://developer.blender.org/D8882
2020-10-01 11:53:22 +02:00
Ankit Meel
99fb853734 Cleanup: avoid member access within null pointer
While harmless, UBSan warns about this.
Prefer offsetof where possible since it's more readable.
2020-10-01 14:49:44 +10:00
Brecht Van Lommel
60e5ebdd62 Fix Cycles CUDA kernels for Ampere not building with CUDA 11
Running Blender on Ampere cards was already possible with ptx, this fix is
needed to support building CUDA binaries.

Note the CUDA version used for official Blender builds is still 10, this is
merely the change to make it possible for those using CUDA 11 and specifying
the sm_8x kernels to be compiled.

Found by Milan Jaros.
2020-09-30 18:29:42 +02:00
Piotr Ostrowski
53f20b940a Subdivision Surfaces: add option disable using the limit surface
This makes subdivision surfaces compatible with the old subdivision
surface modifier and other applications that do not use the limit surface.

This option is available on the Subdivision Surface modifier.

Differential Revision: https://developer.blender.org/D8413
2020-09-30 16:39:02 +02:00
Sergey Sharybin
ecdfb465cc Cycles: Fix usage of memory barriers in split kernel
On user level this fixes dead-lock of OpenCL render on Intel Iris GPUs.
Note that this patch does not include change in the logic which allows
or disallows OpenCL platforms to be used, that will happen after the
kernel fix is known to be fine for the currently officially supported
platforms.

The dead-lock was caused by wrong usage of memory barriers: as per the
OpenCL specification the barrier is to be executed by the entire work
group. This means, that the following code is invalid:

  void foo() {
    if (some_condition) {
      return;
    }
    barrier(CLK_LOCAL_MEM_FENCE);
  }

  void bar() {
    foo();
  }

The Cycles code was mentioning this as an invalid code on CPU, while in
fact this is invalid as per specification. From the implementation side
this change removes the ifdefs around the CPU-only barrier logic, and
is implementing similar logic in the shader setup kernel.

Tested on NUC8i7HVK NUC.

The root cause of the dead-lock was identified by Max Dmitrichenko.

There is no measurable difference in performance of currently supported
OpenCL platforms.

Differential Revision: https://developer.blender.org/D9039
2020-09-30 16:10:35 +02:00
Ivan Perevala
3a7d62cd1f Tracking: Implement Brown-Conrady distortion model
Implemented Brown-Conrady lens distortion model with 4 radial and
2 tangential coefficients to improve compatibility with other software,
such as Agisoft Photoscan/Metashapes, 3DF Zephir, RealityCapture,
Bentley ContextCapture, Alisevision Meshroom(opensource).

Also older programs: Bundler, CPMVS.
In general terms, most photogrammetric software.

The new model is available under the distortion model menu in Lens
settings.

For tests and demos check the original patch.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9037
2020-09-30 15:54:24 +02:00
Valentin
5ac4778056 Cleanup: convert gforge task ID's to phabricator format
Cleanup old tracker task format to the new. e.g: [#34039] to T34039

Ref D8718
2020-09-30 20:11:06 +10:00
Campbell Barton
dbaa9291f2 Cleanup: spelling 2020-09-30 12:25:58 +10:00
Campbell Barton
0863316745 Cleanup: use angle-brackets for email addresses
This is already the most widely used convention.

Use this so `make check_spelling_c` will ignore all email addresses.
2020-09-30 12:05:56 +10:00
Ankit Meel
c1cdde04e2 Fix T81100: ccl::Node: ASan SEGV due to bad pointer
`SOCKET_OFFSETOF` was added in the initial commit {rBec51175f1fd6c91d5}
when `offsetof` [1] was not supported well enough. GCC and LLVM
support it since C++17.

Other two changes: type and size check can be done without creating
an invalid address too.

[1] https://cppreference.com/w/cpp/types/offsetof

Reviewed By: campbellbarton, brecht

Maniphest Tasks: T81100

Differential Revision: https://developer.blender.org/D9042
2020-09-30 01:16:02 +05:30
Ivan
4c19dd523e Libmv: Fix NukeCameraIntrinsics copy constructor
Copy the appropriate parameter

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9014
2020-09-28 09:57:28 +02:00
Campbell Barton
4786719dbd Cleanup: spelling 2020-09-24 14:27:48 +10:00
Jacques Lucke
4e8d3123f0 Cleanup: remove dead code in point cache and openvdb wrapper
Reviewers: brecht

Differential Revision: https://developer.blender.org/D8988
2020-09-23 14:57:41 +02:00
Brecht Van Lommel
dab50ad718 Cleanup: use float3 instead of float4 for shadow, since w is never used
Contributed by pembem22.

Differential Revision: https://developer.blender.org/D8947
2020-09-22 16:36:43 +02:00
Brecht Van Lommel
b63e6ab8d2 Fix Cycles SSS incorrect rendering of zero radius in green channel
Thanks to pembem22 for finding the problem.

Ref D8949
2020-09-22 16:28:12 +02:00
Kévin Dietrich
626201683e Cycles: add update flags to Node and SocketType
Those flags are meant for detecting which socket has changed, so in the
future we can have more granular updates.

`Node` now stores an `update_flags` member which is modified every time
a socket is changed though `Node::set`. The flags are or-able bits
stored in `SocketType` instances. Each `SocketType` stores a unique bit
out of 64, for the 64 bits of an uint64_t; the bit
corresponds to the index of the socket in the `Node`'s sockets array +
1, so the socket at index 5 will have the 6th bit set as its flag. This
limits us to 64 sockets per Node, which should be plenty for the current
set of `Nodes` that we have.

This does not change the behavior of other parts of Cycles.

This is part of T79131.

Reviewed By: brecht

Maniphest Tasks: T79131

Differential Revision: https://developer.blender.org/D8644
2020-09-22 14:50:43 +02:00
Sebastián Barschkis
edd19c1df9 Fluid: Fix for script export (standalone mode)
The OpenVDB update added a load() function. This function clashes with a helper IO function (only used when exporting and running the simulation externally) that was also named load().
2020-09-22 14:02:53 +02:00
Sebastián Barschkis
97ec16d68f Fluid: Refactor for initial velocities
Removed invel MAC grid since it is sufficient to use the cell centered vec3 representation. When setting initial velocities these will be interpolated by the setter functions.
2020-09-22 14:02:53 +02:00
Campbell Barton
14b2a35c8b Cleanup: use parenthesis for if statements in macros 2020-09-19 16:28:17 +10:00
Campbell Barton
17a2820da8 Cleanup: consistent TODO/FIXME formatting for names
Following the most widely used convention for including todo's in
the code, that is: `TODO(name):`, `FIXME(name)` ... etc.
2020-09-19 14:34:32 +10:00
Ankit Meel
b746179d0a CMake/OpenSubdiv: Rename INCLUDE_DIR -> INCLUDE_DIRS.
Ref {D8855}

Unix and Apple platform files use find_package(OpenSubdiv) which sets
`OPENSUBDIV_INCLUDE_DIR` as an advanced variable, as well as
`OPENSUBDIV_INCLUDE_DIRS` which should be used usually.
Windows sets `OPENSUBDIV_INCLUDE_DIR` which is used by the rest
of the code.

This patch renames it to `_DIRS` everywhere, for it to be like other
similar variables.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8917
2020-09-18 19:12:26 +05:30
Sergey Sharybin
9a5663ff43 Cycles: Add time report for Blender data synchronization
Allows to more easily access time information about how long Cycles
did spend synchronizing objects from evaluated depsgraph on Blender
side to its own structures.

This timer does not include time spent evaluating render depsgraph.
2020-09-18 12:03:22 +02:00
Alex Strand
b248ec9776 Shaders: add emission strength input to Principled BSDF node
This impacts I/O add-ons. OBJ, FBX and Collada have been updated, glTF not yet.

Differential Revision: https://developer.blender.org/D4971
2020-09-17 18:54:04 +02:00
Brecht Van Lommel
3dbb231ed2 Fix OpenCL render error in large scenes
In scenes such as Cosmos Laundromat, there were memory allocations bigger than
2GB which would overflow.

Problem and solution found by AMD, thanks!
2020-09-17 13:07:28 +02:00
Brecht Van Lommel
532ac1163c Tests: bundle tests for some modules in their own executables
The ffmpeg, guardedalloc and blenlib are quite isolated and putting them in
their own executable separate from blender_test is faster for development than
linking the entire blender_tests executable.

For Cycles, this also bundles all the unit tests into one executable.

Ref T79958

Differential Revision: https://developer.blender.org/D8714
2020-09-17 12:29:19 +02:00
Brecht Van Lommel
f9fcb25d52 CMake: clean up setting of platform specific linker flags
Set flags directly on the target, and use common function for all cases.
This refactoring helps with the next commit for test executables.

Ref D8714
2020-09-17 12:29:19 +02:00
Bastien Montagne
be11603dc2 Fix (unreported) buffer overflow in Cycles' system_cpu_brand_string helper.
Since this buffer is used as an array of 12 32bits integers, and C++
`string` expect a NULL-terminated C-string, we need an extra char to
ensure last one is always NULL.

See D8906. Found while investigating T80657.
2020-09-16 14:39:13 +02:00
Sriharsha Kotcharlakot
f137022f99 Liquid Simulation Display Options (GSoC 2020)
All the changes made in the branch `soc-2020-fluid-tools` are included in this patch.

**Major changes:**

=== Viewport Display ===

- //Raw voxel display// or //closest (nearest-neighbor)// interpolation for displaying the underlying voxel data of the simulation grids more clearly.
- An option to display //gridlines// when the slicing method is //single//.

==== Grid Display ====

- Visualization for flags, pressure and level-set representation grids with a fixed color coding based on Manta GUI.

==== Vector Display ====

- //**M**arker **A**nd **C**ell// grid visualization options for vector grids like velocity or external forces.
- Made vector display options available for external forces.

==== Coloring options for //gridlines// ====

- Range highlighting and cell filtering options for displaying the simulation grid data more precisely.
- Color gridlines with flags.

- Also, made slicing and interpolation options available for Volume Object.

Reviewed By: JacquesLucke, sebbas

Differential Revision: https://developer.blender.org/D8705
2020-09-15 23:13:01 +05:30
Patrick Mours
9f12ea496a Fix T80477: Crash when rendering with Embree but denoising with OptiX
Commit 009971ba7adc9603b90e9bf99b6b6d53eeae6c3a changed it so Cycles creates a separate
Embree device for each Cycles device, but missed the multi-device case. A multi-device with
Embree BVH can occur when CPU rendering is used with OptiX denoising and BVH creation then
failed to get a valid pointer to the Embree device, which crashed. This fixes that by providing the
correct device pointer in the multi-device case as well.
2020-09-15 14:58:19 +02:00
Campbell Barton
dd25d47e8a Cleanup: add missing headers to CMake, formatting 2020-09-15 22:53:44 +10:00
Campbell Barton
62f2925e43 Fix T80774: (correction) keep MEM_init_memleak_detection call early 2020-09-15 13:32:00 +10:00
Campbell Barton
a8fd3df905 Cleanup: spelling 2020-09-15 10:23:41 +10:00
Clément Foucault
2e4569abbc Fix remaining GL calls/type preventing from building due to recent cleanup 2020-09-12 19:48:52 +02:00
Campbell Barton
8c17269183 Cleanup: use C style doxygen comments 2020-09-12 16:33:34 +10:00
Brecht Van Lommel
fd5d014b62 Fix build error after clog color printing changes 2020-09-10 19:40:54 +02:00
Ray Molenkamp
9bd10b1c92 CLog: Support colorized logging on windows
When using Windows Terminal the same control codes Linux
uses to colorize the text can be used. WT can be detected
by looking at the WT_SESSION environment variable.

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

Reviewed by: campbellbarton
2020-09-10 11:31:09 -06:00
Ray Molenkamp
359acad5e4 Cleanup: CLog fix bad use_color default
`use_color` was defaulted to 'on' and only turned off when it was
decided the terminal didn't support this. This was the wrong
way to go about things, since that test only ran for Linux/Mac other
operating systems would get color formatting regardless if they
supported it.

The new default is `off` until the platform specific code inside
`CLG_ctx_output_set` turns it on after running some sanity checks.

This fix was part of the review of D8848 but deserved its on commit

Reviewed By: campbellbarton
2020-09-10 11:27:41 -06:00