Commit Graph

91 Commits

Author SHA1 Message Date
Brecht Van Lommel
d9773edaa3 Cycles: 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
2020-05-15 20:25:24 +02:00
Brecht Van Lommel
e05552f7c4 Revert "Fix T74572: adaptive sampling not scaling render passes correctly"
This reverts commit 82a8da0ec38a70efde4a91957824c67d0e60b8ad. It was completely
wrong. Fixes T75388.
2020-04-06 23:23:48 +02:00
Brecht Van Lommel
82a8da0ec3 Fix T74572: adaptive sampling not scaling render passes correctly 2020-04-03 13:13:26 +02:00
Dalai Felinto
2d1cce8331 Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
Stefan Werner
51e898324d Adaptive Sampling for Cycles.
This feature takes some inspiration from
"RenderMan: An Advanced Path Tracing Architecture for Movie Rendering" and
"A Hierarchical Automatic Stopping Condition for Monte Carlo Global Illumination"

The basic principle is as follows:
While samples are being added to a pixel, the adaptive sampler writes half
of the samples to a separate buffer. This gives it two separate estimates
of the same pixel, and by comparing their difference it estimates convergence.
Once convergence drops below a given threshold, the pixel is considered done.

When a pixel has not converged yet and needs more samples than the minimum,
its immediate neighbors are also set to take more samples. This is done in order
to more reliably detect sharp features such as caustics. A 3x3 box filter that
is run periodically over the tile buffer is used for that purpose.

After a tile has finished rendering, the values of all passes are scaled as if
they were rendered with the full number of samples. This way, any code operating
on these buffers, for example the denoiser, does not need to be changed for
per-pixel sample counts.

Reviewed By: brecht, #cycles

Differential Revision: https://developer.blender.org/D4686
2020-03-05 12:21:38 +01:00
Patrick Mours
38589de10c Cycles: Add support for denoising in the viewport
The OptiX denoiser can be a great help when rendering in the viewport, since it is really fast
and needs few samples to produce convincing results. This patch therefore adds support for
using any Cycles denoiser in the viewport also (but only the OptiX one is selectable because
the NLM one is too slow to be usable currently). It also adds support for denoising on a
different device than rendering (so one can e.g. render with the CPU but denoise with OptiX).

Reviewed By: #cycles, brecht

Differential Revision: https://developer.blender.org/D6554
2020-02-11 18:03:43 +01:00
4f8f0f3208 Fix issues in Cycles standalone, particularly related to render display
Some code was removed to avoid storing the combined pass when viewport
rendering other passes. But we can keep this by default, Blender overrides
the list of passes entirely.
2020-01-31 16:49:24 +01:00
Patrick Mours
d5ca72191c Cycles: Add OptiX AI denoiser support
This patch adds support for the OptiX denoiser as an alternative to the existing NLM denoiser in Cycles. It's re-using the same denoising architecture based on tiles and therefore implicitly also works with multiple GPUs.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D6395
2020-01-08 16:53:11 +01:00
Lukas Stockner
e760972221 Cycles: support for custom shader AOVs
Custom render passes are added in the Shader AOVs panel in the view layer
settings, with a name and data type. In shader nodes, an AOV Output node
is then used to output either a value or color to the pass.

Arbitrary names can be used for these passes, as long as they don't conflict
with built-in passes that are enabled. The AOV Output node can be used in both
material and world shader nodes.

Implemented by Lukas, with tweaks by Brecht.

Differential Revision: https://developer.blender.org/D4837
2019-12-10 20:44:46 +01:00
Jeroen Bakker
271c6794d6 Cycles: Viewport Rendering Memory Improvement
Small memory reduction change by only storing the pixels of the combined
pass when it is being shown in the viewport. Previously the combined pass
was always calculated and present in the output buffer. The combined pass
will still be calculated.

It is a limitation in Blender that Cycles always had a combined pass.
This patch will remove the limitation from the code base of Cycles.
Blender still has the limitation, but will always request the combined
renderpass when doing final rendering.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5784
2019-09-17 11:24:55 +02:00
Lukas Stockner
cc600de669 Cycles Denoising: Get rid of halos around bright edges
Previously, bright edges (e.g. caused by rim lighting) would sometimes get
halos around them after denoising.

This change introduces a log(1+x) highlight compression step that is performed
before denoising and reversed afterwards. That way, the denoising algorithm
itself operates in the compressed space and therefore bright edges cause less
numerical issues.
2019-06-01 00:45:03 +02:00
Campbell Barton
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
f608964549 Merge branch 'blender2.7' 2019-03-11 14:34:17 +01:00
6503b4f90f Fix T61831: Denoising Clean pass not scaled correctly with samples. 2019-03-11 14:26:06 +01:00
e21ae0bb26 Merge branch 'blender2.7' 2019-02-06 15:22:53 +01:00
Lukas Stockner
405cacd4cd Cycles: prefilter feature passes separate from denoising.
Prefiltering of feature passes will happen during rendering, which can
then be used for denoising immediately or written as a render pass for
later (animation) denoising.

The number of denoising data passes written is reduced because of this,
leaving out the feature variance passes. The passes are now Normal,
Albedo, Depth, Shadowing, Variance and Intensity.

Ref D3889.
2019-02-06 15:18:29 +01:00
1e56c8c47d Merge branch 'master' into blender2.8 2018-11-05 00:30:33 +01:00
db59f30f2b Fix assert rendering with denoising, after recent changes. 2018-11-04 20:15:33 +01:00
046735d751 Merge branch 'master' into blender2.8 2018-10-28 16:41:30 +01:00
Stefan Werner
e58c6cf0c6 Cycles: Added Cryptomatte output.
This allows for extra output passes that encode automatic object and material masks
for the entire scene. It is an implementation of the Cryptomatte standard as
introduced by Psyop. A good future extension would be to add a manifest to the
export and to do plenty of testing to ensure that it is fully compatible with other
renderers and compositing programs that use Cryptomatte.

Internally, it adds the ability for Cycles to have several passes of the same type
that are distinguished by their name.

Differential Revision: https://developer.blender.org/D3538
2018-10-28 05:37:41 -04:00
Lukas Stockner
f1673d20fa Cycles: Expose noisy image pass by default when rendering with denoiser
Apparently quite a few users would like to have the noisy pass available when using the denoiser, and since it's being generated anyways we might as well expose it by default.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D3608
2018-10-26 16:21:11 +02:00
871b7ba892 Merge branch 'master' into blender2.8 2018-08-28 19:15:08 +02:00
Lukas Stockner
60a5ba265c Cycles: Add Denoising Clean to the debugging denoising passes 2018-08-25 09:32:29 -07:00
Campbell Barton
de777ad9e6 Merge branch 'master' into blender2.8 2018-07-06 10:18:52 +02:00
Campbell Barton
1daa20ad9f Cleanup: strip trailing space for cycles 2018-07-06 10:17:58 +02:00
3692a2bcb3 Merge branch 'master' into blender2.8 2018-03-16 04:35:37 +01:00
Guillaume Chereau
e56fd59f22 Code refactor: move OIIO image buffer writing outside session, into callback.
Original patch by Guillaume, modifications by Brecht.

Differential Revision: https://developer.blender.org/D3102
2018-03-15 23:05:16 +01:00
Dalai Felinto
d9858d5897 Merge remote-tracking branch 'origin/master' into blender2.8 2018-01-19 12:46:23 -02:00
Sergey Sharybin
8e1dd7ed81 Cycles: Remove unneeded include statements
Also try to move them from headers to implementation files as much as possible.
2018-01-19 15:19:45 +01:00
Campbell Barton
be40389165 Merge branch 'master' into blender2.8 2018-01-03 23:44:47 +11:00
6699454fb6 Cycles: make CUDA code a bit more robust to host/device alloc failures.
Fixes a few corner cases found while stress testing host mapped memory.
2018-01-02 23:46:19 +01:00
4f8bffa7bf Merge branch 'master' into blender2.8 2017-11-23 19:16:11 +01:00
6be95f8778 Fix T53357: harmless assert after recent addition of render time pass. 2017-11-23 17:14:35 +01:00
Julian Eisel
7f96323cd0 Merge branch 'master' into blender2.8 2017-11-19 13:16:14 +01:00
Lukas Stockner
40f528a7da Cycles: Add per-tile render time debug pass
Reviewers: sergey, brecht

Differential Revision: https://developer.blender.org/D2920
2017-11-17 16:40:24 +01:00
Bastien Montagne
91af8f2ae2 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/device/device.cpp
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/material.c
	source/blender/editors/object/object_add.c
	source/blender/editors/object/object_relations.c
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/editors/util/ed_util.c
	source/blender/windowmanager/intern/wm_files_link.c
2017-11-06 18:02:46 +01:00
5801ef71e4 Code refactor: device memory cleanups, preparing for mapped host memory. 2017-11-05 15:22:04 +01:00
Sergey Sharybin
7ea7fd45d0 Merge branch 'master' into blender2.8 2017-10-24 12:19:48 +02:00
a1aad1f8d1 Fix T53134: denoising with CPU + GPU render leaves some tiles noisy. 2017-10-24 04:09:48 +02:00
f5456df095 Merge branch 'master' into blender2.8 2017-10-24 02:05:41 +02:00
070a668d04 Code refactor: move more memory allocation logic into device API.
* Remove tex_* and pixels_* functions, replace by mem_*.
* Add MEM_TEXTURE and MEM_PIXELS as memory types recognized by devices.
* No longer create device_memory and call mem_* directly, always go
  through device_only_memory, device_vector and device_pixels.
2017-10-24 01:25:19 +02:00
7ad9333fad Code refactor: store device/interp/extension/type in each device_memory. 2017-10-24 01:03:59 +02:00
Campbell Barton
b66728d63d Merge branch 'master' into blender2.8 2017-10-21 12:43:17 +11:00
3df2e6d76b Fix T53109: denoising variance debug passes not working after recent changes. 2017-10-20 14:41:24 +02:00
Campbell Barton
ea606a7847 Merge branch 'master' into blender28 2017-10-06 21:25:33 +11:00
5bb677e592 Code refactor: zero render buffers outside of kernel.
This was originally done with the first sample in the kernel for better
performance, but it doesn't work anymore with atomics. Any benefit was
very minor anyway, too small to measure it seems.
2017-10-04 21:11:14 +02:00
e3e16cecc4 Code refactor: remove rng_state buffer and compute hash on the fly.
A little faster on some benchmark scenes, a little slower on others, seems
about performance neutral on average and saves a little memory.
2017-10-04 21:11:14 +02:00
Julian Eisel
9181f13af7 Merge branch 'master' into blender2.8 2017-05-08 00:19:22 +02:00
Lukas Stockner
43b374e8c5 Cycles: Implement denoising option for reducing noise in the rendered image
This commit contains the first part of the new Cycles denoising option,
which filters the resulting image using information gathered during rendering
to get rid of noise while preserving visual features as well as possible.

To use the option, enable it in the render layer options. The default settings
fit a wide range of scenes, but the user can tweak individual settings to
control the tradeoff between a noise-free image, image details, and calculation
time.

Note that the denoiser may still change in the future and that some features
are not implemented yet. The most important missing feature is animation
denoising, which uses information from multiple frames at once to produce a
flicker-free and smoother result. These features will be added in the future.

Finally, thanks to all the people who supported this project:

- Google (through the GSoC) and Theory Studios for sponsoring the development
- The authors of the papers I used for implementing the denoiser (more details
  on them will be included in the technical docs)
- The other Cycles devs for feedback on the code, especially Sergey for
  mentoring the GSoC project and Brecht for the code review!
- And of course the users who helped with testing, reported bugs and things
  that could and/or should work better!
2017-05-07 14:40:58 +02:00
Dalai Felinto
b868f43fd3 Cycles support for preview on viewport with core profile
This upgrade the drawing code to use latest opengl calls.
Also, it adds a fallback shader for opencolorio.

Reviewers: sergey, brecht
Subscribers: merwin, fclem

Differential Revision: https://developer.blender.org/D2652
2017-04-28 19:25:57 +02:00