Commit Graph

3890 Commits

Author SHA1 Message Date
Mai Lavelle
32299d32e7 Cycles: Modify path_radiance_accum_sample to use atomics for split kernel
Samples ran in parallel need a safe way to accumulate their results
with the results of other threads.
2017-06-10 04:08:02 -04:00
Mai Lavelle
6995b50e41 Cycles: Add function to dequeue a ray 2017-06-10 03:51:18 -04:00
Mai Lavelle
4360e8ce13 Cycles: Add atomic decrement functions to util_atomic.h 2017-06-10 03:51:18 -04:00
Mai Lavelle
ea846a4dfc Cycles: Add kernel to enqueue inactive rays
The queue will be used to make reuse of inactive threads to keep
the GPU more busy.
2017-06-10 03:51:18 -04:00
Hristo Gueorguiev
1f0998baa7 Cycles: Blacklist unsupported OpenCL devices
Due to various driver issues with AMD GCN 1 cards we can no longer support
these GPUs. This patch makes them unavailable to select for Cycles rendering.

GCN cards 2 and higher are still supported. Please use the most recent
drivers available to ensure proper functionality.

See here for a list to check which GPUs are supported:
https://en.wikipedia.org/wiki/List_of_AMD_graphics_processing_units
2017-06-10 03:51:18 -04:00
Lukas Stockner
c73206acc5 Cycles: Fix denoising passes being written when they're not actually generated 2017-06-09 23:02:56 +02:00
Lukas Stockner
0a898e2405 Cleanup Cycles Denoising platform-specific defines 2017-06-09 22:38:16 +02:00
Lukas Stockner
7dc51f87ed Cycles Denoising: Speedup reconstruction by skipping near-zero weights 2017-06-09 22:38:16 +02:00
Lukas Stockner
705c43be0b Cycles Denoising: Merge outlier heuristic and confidence interval test
The previous outlier heuristic only checked whether the pixel is more than
twice as bright compared to the 75% quantile of the 5x5 neighborhood.
While this detected fireflies robustly, it also incorrectly marked a lot of
legitimate small highlights as outliers and filtered them away.

This commit adds an additional condition for marking a pixel as a firefly:
In addition to being above the reference brightness, the lower end of the
3-sigma confidence interval has to be below it.
Since the lower end approximates how low the true value of the pixel might be,
this test separates pixels that are supposed to be very bright from pixels that
are very bright due to random fireflies.

Also, since there is now a reliable outlier filter as a preprocessing step,
the additional confidence interval test in the reconstruction kernel is no
longer needed.
2017-06-09 03:46:11 +02:00
Sergey Sharybin
6a546fc73e Cycles: Don't leave multiple spaces in the device name 2017-06-08 12:15:24 +02:00
Sergey Sharybin
45d3e22204 Cycles: Display optional board name in system info 2017-06-08 12:10:15 +02:00
Sergey Sharybin
78c0f09d4f Cycles: Cleanup, indentation 2017-06-08 12:03:08 +02:00
Pascal Schoen
c91d2d30df Improve backscatter color of subsurface scattering in Principled BSDF
Differential Revision: https://developer.blender.org/D2685
2017-05-31 07:29:17 +02:00
Sergey Sharybin
46da985c8e Cycles: Cleanup, trailing whitespace 2017-05-30 10:58:12 +02:00
Lukas Stockner
9b914764a9 Fix T51652: Cycles - Persistant Images not storing images
Denoising was setting session parameters for every frame, which was detected as
a change and therefore caused a resync.

Since the parameter modification change is only needed for viewport rendering
(which doesn't support denoising anyways) and resyncing after a frame change
(which isn't affected by denoising settings), an easy fix is to just ignore
the denoising parameters like it's currently done with the samples.
2017-05-30 06:34:53 +02:00
Lukas Stockner
0021268311 Cycles: Cleanup: Remove semicolons from line endings in Python code 2017-05-26 02:15:09 +02:00
Lukas Stockner
3722ed13cd Cycles: Update compositor when debug or denoising passes are changed 2017-05-26 02:13:21 +02:00
Lukas Stockner
2bc008e8a9 Cycles: Cleanup: b_srlay is always used now, no more need to silence warning 2017-05-26 01:55:32 +02:00
Sergey Sharybin
55c15ad9de Cycles: Use falltrhough attribute to help catching missing break statements 2017-05-24 17:23:54 +02:00
Pascal Schoen
e20a33b89d Fix T51589: Principled Subsurface Scattering, wrong shadow color
Apply mix of subsurface and base color (wrt subsurface) for rays that
have transmitted the surface.
2017-05-24 07:37:02 +02:00
Sergey Sharybin
7add6b89bc Fix T51592: Simplify AO Cycles setting remains active while Simplify is disabled 2017-05-23 10:34:03 +02:00
Sergey Sharybin
34b689892b Fix T51568: CUDA error in viewport render after fix for for OpenCL
Seems re-loading module invalidates memory pointers by the looks of it,
which gives an error on the next kernel call.

Not sure how to move memory pointer from one CUDA module to another one,
so for now simply disabling kernel re-load for CUDA devices. Not ideal,
but better than failing render.

Feature-selective option for CUDA is not an official feature anyway.
2017-05-22 12:28:21 +02:00
Lukas Stockner
3bf69b26ef Cycles Denoising: Skip feature pass writing for volume-only shaders
Volume shaders without anything connected to the surface output are treated
as if they had a transparent BSDF as the surface shader in Cycles, so the
denoiser should skip feature pass writing for them just as it does with an
actual transparent BSDF.
2017-05-21 05:40:13 +02:00
Lukas Stockner
96769f3b19 Cycles Denoising: Skip confidence interval test for outlier central pixels
If the central pixel is an outlier, the denoiser is supposed to predict its
value from the surrounding pixels. However, in some cases the confidence
interval test would reject every single surrounding pixel, which leaves the
model fitting with no data to work with.
2017-05-21 05:26:13 +02:00
Sergey Sharybin
38a2bf665b Cycles: Cleanup, style and unused arguments
- Some arguments were inapproriatry tagged as unused
  using (void)foo semantic.

  Only use such semantic in tricky casses, when something
  needs to be ignored in release builds or something is
  dependent on tricky ifndef policy.

  For rest of the cases just use void foo(int /bar*/)
  semantic, which ensures variable is not used. Solves
  confusion and code running out of sync with later
  development.

- Used proper unused semantic to some arguments.

- Added braces to make code easier to follow, tricky
  indentation with ifdef, uh.
2017-05-20 05:21:27 -07:00
Lukas Stockner
6cd1d34dc1 Cycles Denoising: Prevent overfitting when using a very low radius
For example, when using a radius of 1, only 9 pixels (due to weighting maybe
even less) will be used, but the transform code may still decide to use a
5-dimensional (or even higher) fit.
This causes severe overfitting and therefore weird pixel values.

To avoid this, this commit limits the amount of dimensions to a third of the
pixel number. For a radius of 3 or more, this doesn't change anything, but
for 1 and 2 it can prevent fireflies and/or negative values being produced.
2017-05-19 23:33:22 +02:00
Lukas Stockner
3dee1f079f Fix T51560: Black pixels on a denoising render
Once again, numerical instabilities causing the Cholesky decomposition to fail.

However, further increasing the diagonal correction just because of a few
pixels in very specific scenes and settings seems unjustified.
Therefore, this commit simply falls back to the basic NLM-filtered pixel
if the more advanced model fails.
2017-05-19 23:31:49 +02:00
Mai Lavelle
177385dc43 Cycles: Reload kernels from Session when requested features change
This fixes T49496.
2017-05-19 16:24:19 -04:00
Sergey Sharybin
8d4aff31ce Cycles: Fix compilation error after recent changes
Spotted by Steffen Dünner, thanks@
2017-05-19 16:48:42 +02:00
Sergey Sharybin
ef549b9e55 Cycles: Cleanup, always use parenthesis
Easier to read/follow, and more robust for the further changes.
2017-05-19 12:57:51 +02:00
Sergey Sharybin
908bb8bd82 Cycles: Cleanup, indentation in preprocessor 2017-05-19 12:54:46 +02:00
Sergey Sharybin
90a62404cb Cycles: Cleanup, variable names
Don't use camel case for variable names. Leave that for the structures.
2017-05-19 12:52:12 +02:00
Sergey Sharybin
3a634524e3 Cycles: Cleanup, useless new lines 2017-05-19 12:45:22 +02:00
Sergey Sharybin
de86da521c Cycles: Cleanup, braces after function definition
I wouldn't mind switching fully to Google style, but i am against of
mixing two different styles in same project. So just stick to brace
at the new line after function definition.
2017-05-19 12:43:26 +02:00
Sergey Sharybin
803337f3f6 \0;115;0cCycles: Cleanup, use ccl_restrict instead of ccl_restrict_ptr
There were following issues with ccl_restrict_ptr:

- We already had ccl_restrict for all platforms.

- It was secretly adding `const` qualifier to the declaration,
  which is quite weird since non-const pointer can also be
  declared as restricted.

- We never in Blender are using foo_ptr or FooPtr type definitions,
  so not sure why we should introduce such a thing here.

- It is absolutely wrong from semantic point of view to put pointer
  into the restrict macro -- const is a part of type, not part of
  hint for compiler that some pointer is never aliased.
2017-05-19 12:41:03 +02:00
Sergey Sharybin
8e655446d1 Fix T51537: Light passes are summed twice for split kernel since denoise commit
Denoise commit introduced kernel_write_result() which saves light passes, so
no need to call both kernel_write_result() and kernel_write_light_passes() from
the split kernel.

Weirdly enough. kernel_write_result() does not take care about debug passes.
2017-05-19 12:14:03 +02:00
Lukas Stockner
4a04d7ae89 Fix T51553: Cycles Volume Emission turns black when strength is 0 or color is black
The problem was that Cycles implicitly uses a transparent surface shader when only
volume nodes are used, but since the black emission shader gets optimized away,
it was no longer detected and therefore no transparent surface was used.

Therefore, the shader now stores whether volume nodes were connected before
optimizing.
2017-05-19 04:59:35 +02:00
Lukas Stockner
cf1127f380 Fix T51506: Wrong shadow catcher color when using selective denoising 2017-05-19 04:04:54 +02:00
Mai Lavelle
29f4a8510c Cycles: Fix random noise pattern seen with multiscatter bsdf and split kernel
Differentials were unset if roughness was low giving undefined behavior.
2017-05-18 21:39:23 -04:00
Lukas Stockner
a21277b996 Fix T51555: Cycles tile count is incorrect when denoising is enabled
Now rendered and denoised tiles are counted and displayed separately.
2017-05-19 03:29:18 +02:00
Lukas Stockner
ffd83a34ab Fix T51502: Cycles denoising not using correctly aligned width for NLM on CUDA 2017-05-19 02:06:54 +02:00
Lukas Stockner
740cd28748 Cycles Denoising: Add more robust outlier heuristic to avoid artifacts
Extremely bright pixels in the rendered image cause the denoising algorithm
to produce extremely noticable artifacts. Therefore, a heuristic is needed
to exclude these pixels from the filtering process.

The new approach calculates the 75% percentile of the 5x5 neighborhood of
each pixel and flags the pixel if it is more than twice as bright.

During the reconstruction process, flagged pixels are skipped. Therefore,
they don't cause any problems for neighboring pixels, and the outlier pixels
themselves are replaced by a prediction of their actual value based on their
feature pass values and the neighboring pixels.

Therefore, the denoiser now also works as a smarter despeckling filter that
uses a more accurate prediction of the pixel instead of a simple average.
This can be used even if denoising isn't wanted by setting the denoising
radius to 1.
2017-05-18 21:55:56 +02:00
Lukas Stockner
b3a3459e1a Cycles Denoising: Fix wrong order of denoising feature passes 2017-05-18 21:55:56 +02:00
Lukas Stockner
9586cc4708 Cycles: Cleanup MultiGGX closure implementation
The implementation originally handled four different cases:
Regular glossy, glass, metallic fresnel glossy and diffuse.

However, only the first two are actually used currently. Therefore, this commit
removes the other two, which allows to simplify the code.

Additionally, due to the Principled BSDF, the function arguments are now
identical for glossy and glass, which allows to get rid of some ugly #ifdefs.
2017-05-18 21:55:56 +02:00
Sergey Sharybin
49bd3d3a1a Cycles: Fix crash loading single channel texture
Was  typo in recent isfinite check.
2017-05-18 15:49:03 +02:00
Pascal Schoen
32c9d2322c Fix T51408: Cycles - Principled BSDF Shader - Transparency is not working as expected
Renamed the "Transparency" input of the Principled BSDF to
"Transmission" and "Refraction Roughness" to "Transmission Roughness".
2017-05-18 13:18:19 +02:00
Sergey Sharybin
c4d122e305 Cycles: Optimize expansion of headers in the source
Use smarter check of where the file is coming from instead of
attempting to replace same source twice with different settings.

Brings down processing time from 3.6sec to 1.8sec.
2017-05-17 17:26:35 +02:00
Sergey Sharybin
9a910443c4 Fix compilation error in Cycles
Was caused by recent fix with finite checks.

Fixes T51536.
2017-05-17 17:23:32 +02:00
Sergey Sharybin
1d49205b1a Fix T51529: Black boxes on a denoising render when using a .exr image as a environmental texture
It is caused by NaN value in the input texture. Now we check for all the pixels
having proper finite values.

Should also help here in the studio,
2017-05-17 15:29:47 +02:00
Sergey Sharybin
cc2755b443 Revert "Cycles: Fix wrong shading on GPU when background has NaN pixels and MIS enabled"
This reverts commit 581c81901363176b1ce775472ea7c9f97ee504a9.

Seems we do need to do finite check early on, this is incoming.
2017-05-17 15:06:05 +02:00