cycles.git
3 weeks agoCleanup: fix compiler warnings master
Brecht Van Lommel [Wed, 17 Jun 2020 12:36:32 +0000 (14:36 +0200)]
Cleanup: fix compiler warnings

3 weeks agoFix T77915: Cycles OSL microfacet closure not working in custom shaders
Brecht Van Lommel [Wed, 17 Jun 2020 11:27:23 +0000 (13:27 +0200)]
Fix T77915: Cycles OSL microfacet closure not working in custom shaders

The code to implement the newer closure in terms of the old one got lost in
the removal of our stdosl.h copy. Now implement it as a builtin closure.

3 weeks agoImprove cuda and optix error reporting in the viewport
Patrick Mours [Fri, 12 Jun 2020 14:42:49 +0000 (16:42 +0200)]
Improve cuda and optix error reporting in the viewport

This patch makes the infamous "Cancel" error in the viewport a thing of the past. Instead it
now shows a more useful error message and streamlines the error handling process in CUDA.

Reviewed By: brecht

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

3 weeks agoCleanup: fix compiler warning after recent changes
Brecht Van Lommel [Wed, 10 Jun 2020 18:34:01 +0000 (20:34 +0200)]
Cleanup: fix compiler warning after recent changes

It would be good to use override for all member functions, but doing it for
only somes generates compiler warning.

3 weeks agoFix Cycles viewport missing refresh when changing scene hair settings
Brecht Van Lommel [Wed, 10 Jun 2020 17:03:15 +0000 (19:03 +0200)]
Fix Cycles viewport missing refresh when changing scene hair settings

This code was not updated for the CoW depsgraph.

3 weeks agoImprove optix viewport denoising performance with CUDA rendering
Patrick Mours [Tue, 9 Jun 2020 17:46:16 +0000 (19:46 +0200)]
Improve optix viewport denoising performance with CUDA rendering

With this patch Cycles recognizing when a logical OptiX and CUDA device represent the same
physical GPU and attempts to eliminate unnecessary tile copies for viewport rendering if that
is the case for all active devices. In addition, denoising is now no longer performed on the first
available OptiX device only, but instead it will try to match CUDA and OptiX
rendering/denoising devices exactly to maximize utilization.

Reviewed By: brecht

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

3 weeks agoFix cuda compilation after cone sampling fix
Lukas Stockner [Wed, 10 Jun 2020 11:02:43 +0000 (13:02 +0200)]
Fix cuda compilation after cone sampling fix

3 weeks agoFix uniform cone sampling
Lukas Stockner [Sat, 6 Jun 2020 18:08:48 +0000 (20:08 +0200)]
Fix uniform cone sampling

This code is currently only used for the Glossy Toon BSDF, but it's a generic
building block that might be used for other things in the future.

To see why the current code does not give a uniform distribution, consider that
it chooses both angles uniformly, but the smaller the angle from the center of
the cone is, the smaller the differential solid angle is (similar to how
sampling disks by choosing radius and phi uniformly does not work).

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

3 weeks agoCleanup: avoid addition with large strings in Python
Campbell Barton [Tue, 9 Jun 2020 03:40:51 +0000 (13:40 +1000)]
Cleanup: avoid addition with large strings in Python

This is known to be inefficient, use a second write call instead.

3 weeks agoAdd support for p2p memory distribution (e.g. via NVLink)
Patrick Mours [Mon, 8 Jun 2020 15:16:10 +0000 (17:16 +0200)]
Add support for p2p memory distribution (e.g. via NVLink)

This change modifies the multi-device implementation to support memory distribution
across devices, to reduce the overall memory footprint of large scenes and allow scenes to
fit entirely into combined GPU memory that previously had to fall back to host memory.

Reviewed By: brecht

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

3 weeks agoCUEW: update to the latest version
Brecht Van Lommel [Wed, 17 Jun 2020 16:33:56 +0000 (18:33 +0200)]
CUEW: update to the latest version

3 weeks agoFix T77603: OSL parser fails when script ends with comment without newline
Jacques Lucke [Mon, 8 Jun 2020 15:01:47 +0000 (17:01 +0200)]
Fix T77603: OSL parser fails when script ends with comment without newline

Reviewers: brecht

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

3 weeks agoEnable optix on all maxwell+ gpus
Patrick Mours [Fri, 5 Jun 2020 10:33:00 +0000 (12:33 +0200)]
Enable optix on all maxwell+ gpus

3 weeks agoCleanup: remove unused flag
Brecht Van Lommel [Sat, 8 Feb 2020 22:19:59 +0000 (23:19 +0100)]
Cleanup: remove unused flag

3 weeks agoFix build error for Cycles standalone
Brecht Van Lommel [Wed, 3 Jun 2020 17:10:00 +0000 (19:10 +0200)]
Fix build error for Cycles standalone

This does not affect the Blender release.

Ref D7915

3 weeks agoCleanup: clang format, warning
Campbell Barton [Wed, 3 Jun 2020 15:18:14 +0000 (01:18 +1000)]
Cleanup: clang format, warning

3 weeks agoFix T63588: Cycles unnecessarily updates background importance sampling map
Tautvydas Andrikys [Thu, 14 May 2020 15:41:37 +0000 (17:41 +0200)]
Fix T63588: Cycles unnecessarily updates background importance sampling map

With modifications by Brecht to solve T77273, crash enabling portal lights.

3 weeks agoRevert "Fix T63588: Cycles unnecessarily updates background importance sampling map"
Brecht Van Lommel [Tue, 2 Jun 2020 16:44:43 +0000 (18:44 +0200)]
Revert "Fix T63588: Cycles unnecessarily updates background importance sampling map"

This reverts commit 33ce0cb5a1edea4b5aaa7d37f6ad74b3b35b95f8.

Fix T77273: crash enabling portal lights. The optimization for background
updates can be added back later for 2.90 and 2.83.1.

3 weeks agoUI: rename Cycles point light Size to Radius, for consistency and clarity
Johan Walles [Tue, 2 Jun 2020 05:15:41 +0000 (07:15 +0200)]
UI: rename Cycles point light Size to Radius, for consistency and clarity

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

3 weeks agoAdd missing light angle for distant lights in xml reading
Brecht Van Lommel [Tue, 2 Jun 2020 05:14:25 +0000 (07:14 +0200)]
Add missing light angle for distant lights in xml reading

Contributed by howetuft.

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

3 weeks agoAdded shadow terminator offset parameter
Stefan Werner [Tue, 5 May 2020 11:55:24 +0000 (13:55 +0200)]
Added shadow terminator offset parameter

A new user parameter can be used to shift the shadow terminator
towards the light source. With it, one can hide some of the
artifacts that appear on coarse meshes with smooth shading.

Note that this technique is not engery conserving.

This is based on the work by the Appleseed renderer team.

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

3 weeks agoChange perspective depth pass to be more standard
Brecht Van Lommel [Sun, 10 May 2020 14:12:46 +0000 (16:12 +0200)]
Change perspective depth pass to be more standard

Now it matches Eevee, OpenGL and other renderers. Panoramic camera depth passes
are unchanged, and are still distance from the camera center.

3 weeks agoFix NaN in Cycles environment texture importance sampling in some scenes
Brecht Van Lommel [Mon, 1 Jun 2020 14:14:09 +0000 (16:14 +0200)]
Fix NaN in Cycles environment texture importance sampling in some scenes

Cause identified by Ray Molenkamp.

3 weeks agoUpgraded embree to version 3.10.0
Stefan Werner [Thu, 30 Apr 2020 09:04:44 +0000 (11:04 +0200)]
Upgraded embree to version 3.10.0

Enabled round linear hair in Embree.

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

3 weeks agoImprove sampling of area lights
Antony Ryakiotakis [Sat, 23 May 2020 12:21:49 +0000 (14:21 +0200)]
Improve sampling of area lights

This patch uses the sampling method described in "A Low Distortion Map Between Triangle and Square" by Eric Heitz.
The benefit is avoiding sqrt in the calculation, which could be cheaper on some architectures, and the result is
more even sampling across the triangle surface.

Based on ideas from
https://pharr.org/matt/blog/2019/02/27/triangle-sampling-1.html
https://pharr.org/matt/blog/2019/03/13/triangle-sampling-1.5.html

Reviewed By: Brecht Van Lommel

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

3 weeks agoFix T62422: Baking ray distance do not work
Sebastian Parborg [Mon, 18 May 2020 13:50:36 +0000 (15:50 +0200)]
Fix T62422: Baking ray distance do not work

The previous naming scheme for the "selected to active" baking options
lead to confusion and they were not describing what they actually did.

To remedy this, I've added a new settings that does what the older setting implied it did.

Reviewed By: Brecht, Dalai, Andy Davies

Differential Revision: http://developer.blender.org/D7733

3 weeks agoCode refactor to bake using regular render session and tiles
Brecht Van Lommel [Fri, 10 May 2019 19:39:58 +0000 (21:39 +0200)]
Code refactor to bake using regular render session and tiles

There should be no user visible change from this, except that tile size
now affects performance. The goal here is to simplify bake denoising in
D3099, letting it reuse more denoising tiles and pass code.

A lot of code is now shared with regular rendering, with the two main
differences being that we read some render result passes from the bake API
when starting to render a tile, and call the bake kernel instead of the
path trace kernel.

With this kind of design where Cycles asks for tiles from the bake API,
it should eventually be easier to reduce memory usage, show tiles as
they are baked, or bake multiple passes at once, though there's still
quite some work needed for that.

Reviewers: #cycles

Subscribers: monio, wmatyjewicz, lukasstockner97, michaelknubben

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

3 weeks agoRefactor microfacet bsdfs to remove separate anisotropy code
Lukas Stockner [Thu, 14 May 2020 20:12:29 +0000 (22:12 +0200)]
Refactor microfacet bsdfs to remove separate anisotropy code

Since the sampling and evaluation functions handle both cases anyways,
there's not really a point for keeping the distinction in the kernel,
so we might as well cut down the number of CLOSURE_BSDF_MICROFACETs a bit.

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

3 weeks agoCleanup: clang-format
Campbell Barton [Tue, 5 May 2020 06:06:12 +0000 (16:06 +1000)]
Cleanup: clang-format

Minor difference caused by clang-format v10.0

3 weeks agoUI: Use property split layout and decorators for material properties
Julian Eisel [Fri, 1 May 2020 13:21:41 +0000 (15:21 +0200)]
UI: Use property split layout and decorators for material properties

Use the automatic property split layout (hence, change to the new 40/60% split
ratio) and add decorator buttons for animatable properties.
This actually applies to all node input buttons in the properties, e.g. world shading,
light shading, texture nodes.

Doing this makes the layout more consistent with other layouts in the
properties. But the decorators are also a useful hint for users that these
options can be animated. Previously using decorators and the automatic split
layout wasn't possible, I've done a number of changes now to have it supported.
Before I moved the socket icons to the left side, the decorators also looked
weird (two circle icons next to each other).

{F8497704} With nested items: {F8497708}

Reviewed By: William Reynish, Pablo Vazquez

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

3 weeks agoUI: Layout changes for new checkbox layout possibilities
William Reynish [Fri, 17 Apr 2020 14:54:03 +0000 (16:54 +0200)]
UI: Layout changes for new checkbox layout possibilities

Follow-up to previous commit.

Some examples:
{F8473507} {F8473508} {F8473509} {F8473510}
For more screenshots, please see D7430.

We use column or row headings here to bring more structure, and to give
the eye visual anchors which aid eye-scanning. The left-aligned
checkboxes likewise help with this. And we keep the adherence to the
center line, so the alignment matches up between the various buttons and
controls.

* Changes the property split percentage from 50/50% to 40/60%. This is
  needed to give enough space for the checkboxes. But in most cases this
  looks better anyway - see Transform panel. In some cases it simply
  fills out the available space more efficently.
* Fix various hacks where we previously used manually defined splits.
  When we did this, the alignment was never quite right, and the layout
  code was a mess.
* Adds column headings to many places where a list of checkboxes all
  share a common purpose or leading text.
* Add checkbox + value configurations various places where a checkbox
  only serves to enable the value slider
* Removes most uses of grid flow layout. The grid flow layouts combine
  poorly with column headings, and also they would mess alignment up
  badly. The grid flow layouts also often made buttons and controls jump
  around on the screen if you would just resize editors slightly,
  causing visual confusion, making users lose their place. The logic for
  at what time the list of items would re-flow was often flawed, jumping
  to multiple columns too fast or too late - and frankly, the grid flow
  layouts would often just look bad.

Maniphest Task: https://developer.blender.org/T65965

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

Reviewed by: Brecht Van Lommel, Pablo Vazquez.

Most work here by William Reynish, few changes by Julian Eisel.

3 weeks agoBuild: add FindOpenVDB module for CMake
Brecht Van Lommel [Wed, 17 Jun 2020 15:59:14 +0000 (17:59 +0200)]
Build: add FindOpenVDB module for CMake

3 weeks agoFix stdosl.h not being found when building with OSL
howetuft [Wed, 17 Jun 2020 15:58:49 +0000 (17:58 +0200)]
Fix stdosl.h not being found when building with OSL

An important modification was not port over from the Blender repository.

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

5 weeks agoFix linker error with newer OIIO
Ray Molenkamp [Wed, 3 Jun 2020 17:23:40 +0000 (11:23 -0600)]
Fix linker error with newer OIIO

The define OIIO uses to link statically has changed
in the newer versions of OIIO. We define both symbols
for maximum compatibility.

5 weeks agoFix CMake warning about OpenGL
Brecht Van Lommel [Tue, 2 Jun 2020 05:04:34 +0000 (07:04 +0200)]
Fix CMake warning about OpenGL

5 weeks agoFix build error in Cycles standalone without guarded allocator
Brecht Van Lommel [Tue, 2 Jun 2020 04:26:28 +0000 (06:26 +0200)]
Fix build error in Cycles standalone without guarded allocator

Solution suggested by howetuft.

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

5 weeks agoFix T77106: Cycles crash baking with AO shader node
Garry R. Osgood [Tue, 2 Jun 2020 03:55:59 +0000 (05:55 +0200)]
Fix T77106: Cycles crash baking with AO shader node

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

5 weeks agoFix T77109: Cycles viewport render crash after object add and undo
Brecht Van Lommel [Wed, 27 May 2020 16:00:59 +0000 (18:00 +0200)]
Fix T77109: Cycles viewport render crash after object add and undo

5 weeks agoFix T76947: Optix realtime denoiser progressively reduces brightness of very bright...
Patrick Mours [Wed, 27 May 2020 13:17:47 +0000 (15:17 +0200)]
Fix T76947: Optix realtime denoiser progressively reduces brightness of very bright objects

The input data to the OptiX denoiser was clamped to 0..10000 as required, but it could easily
exceed that range with a high number of samples (since the data contains the overall sum). To
fix that, divide by the number of samples first and multiply it back in after the denoiser ran.

5 weeks agoFix T76925: more Cycles OpenCL compile errors with some drivers on Linux
Brecht Van Lommel [Mon, 25 May 2020 14:48:11 +0000 (16:48 +0200)]
Fix T76925: more Cycles OpenCL compile errors with some drivers on Linux

5 weeks agoFix T76925: Cycles OpenCL compile error with some drivers on Linux
Brecht Van Lommel [Fri, 22 May 2020 17:02:49 +0000 (19:02 +0200)]
Fix T76925: Cycles OpenCL compile error with some drivers on Linux

5 weeks agoFix rendering instanced smoke domain
Jacques Lucke [Wed, 20 May 2020 14:53:28 +0000 (16:53 +0200)]
Fix rendering instanced smoke domain

The problem was that Cycles would store a pointer to an object in
`DEGObjectIterData->templ_dupli_object`. This pointer was then accessed
when the iterator was already freed.

Reviewers: brecht

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

5 weeks agoFix T72889: Cycles camera motion blur not usng more than 2 steps
Josh Belanich [Tue, 19 May 2020 00:51:27 +0000 (02:51 +0200)]
Fix T72889: Cycles camera motion blur not usng more than 2 steps

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

5 weeks agoFix T63588: Cycles unnecessarily updates background importance sampling map
Tautvydas Andrikys [Thu, 14 May 2020 15:41:37 +0000 (17:41 +0200)]
Fix T63588: Cycles unnecessarily updates background importance sampling map

5 weeks agoFix T73984: unnecessary Cycles viewport updates with object texture coordinates
Brecht Van Lommel [Thu, 14 May 2020 15:26:04 +0000 (17:26 +0200)]
Fix T73984: unnecessary Cycles viewport updates with object texture coordinates

Remove old code that added extra updates for shaders that have a dependency on
objects. The dependency graph can now tell Cycles when a material is affected by
an object transform.

5 weeks agoFix --debug-cycles printing CUDA devices twice
Brecht Van Lommel [Thu, 14 May 2020 02:54:45 +0000 (04:54 +0200)]
Fix --debug-cycles printing CUDA devices twice

Reuse the CUDA devices list for Optix device detection.

5 weeks agoFix incorrect assert in Cycles node socket get/set functions
Brecht Van Lommel [Tue, 12 May 2020 08:57:04 +0000 (10:57 +0200)]
Fix incorrect assert in Cycles node socket get/set functions

Thanks to Subrahmanya Oruganti for spotting these.

5 weeks agoFix T76469: OpenCL 1.2 Compilation
Jeroen Bakker [Thu, 7 May 2020 11:57:36 +0000 (13:57 +0200)]
Fix T76469: OpenCL 1.2 Compilation

Recent changes assumed OpenCL 2.0 platform. This adds a check to see if
we are compiling on an OpenCL 2.0 platform.

Patch was tested on:
* AMD Radeon Pro WX 7100 with amdgpu-pro-19.50-1011208-ubuntu-18.04 drivers
* AMD Vega 64 with amdgpu-pro-20.10-1048554-ubuntu-18.04 drivers
* AMD RX 5700 with amdgpu-pro-20.10-1048554-ubuntu-18.04 drivers

Reviewed By: Brecht van Lommel

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

5 weeks agoMark cuda 10.2 as officially supported
Brecht Van Lommel [Tue, 5 May 2020 10:59:25 +0000 (12:59 +0200)]
Mark cuda 10.2 as officially supported

It appears to work fine after a recent bugfix and testing for the past few
weeks.

5 weeks agoFix Cycles Python error when device name is not a valid UTF-8 string
Brecht Van Lommel [Mon, 4 May 2020 18:02:08 +0000 (20:02 +0200)]
Fix Cycles Python error when device name is not a valid UTF-8 string

This may fix or help diagnose T76378.

5 weeks agoFix T75995: Cycles render artifacts with overlapping volumes
Brecht Van Lommel [Fri, 1 May 2020 21:42:42 +0000 (23:42 +0200)]
Fix T75995: Cycles render artifacts with overlapping volumes

This is a workaround, but a proper solution requires significant changes to
ray intersection in the kernel.

5 weeks agoCleanup: compiler warning with clang 10
Brecht Van Lommel [Thu, 30 Apr 2020 10:19:37 +0000 (12:19 +0200)]
Cleanup: compiler warning with clang 10

5 weeks agoFix long OptiX BVH build times in Cycles with many objects
Patrick Mours [Thu, 30 Apr 2020 12:59:06 +0000 (14:59 +0200)]
Fix long OptiX BVH build times in Cycles with many objects

Looping over all primitives for every object is really slow, so this patch avoids that by moving
the necessary assignments inline with the primitive merging done for every geometry.

5 weeks agoFix T75895: Unable to Compile Cycles on NAVI/Linux
Jeroen Bakker [Thu, 30 Apr 2020 12:15:10 +0000 (14:15 +0200)]
Fix T75895: Unable to Compile Cycles on NAVI/Linux

This patch will add some compiler hints to break unrolling in the
nestled for loops of the voronoi node.

Reviewed by: Brecht van Lommel

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

5 weeks agoFix T75432: Cycles progressive refine render slow with denoising data
Brecht Van Lommel [Tue, 28 Apr 2020 18:27:03 +0000 (20:27 +0200)]
Fix T75432: Cycles progressive refine render slow with denoising data

Only perform denoising prefilter for the last sample, not every sample.

5 weeks agoFix T76044: update Cycles to build with OSL 1.11 master
Brecht Van Lommel [Tue, 28 Apr 2020 11:46:36 +0000 (13:46 +0200)]
Fix T76044: update Cycles to build with OSL 1.11 master

5 weeks agoCleanup: remove unused arg, clang-format
Campbell Barton [Fri, 24 Apr 2020 01:43:30 +0000 (11:43 +1000)]
Cleanup: remove unused arg, clang-format

5 weeks agoCleanup: clang-format, unused warning
Campbell Barton [Thu, 23 Apr 2020 02:10:41 +0000 (12:10 +1000)]
Cleanup: clang-format, unused warning

5 weeks agoFix T74423: Cycles rendering artifacts with CUDA 10.2
Brecht Van Lommel [Wed, 22 Apr 2020 14:27:25 +0000 (16:27 +0200)]
Fix T74423: Cycles rendering artifacts with CUDA 10.2

Work around what appears to be a compiler bug, just changing the code a bit
without any functional changes.

5 weeks agoFix T75964: changing object's viewport display color does not update cycles
Philipp Oeser [Wed, 22 Apr 2020 11:50:21 +0000 (13:50 +0200)]
Fix T75964: changing object's viewport display color does not update cycles

Caused by rB00466e756e33.

While that commit sounds logical, Cycles uses is_updated_transform() to
detect updates.

Now introduce is_updated_shading() and use that on top.

Maniphest Tasks: T75964

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

5 weeks agoUI: reorder adaptive sampling settings in order of importance
Brecht Van Lommel [Sun, 12 Apr 2020 13:44:06 +0000 (15:44 +0200)]
UI: reorder adaptive sampling settings in order of importance

5 weeks agoCycles/Optix: Support building the optix kernels on demand
Ray Molenkamp [Sat, 11 Apr 2020 18:59:21 +0000 (12:59 -0600)]
Cycles/Optix: Support building the optix kernels on demand

CMake: `WITH_CYCLES_DEVICE_OPTIX` did not respect `WITH_CYCLES_CUDA_BINARIES` causing the optix kernel to be always build at build time.

Code: `device_optix.cpp` did not count on the optix kernel not existing in the default location.

For this to work, one should have before starting blender

1) working nvcc environment
2) Optix SDK installed and the OPTIX_ROOT_DIR environment variable pointing to it which is not set by default

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

Reviewed By: Brecht

5 weeks agoShading: add Roughness input to Noise and Wave texture nodes
Bartosz Moniewski [Thu, 26 Mar 2020 13:43:53 +0000 (14:43 +0100)]
Shading: add Roughness input to Noise and Wave texture nodes

Currently in fractal_noise functions, each subsequent octave doubles the
frequency and reduces the amplitude by half. This patch introduces Roughness
input to Noise and Wave nodes. This multiplier determines how quickly the
amplitudes of the subsequent octaves decrease.

Value of 0.5 will be the default, generating identical noise we had before.
Values above 0.5 will increase influence of each octave resulting in more
"rough" noise, most interesting pattern changes happen there. Values below
0.5 will result in more "smooth" noise.

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

5 weeks agoFix T75288: crash in Cycles image loading with multithreaded shader compilation
Brecht Van Lommel [Wed, 8 Apr 2020 19:57:40 +0000 (21:57 +0200)]
Fix T75288: crash in Cycles image loading with multithreaded shader compilation

5 weeks agoFix T75290: Cycles crash with out of bounds memory access in volume mesh build
Brecht Van Lommel [Wed, 8 Apr 2020 19:41:56 +0000 (21:41 +0200)]
Fix T75290: Cycles crash with out of bounds memory access in volume mesh build

5 weeks agoFix T74572: adaptive sampling still not working correct with shader AOVs
Brecht Van Lommel [Wed, 8 Apr 2020 12:09:10 +0000 (14:09 +0200)]
Fix T74572: adaptive sampling still not working correct with shader AOVs

5 weeks agoCleanup: refactor adaptive sampling to more easily change some parameters
Brecht Van Lommel [Tue, 7 Apr 2020 17:43:51 +0000 (19:43 +0200)]
Cleanup: refactor adaptive sampling to more easily change some parameters

No functional changes yet, this is work towards making CPU and GPU results
match more closely.

5 weeks agoFix T74572: adaptive sampling not scaling AOVs correctly
Brecht Van Lommel [Mon, 6 Apr 2020 20:37:50 +0000 (22:37 +0200)]
Fix T74572: adaptive sampling not scaling AOVs correctly

5 weeks agoRevert "Fix T74572: adaptive sampling not scaling render passes correctly"
Brecht Van Lommel [Mon, 6 Apr 2020 21:19:01 +0000 (23:19 +0200)]
Revert "Fix T74572: adaptive sampling not scaling render passes correctly"

This reverts commit 82a8da0ec38a70efde4a91957824c67d0e60b8ad. It was completely
wrong. Fixes T75388.

5 weeks agoFix T75287: other Cycles render passes wrong when using Cryptomatte
Brecht Van Lommel [Thu, 2 Apr 2020 23:47:23 +0000 (01:47 +0200)]
Fix T75287: other Cycles render passes wrong when using Cryptomatte

5 weeks agoFix T74572: adaptive sampling not scaling render passes correctly
Brecht Van Lommel [Thu, 2 Apr 2020 12:28:01 +0000 (14:28 +0200)]
Fix T74572: adaptive sampling not scaling render passes correctly

5 weeks agoFix Cycles AVX unit test still failing to build with old GCC
Brecht Van Lommel [Thu, 2 Apr 2020 16:19:28 +0000 (18:19 +0200)]
Fix Cycles AVX unit test still failing to build with old GCC

5 weeks agoFix more build errors/warnings after recent AVX changes
Brecht Van Lommel [Thu, 2 Apr 2020 15:25:48 +0000 (17:25 +0200)]
Fix more build errors/warnings after recent AVX changes

Thanks to Sergey and Ray for the help identifying the problem.

5 weeks agoFix build error on Windows/Linux after recent AVX changes
Brecht Van Lommel [Thu, 2 Apr 2020 15:08:24 +0000 (17:08 +0200)]
Fix build error on Windows/Linux after recent AVX changes

5 weeks agoAvx implantation of perlin noise
OmarSquircleArt [Wed, 1 Apr 2020 12:48:01 +0000 (14:48 +0200)]
Avx implantation of perlin noise

This patch adds an AVX implementation of Perlin noise in Cycles.
An avxi type was also added as a utility based on the respective
type in Intel Embree.

Only 3D and 4D noise were implemented, there is no benefit for
utilizing AVX in 1D and 2D noise. The SSE trilinear interpolation
function was used in the AVX implementation because there is no
benefit from using AVX in interpolating the last three dimensions.

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

5 weeks agoFix Optix build error after recent changes
Daniel Santana [Fri, 27 Mar 2020 13:24:13 +0000 (14:24 +0100)]
Fix Optix build error after recent changes

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

5 weeks agoCleanup: Silence uninitialized variable warning
Charlie Jolly [Fri, 27 Mar 2020 11:12:11 +0000 (11:12 +0000)]
Cleanup: Silence uninitialized variable warning

5 weeks agoMantaflow: remove reminents of high res smoke
Aaron Carlisle [Thu, 26 Mar 2020 20:28:06 +0000 (16:28 -0400)]
Mantaflow: remove reminents of high res smoke

It appears this slipped through the code review

Reviewed By: sebbas

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

5 weeks agoRestore cycles_cubin_cc to working order
Ray Molenkamp [Thu, 26 Mar 2020 17:41:44 +0000 (11:41 -0600)]
Restore cycles_cubin_cc to working order

Reviewed by: brecht pmoursnv
Differential Revision: https://developer.blender.org/D7136

5 weeks agoCycles/Optix: Add CYCLES_OPTIX_TEST override
Ray Molenkamp [Thu, 26 Mar 2020 17:30:17 +0000 (11:30 -0600)]
Cycles/Optix: Add CYCLES_OPTIX_TEST override

This works similarly to the CYCLES_OPENCL_TEST
environment variable to allow testing on unsupported
hardware.

Note: like the OPENCL test override, this is
for *testing* only and bug reports on unsupported
hardware will *not* be accepted at this point in
time.

5 weeks agoFix T74939: Random Walk subsurface appearance in OptiX does not match other engines
Patrick Mours [Wed, 25 Mar 2020 17:30:39 +0000 (18:30 +0100)]
Fix T74939: Random Walk subsurface appearance in OptiX does not match other engines

Random Walk subsurface scattering did look different with OptiX because transmittance is
calculated based on the hit distance, but the OptiX implementation of `scene_intersect_local`
would return the distance in world space, while the Cycles BVH version returns it in object
space. This fixes the problem by simply skipping the object->world transforms in all the
places using the result of `scene_intersect_local` with OptiX.

Reviewed By: brecht

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

5 weeks agoLimit number of processes compiling opencl kernel based on memory
Brecht Van Lommel [Wed, 25 Mar 2020 12:11:09 +0000 (13:11 +0100)]
Limit number of processes compiling opencl kernel based on memory

The numbers here can probably be tweaked to be better, but it's hard to
predict and this should at least avoid excessive memory swapping.

Fixes T57064.

5 weeks agoUse opencl c 2.0 if available, to improve performance for AMD
Brecht Van Lommel [Tue, 24 Mar 2020 18:42:23 +0000 (19:42 +0100)]
Use opencl c 2.0 if available, to improve performance for AMD

Tested with AMD Radeon Pro WX 9100, where it brings performance back to 2.80
level, and combined with recent changes is about 2-15% faster than 2.80 in
our benchmark scenes.

This somehow appears to specifically address the issue where adding more shader
nodes leads to slower runtime. I found no additional speedup by applying this
to change to 2.80 or removing the new shader node code.

Ref T71479

Patch by Jeroen Bakker.

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

5 weeks agoSlightly improve opencl performance by reordering svm enum values
Brecht Van Lommel [Mon, 23 Mar 2020 23:09:06 +0000 (00:09 +0100)]
Slightly improve opencl performance by reordering svm enum values

Ref T71479

5 weeks agoWork around opencl performance regression after aovs and vector rotate
Brecht Van Lommel [Tue, 24 Mar 2020 00:27:38 +0000 (01:27 +0100)]
Work around opencl performance regression after aovs and vector rotate

We appear to be hitting some limit where adding any amount of code causes a
significant performance regression, no matter what it does. To work around
that a new node level was added.

Ref T71479

5 weeks agoCleanup: remove unused Cycles kernel feature flags, replace by node levels
Brecht Van Lommel [Tue, 24 Mar 2020 00:24:18 +0000 (01:24 +0100)]
Cleanup: remove unused Cycles kernel feature flags, replace by node levels

5 weeks agoOpenCL: Bring back CYCLES_OPENCL_TEST override
Ray Molenkamp [Sat, 21 Mar 2020 17:55:45 +0000 (11:55 -0600)]
OpenCL: Bring back CYCLES_OPENCL_TEST override

Back in 2.79 you could either use the debug panel or an
environment variable to override using OpenCL for unsupported
hardware. Which was rather useful for developers when testing
on NVidia just to be sure the CL kernels at-least build properly.

This broke in rB949ab753bb2

This diff restores testing though the CYCLES_OPENCL_TEST
environment variable.

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

Reviewers: brecht

5 weeks agoFix T73372: cryptomatte not filling last pass for odd number of levels
Brecht Van Lommel [Sat, 21 Mar 2020 00:37:00 +0000 (01:37 +0100)]
Fix T73372: cryptomatte not filling last pass for odd number of levels

Make logic consistent with the render pass creation in Python.

5 weeks agoFix T68370, T74973: Cycles cryptomatte not working when other passes are enabled
Brecht Van Lommel [Fri, 20 Mar 2020 14:56:24 +0000 (15:56 +0100)]
Fix T68370, T74973: Cycles cryptomatte not working when other passes are enabled

Solution found by Blazej Floch.

5 weeks agoFix T74345: missing albedo for Cycles principled hair BSDF
Brecht Van Lommel [Fri, 20 Mar 2020 14:22:29 +0000 (15:22 +0100)]
Fix T74345: missing albedo for Cycles principled hair BSDF

5 weeks agoFix Python error in Cycles baking panel
Brecht Van Lommel [Fri, 20 Mar 2020 13:25:16 +0000 (14:25 +0100)]
Fix Python error in Cycles baking panel

5 weeks agoFix Cycles crash in Windows debug mode with volumes
Brecht Van Lommel [Thu, 19 Mar 2020 18:50:34 +0000 (19:50 +0100)]
Fix Cycles crash in Windows debug mode with volumes

5 weeks agoCleanup: `make format` after SortedIncludes change
Dalai Felinto [Thu, 19 Mar 2020 08:33:03 +0000 (09:33 +0100)]
Cleanup: `make format` after SortedIncludes change

5 weeks agoFix (harmless) use of uninitialized variables in Cycles
Brecht Van Lommel [Wed, 18 Mar 2020 16:54:24 +0000 (17:54 +0100)]
Fix (harmless) use of uninitialized variables in Cycles

5 weeks agoVolumes: add render settings for volume datablock
Brecht Van Lommel [Mon, 16 Mar 2020 13:42:56 +0000 (14:42 +0100)]
Volumes: add render settings for volume datablock

* Space: volume density and step size in object or world space
* Step Size: override automatic step size
* Clipping: values below this are ignored for tighter volume bounds

The last two are Cycles only currently.

Ref T73201

5 weeks agoChange volume step size controls, auto adjust based on voxel size
Brecht Van Lommel [Sat, 7 Mar 2020 13:38:52 +0000 (14:38 +0100)]
Change volume step size controls, auto adjust based on voxel size

By default it will now set the step size to the voxel size for smoke and
volume objects, and 1/10th the bounding box for procedural volume shaders.

New settings are:
* Scene render/preview step rate: to globally adjust detail and performance
* Material step rate: multiplied with auto detected per-object step size
* World step size: distance to steo for world shader

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

5 weeks agoSupport for rendering of new hair object prototype
Brecht Van Lommel [Tue, 17 Mar 2020 15:30:48 +0000 (16:30 +0100)]
Support for rendering of new hair object prototype

Ref T68981

5 weeks agoSupport rendering new volume object type
Brecht Van Lommel [Tue, 17 Mar 2020 15:52:14 +0000 (16:52 +0100)]
Support rendering new volume object type

Voxels are loaded directly from the OpenVDB grid. Rendering still only supports
dense grid, so memory usage is not great for sparse volumes, this is to be
addressed in the future.

Ref T73201

5 weeks agoSupport for different 3d transform per volume grid
Brecht Van Lommel [Tue, 17 Mar 2020 15:48:00 +0000 (16:48 +0100)]
Support for different 3d transform per volume grid

This is not yet fully supported by automatic volume bounds but works fine in
most cases that will have mostly matching bounds.

Ref T73201

5 weeks agoCleanup: process colorspace conversion with a 1D pixel array
Brecht Van Lommel [Sun, 15 Mar 2020 19:11:53 +0000 (20:11 +0100)]
Cleanup: process colorspace conversion with a 1D pixel array

No need to assume it's 2D or 3D.