This avoids OpenCL inlining heavy volume interpolation code once for every
data type, which could cause a performance regression when we add a float4
data type in the next commit.
Ref D2057
Previously, only predefined and limited set of intrinsics combinations
could have been refined. This was caused by a bundle adjustment library
used in the early days of the solver.
Now it is possible to fully customize which intrinsics are to be refined
during camera solving. Internally solver supports per-parameter settings
but in the interface they are grouped as following:
* Focal length
* Optical center
* Radial distortion coefficients (which includes k1, k2, k3, k4)
* Tangential distortion coefficients (which includes p1, p2)
Differential Revision: https://developer.blender.org/D9294
This reverts commit 527f8b32b32187f754e5b176db6377736f9cb8ff. It is causing
motion blur test failures and crashes in some renders, reverting until this is
fixed.
This encapsulates Node socket members behind a set of specific methods;
as such it is no longer possible to directly access Node class members
from exporters and parts of Cycles.
The methods are defined via the NODE_SOCKET_API macros in `graph/
node.h`, and are for getting or setting a specific socket's value, as
well as querying or modifying the state of its update flag.
The setters will check whether the value has changed and tag the socket
as modified appropriately. This will let us know how a Node has changed
and what to update, which is the first concrete step toward a more
granular scene update system.
Since the setters will tag the Node sockets as modified when passed
different data, this patch also removes the various `modified` methods
on Nodes in favor of `Node::is_modified` which checks the sockets'
update flags status.
Reviewed By: brecht
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D8544
Code was assuming frustrum planes are symmetrical which is not the case
for shifting. This lead to a shrinking region if shift was negative (and
a growing region if shift was positive)
So instead of only keeping track of plane on one side (and mirroring
over in code) get the actual planes after shifting and use these
instead.
This code corrects this for ortho and perspective cameras, it does not
touch panoramic cameras.
Reviewed By: brecht
Maniphest Tasks: T69911
Differential Revision: https://developer.blender.org/D9342
Approximately 141 changes of capitalization to conform to MLA title style.
Differential Revision: https://developer.blender.org/D8392
Reviewed by Julian Eisel
Don't allocate a new buffer for refitting meshes, but update the existing one.
It's not clear from the API docs if this is required, but it appears to solve
the issue and should be more efficient.
Avoid accessing mesh emitter and hair at the same time. This is not ideal for
performance, but once we have a dedicated hair object this will resolve itself.
Differential Revision: https://developer.blender.org/D9322
This improves performance in scene synchronization when there are many
mesh, hair and volume objects. Sync time speedups in benchmarks:
barbershop 5.2x
bmw 1.3x
fishycat 1.5x
koro 1.0x
sponza 3.0x
victor 1.4x
wdas_cloud 0.9x
Implementation by Nicolas Lelong, and Jagannadhan Ravi (AMD).
Differential Revision: https://developer.blender.org/D9258
Being able to adjust the distance between fluid and obstacles comes in handy when trying to achieve a fluid motion over inclined obstacles.
Depending on the slope of such obstacles, already small adjustments of this value can help when particles stick to obstacle surfaces (i.e. make particles not stick to obstacles).
Use the newly introduced packed intrinsics, which allows to remove
code which was initializing parameters block based on distortion
model type.
Now such initialization is done by a particular implementation of
a distortion model.
Differential Revision: https://developer.blender.org/D9192
This is a common class which can be used in all sort of minimization
problems which needs camera intrinsics as a parameter block.
Currently unused, but will replace a lot of hard-coded logic in the
bundle adjustment code.
Only build avx/avx2 unit tests if supported by the compiler and
WITH_CYCLES_NATIVE_ONLY is off, otherwise the appropriate compiler flags
are not available.
Corrects incorrect usage of contraction for 'it is', when possessive 'its' was required.
Differential Revision: https://developer.blender.org/D9250
Reviewed by Campbell Barton
There would be eigen alignment issues with the custom libmv vector
class when compiling with AVX optimizations. This would lead to
segfaults.
Simply use the std::vector base class as suggested by the old TODO in
the class header.
Reviewed By: Sergey
Differential Revision: http://developer.blender.org/D8968
A general refactor / fix commit that should clear out the issues that have been reported on external forces and moving effectors (e.g. T79537, T81660, T80088).
Caused by rBe65c78cd43aa.
Since above commit, only geometry and lights received the update,
previous to this check an instancer would receive that is well (in case
of 'is_updated_shading').
Now check for an instancer (checking OB_DUPLI via ob.is_instancer()) and
do an update then as well.
Reviewers: brecht
Maniphest Tasks: T81729
Differential Revision: https://developer.blender.org/D9222
We need a separate time stamp for each axis, and we have to add a few
milliseconds of padding to those, to ensure wrapping on both axes get
properly performed when it happens almost simultaneously, and avoid
extra wrapping caused by very close events sometimes.
This only addresses the Linux (X11 backend) case.
Differential Revision: https://developer.blender.org/D9209
With this patch the build system checks whether the "CUDA10_NVCC_EXECUTABLE" CMake
variable is set and if so will use that to build sm_30 kernels. Similarily for sm_8x kernels it
checks "CUDA11_NVCC_EXECUTABLE". All other kernels are built using the default CUDA
toolkit. This makes it possible to use either the CUDA 10 or CUDA 11 toolkit by default and
only selectively use the other for the kernels where its a hard requirement.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D9179
That was a suboptimal decision from back in the days, which ended up
being problematic. It is no longer used, so remove it from API making
it so new code does not depend on this weak concept.
The order got broken when Brown distortion model has been added.
Made it so the indexing of parameters is strictly defined in the
parameter block, matching how parameters are used in the cost
function.
There is some duplication going on accessing parameters. This can
be refactored in the future, by either moving common parts packing
and cost function to an utility function in bundle.cc.
Alternatively, can introduce a public PackedIntrinsics class which
will contain a continuous block of parameters, and each of the
camera models will have API to be initialized from packed form and
to create this packed form.
The benefit of this approach over alternative solutions previously
made in the master branch or suggested in D9116 is that the specific
implementation of BA does not dictate the way how public classes need
to be organized. It is API which needs to define how implementation
goes, not the other way around.
Thanks Bastien and Ivan for the investigation!
This reverts commit 7e836bde11ce6521953c9f246cacd442a3ef6c0e.
Reverting the incomplete workaround, due to the following reasoning:
- There should be no dependency between CameraIntrinsics and the bundler
code. This violates intended abstraction of the intrinsics class.
- The fix was not complete, or wrong. Even in the world where there is
a requirement to the parameters storage size this should have applied
to all distortion models, including Divisions, Nuke.
Proper fix will be committed next.
The leak was happening when problem did not have any parameters blocks
defined. This happens, for example, if there are no 3D points at all,
or when all markers are set to 0 weight.
Was noticeable in libmv_modal_solver_test when building with LSAN
enabled.
After tests were bundled in a single executable and cycles and libmv
created their own tests, the warnings on macOS have gone over 800.
The reason is setting `*_LIBRARIES` to names of the libraries
and later using `link_directories` to link them properly.
https://cmake.org/cmake/help/latest/command/link_directories.html
> Note This command is rarely necessary and should be avoided where
> there are other choices. Prefer to pass full absolute paths to
> libraries where possible, since this ensures the correct library
> will always be linked. The find_library() command provides the
> full path, which can generally be used directly in calls to
> target_link_libraries().
Warnings like the following popup for every target/executable,
for every library it links to.
```
ld: warning: directory not found for option
'-L/Users/me/blender-build/blender/../lib/darwin/jpeg/lib/Debug'
```
The patch completes a step towards removing `link_directories` as
mentioned in TODO at several places.
The patch uses absolute paths to link libraries and removes
all `*_LIBPATH`s except `PYTHON_LIBPATH` from
`platform_apple.cmake` file. (The corner case where it's used seems
like dead code. Python is no longer shipped with that file structure.)
Also, unused code for LLVM-3.4 has been removed.
Also, guards to avoid searching libraries in system directories have
been added.
`APPLE` platform now no longer needs `setup_libdirs`,
`cycles_link_directories`, and `link_directories`.
The number of warnings now is less than 100, most of them being
deprecation ones in dependencies.
This patch depended on {rBb746179d0add}, {rB2fdbe4d05011},
{rB402a4cadba49} and {rBd7f482f88ecb}.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D8855
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.
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
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.
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
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
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.
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.
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
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.
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
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
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
`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
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
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().
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.
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
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.
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
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.
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
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.