Commit Graph

7444 Commits

Author SHA1 Message Date
78c2063685 Cycles: support arbitrary number of motion blur steps for cameras. 2018-03-10 06:27:19 +01:00
267d892326 Code refactor: motion blur cleanups, preparing for next commit. 2018-03-10 04:54:05 +01:00
6c4ddfc5d9 Code refactor: don't expose UpdateObjectTransformState in header. 2018-03-10 04:54:05 +01:00
b66efbecf4 Code refactor: make Transform always affine, dropping last row.
This save a little memory and copying in the kernel by storing only a 4x3
matrix instead of a 4x4 matrix. We already did this in a few places, and
those don't need to be special exceptions anymore now.
2018-03-10 04:54:05 +01:00
623141f339 Code refactor: add DecomposedTransform.
This is in preparation of making Transform affine only, and also gives us
a little extra type safety so we don't accidentally treat it as a regular
4x4 matrix.
2018-03-10 04:54:05 +01:00
516e82a900 Code refactor: add ProjectionTransform separate from regular Transform.
This is in preparation of making Transform affine only.
2018-03-10 04:54:04 +01:00
cd15d87bfc Code refactor: avoid motion transform copy, remove unused curved code.
The purpose of the previous code refactoring is to make the code more readable,
but combined with this change benchmarks also render about 2-3% faster with an
NVIDIA Titan Xp.
2018-03-10 04:54:04 +01:00
Stefan Werner
f3010e98c3 Code refactor: use KernelShader and KernelParticle instead of float arrays.
Original patch by Stefan with modifications by Brecht.
2018-03-10 04:54:04 +01:00
Stefan Werner
fa9175ff02 Code refactor: use KernelLight instead of float4 arrays.
Original patch by Stefan with modifications by Brecht.
2018-03-10 04:54:04 +01:00
Stefan Werner
f66ff4ee86 Code refactor: use KernelOject struct instead of float4 array.
Original patch by Stefan with modifications by Brecht.
2018-03-10 04:54:04 +01:00
Sergey Sharybin
370a2d6917 Fix T53857: Incorrect framerate for videos imported from OBS
This is an issue with which value to trust: fps vs. tbr. They both cam be
somewhat broken. Currently the idea is:

- If file was saved with FFmpeg AND we are decoding with FFmpeg we trust tbr.
- If we are decoding with Libav we use fps (there does not seem to be tbr in
  Libav, unless i'm missing something).
- All other cases we use fps.

Seems to work all good for files from T53857, T54148 and T51153. Ideally we
would need to collect some amount of regression files to make further tweaks
more scientific.

Reviewers: mont29

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D3083
2018-03-09 10:32:17 +01:00
Sergey Sharybin
76122bc8f0 Cycles: Fix crash when building with no shading systems 2018-03-06 13:04:28 +01:00
Sergey Sharybin
ec904ed327 Cycles: Cleanup, indentation 2018-03-06 13:04:28 +01:00
94b99949eb Fix T54202: Cycles crash rendering empty mesh volume after recent optimization. 2018-03-02 23:10:27 +01:00
b6fe80ca19 Fix Cycle standalone build. 2018-03-02 19:56:22 +01:00
Mai Lavelle
f2a2d5492b Cycles: Fix building of OpenCL kernels after volume optimization commit
OpenCL is C based, so no support for operators.

Related commit: 7377d411b47d50cd943cd
2018-03-02 04:53:13 -05:00
Kévin Dietrich
7377d411b4 Cycles volume: fast empty space optimization by generating a tight mesh
around the volume.

We generate a tight mesh around the active voxels of the volume in order
to effectively skip empty space, and start volume ray marching as close
to interesting volume data as possible. See code comments for details on
how the mesh generation algorithm works.

This gives up to 2x speedups in some scenes.

Reviewed by: brecht, dingto

Reviewers: #cycles

Subscribers: lvxejay, jtheninja, brecht

Differential Revision: https://developer.blender.org/D3038
2018-03-01 11:54:01 +01:00
7f86afec9d Cycles: don't count volume boundaries as transparent bounces.
This is more important now that we will have tigther volume bounds that
we hit multiple times. It also avoids some noise due to RR previously
affecting these surfaces, which shouldn't have been the case and should
eventually be fixed for transparent BSDFs as well.

For non-volume scenes I found no performance impact on NVIDIA or AMD.
For volume scenes the noise decrease and fixed artifacts are worth the
little extra render time, when there is any.
2018-03-01 01:21:29 +01:00
8cc7f48581 Cycles: principled absorption color now has more effect at lower values. 2018-02-28 20:11:53 +01:00
2eb94be750 Code cleanup: refactor Cycles image metadata retrieval to use a struct. 2018-02-27 23:42:30 +01:00
Kévin Dietrich
4403ca80bd Smoke: expose empty space clipping property to the UI.
This is used to determine which voxels are to be considered empty space.

Previously it was hardcoded for converting dense grids to OpenVDB grids
to reduce disk space usage.

This value is also useful for rendering engines to know, i.e. to
optimize ray marching.
2018-02-24 13:37:58 +01:00
Kévin Dietrich
6d8a4c10b6 OpenVDB : use underscores instead of spaces in grid names.
Some other software cannot handle grid names with spaces in them. We still check for names with spaces so as to not break old
files.

This fixes T53802.
2018-02-24 13:37:08 +01:00
0aec2dcd3a Cycles: add Principled Volume shader.
Similar to the Principled BSDF, this should make it easier to set up volume
materials. Smoke and fire can be rendererd with just a single principled
volume node, the appropriate attributes will be used when available. The node
also works for simpler homogeneous volumes like water or mist.

Differential Revision: https://developer.blender.org/D3033
2018-02-23 18:57:58 +01:00
acd619d7c9 Cycles: change smoke color grid to not include density multiplied in.
This breaks backwards compatibility some, making smoke colors brighters
than before. But it is also more correct this way.
2018-02-23 18:57:58 +01:00
a963c7d48d Code refactor: improve attribute handling for optional volume attributes.
A volume shader should be able to request attributes, and still be rendered
as homogeneous if no volume attributes are available for the object.
2018-02-23 18:57:58 +01:00
04896d223d Smoke: add temperature grid, with values 0..1 corresponding to 0..1000K. 2018-02-23 18:57:58 +01:00
5d5c6bb5ef Cycles: add Russian roulette termination for volume multiple scattering.
This mainly helps with dense volumes, rendering can be 30% faster with
little noise increase in such scenes.
2018-02-22 00:55:32 +01:00
2d81758aa6 Cycles: better path termination for transparency.
We now continue transparent paths after diffuse/glossy/transmission/volume
bounces are exceeded. This avoids unexpected boundaries in volumes with
transparent boundaries. It is also required for MIS to work correctly with
transparent surfaces, as we also continue through these in shadow rays.

The main visible changes is that volumes will now be lit by the background
even at volume bounces 0, same as surfaces.

Fixes T53914 and T54103.
2018-02-22 00:55:32 +01:00
6a48a9dc6e Code cleanup: fix incorrect socket names in hair and particle info nodes. 2018-02-22 00:55:11 +01:00
9a5be1fba9 Fix incorrect OSL raytype bits and add some comments. 2018-02-21 17:56:26 +01:00
606bc5f301 Fix T54105: random walk SSS missing in branched indirect paths.
Unify the path and branched path indirect SSS code. No performance impact
found on CUDA, for AMD split kernel the extra code was already there.
2018-02-21 17:56:26 +01:00
5cc1d5fe17 Fix T54107: bevel shader + normal map gives wrong result. 2018-02-21 17:56:26 +01:00
fee4b646c4 Cycles: tweak CUDA messages and avoid build errors with existing sm_2x configs. 2018-02-18 00:53:25 +01:00
1dcd7db73d Code cleanup: remove some more unused code after recent CUDA changes. 2018-02-18 00:53:03 +01:00
Thomas Dinges
9e717c0495 Cycles: Remove Fermi texture code.
This should be the last Fermi removal commit, unless I missed something.
It's been a pleasure Fermi!
2018-02-17 22:56:58 +01:00
Thomas Dinges
e1ef902058 Cycles: Remove fermi related defines from the code.
Did not touch Texture related defines, that comes next.
2018-02-17 22:19:54 +01:00
Thomas Dinges
2eaf90b305 Cycles: Remove Fermi support from CMake and update runtime checks in device_cuda.cpp.
Fermi code in Cycles kernel and texture system are coming next.
2018-02-17 16:15:07 +01:00
e03f335b1d Code cleanup: simplify switch statement, ensure we catch missing enums. 2018-02-15 18:13:07 +01:00
b1ee10aa1b Fix T54073: crash and uninitialized memory in Cycles displacement hashing. 2018-02-15 18:00:55 +01:00
b5fe00d1ac Cycles: restore Particle Info Index for now, keep it next to Random.
It seems to be useful still in cases where the particle are distributed in
a particular order or pattern, to colorize them along with that. This isn't
really well defined, but might as well avoid breaking backwards compatibility
for now.
2018-02-14 21:45:57 +01:00
f6107af4cf Cycles: change Index output of Hair and Particle Info to Random, in 0..1 range.
These are used for randomization, so it's convenient if the index is already
hashed and consistent with the Object Info node.
2018-02-14 14:55:46 +01:00
Sergey Sharybin
a966852362 CMake: Expose Cycles devices support as CMake option
Handy to disable GPU based devices when it's needed to run Valgrind.
2018-02-14 10:32:32 +01:00
Sergey Sharybin
37f65e9dc4 Cycles: Implement index output for hair node
This is like the only way to add variety to hair which is created
using simple children. Used here for the hair.

Maybe not ideal, but the time will show.
2018-02-13 14:20:47 +01:00
fc99eed5be Fix random walk SSS issues with different base and subsurface color.
Burley SSS uses a bit of strange thing where the albedo and closure weight are
different, which makes the subsurface color act a bit like a subsurface radius
indirectly by the way the Burley SSS profile works.

This can't work for random walk SSS though, and it's not clear to me that this
is actually a good idea since it's really the subsurface radius that is supposed
to control this. For now I'll leave Burley SSS working the same to not break
backwards compatibility.
2018-02-12 21:08:59 +01:00
a6968e87f1 Cycles: add random walk subsurface scattering to Principled BSDF.
Differential Revision: https://developer.blender.org/D3054
2018-02-09 19:58:42 +01:00
0df9b2c715 Cycles: random walk subsurface scattering.
It is basically brute force volume scattering within the mesh, but part
of the SSS code for faster performance. The main difference with actual
volume scattering is that we assume the boundaries are diffuse and that
all lighting is coming through this boundary from outside the volume.

This gives much more accurate results for thin features and low density.
Some challenges remain however:

* Significantly more noisy than BSSRDF. Adding Dwivedi sampling may help
  here, but it's unclear still how much it helps in real world cases.
* Due to this being a volumetric method, geometry like eyes or mouth can
  darken the skin on the outside. We may be able to reduce this effect,
  or users can compensate for it by reducing the scattering radius in
  such areas.
* Sharp corners are quite bright. This matches actual volume rendering
  and results in some other renderers, but maybe not so much real world
  objects.

Differential Revision: https://developer.blender.org/D3054
2018-02-09 19:58:33 +01:00
Campbell Barton
8f9386596f CMake: include missing headers 2018-02-09 13:50:05 +11:00
Tamito Kajiyama
859379ac48 Fix for missing "Use Freestyle" toggle in the Cycles "Layer" options panel.
Reviewed By: Brecht Van Lommel (brecht), Dalai Felinto (dfelinto)

Differential Revision: https://developer.blender.org/D3048
2018-02-09 02:48:21 +09:00
29d2ff7b31 Cycles: unify OSL BSSRDF closure into a single bssrdf() closure with method.
This is similar to the upstream unified microfacet() closure, and makes it
easier to extend in the future.
2018-02-08 16:56:11 +01:00
aabafece03 Code refactor: tweaks in SSS code to prepare for coming changes.
This also fixes a subtle bug in the split kernel branched path SSS, the
volume stack update can't be shared between multiple hit points.
2018-02-08 16:56:11 +01:00
28e2bc90dd Code refactor: remove unnecessary RNG offset in branched path code.
This is only needed for SSS which bounces to a different shading point.
2018-02-08 16:56:11 +01:00
1dafe759ed Update CUEW to latest version
This brings separate initialization for libcuda and libnvrtc, which
fixes Cycles nvrtc compilation not working on build machines without
CUDA hardware available.

Differential Revision: https://developer.blender.org/D3045
2018-02-07 11:53:01 +01:00
Campbell Barton
1e4b612d6a Cleanup: add _types.h suffix to DNA headers 2018-02-07 11:14:08 +11:00
ce3e0afe59 Fix T54001: AMD OpenCL fails with certain resolutions, after recent changes.
We should actually be using CL_DEVICE_MEM_BASE_ADDR_ALIGN for sub buffers,
previous change in this code was incorrect. Renamed the function now to
make the specific purpose of this alignment clear, it's not required for
data types in general.
2018-02-05 22:19:49 +01:00
Nathan Letwory
f9fcda533b
Fix typo in struct name obejct to object.
Reviewers: sergey

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D3041
2018-02-05 11:31:33 +02:00
Ray Molenkamp
e84e8cb497 cycles: fix black render with cycles_cubin_cc.
I have honestly no idea how this got swapped..
2018-02-04 15:12:35 -07:00
Ray Molenkamp
f8236e4869 cycles: fix cxx11 usage for cycles_cubin_cc 2018-02-04 15:11:08 -07:00
Ray Molenkamp
36c1122b96 msvc: Use source folder structure for project file.
This patch changes the huge list of projects in visual studio into a nice tree matching the source folder structure. see D2823 for details.

Differential Revision: http://developer.blender.org/D2823
2018-02-03 16:38:27 -07:00
Ray Molenkamp
a5052770b8 cycles: Add an nvrtc based cubin cli compiler.
nvcc is very picky regarding compiler versions, severely limiting the compiler we can use, this commit adds a nvrtc based compiler that'll allow us to build the cubins even if the host compiler is unsupported. for details see D2913.

Differential Revision: http://developer.blender.org/D2913
2018-02-03 10:59:09 -07:00
db989e1f11 Fix more Cycles incorrect principled BSDF mixing due to missing initialization.
Spotted by Ha Hyung-jin, thanks!
2018-02-03 13:43:44 +01:00
7ea7ce970c Fix build error with CUDA 9.1 and compute capability 2.x. 2018-02-03 13:36:38 +01:00
bb6f1d159a Cycles: make displacement a supported feature.
Adaptive subdivision remains experimental, still needs more work.
2018-02-03 12:20:58 +01:00
f9ea097a87 Cycles: add Vector Displacement node and extend Displacement node.
This adds midlevel and object/world space for displacement, and a
vector displacement node with tangent/object/world space, midlevel
and scale.

Note that tangent space vector displacement still is not exactly
compatible with maps created by other software, this will require
changes to the tangent computation.

Differential Revision: https://developer.blender.org/D1734
2018-02-03 12:20:26 +01:00
Mai Lavelle
b2dc0e6970 Fix T53978: Bad memory access after recent fix to BSDF mixing
Added proper checks after BSDF allocation and cleaned up existing
inline checks.

Was introduced in 7261d675e6aeb1b0dff
2018-02-01 20:03:29 -05:00
Sergey Sharybin
ff54dbd8fa Cycles: Attempt to fix 32 bit linux compilation 2018-02-01 15:13:54 +01:00
Sergey Sharybin
7bd86d74ba Cycles: Fix for non-vectorized version of bitscan()
It was doing bit search in an opposite direction comparing to a
vectorized version.
2018-02-01 15:11:17 +01:00
7261d675e6 Fix Cycles incorrect principled BSDF mixing with some parameter variatons.
Spotted by Ha Hyung-jin, thanks!
2018-01-30 15:05:47 +01:00
Campbell Barton
b0af44fa4d Fix T50630: Fluid fails on win32 w/ unicode paths
Allow overriding gzip open w/ elbeem.
2018-01-30 14:31:04 +11:00
1eeb846e78 Fix Cycles viewport render not updating when tweaking displacement shader.
This was disabled to avoid updating the geometry every time when the
material includes displacement, because there was no way to distinguish
between surface shader and displacement updates.

As a solution, we now compute an MD5 hash of the nodes linked to the
displacement socket, and only update the mesh if that changes.

Differential Revision: https://developer.blender.org/D3018
2018-01-29 17:07:08 +01:00
fb941679bb Fix Cycles allocating too much device memory, after recent memory refactoring.
Spotted by Ha Hyung-jin, thanks!
2018-01-29 17:07:08 +01:00
282b3d0fcd Revert "Fix T53914: Volumetric scattering now goes correctly through transparent surfaces."
This reverts commit 3c852ba0741f794a697f95073b04921e9ff94039. This is breaking
the regression tests, and maybe requires some deeper changes to really fix.
2018-01-29 17:07:08 +01:00
Stefan Werner
3c852ba074 Fix T53914: Volumetric scattering now goes correctly through transparent surfaces.
There was a check for volume bounces at every surface intersection. That could lead to a volume scattered path being terminated
when passing through a transparent surface. This check was superfluous, as the volume shader evaluation already checks the
number of volume bounces and once it passes the max, volume shaders will not return scatter events any more.

Reviewers: #cycles, brecht

Reviewed By: #cycles, brecht

Subscribers: brecht, #cycles

Tags: #cycles

Maniphest Tasks: T53914

Differential Revision: https://developer.blender.org/D3024
2018-01-27 21:39:19 +01:00
7b29e91711 Code refactor: make mixed small/large BSSRDF radii more robust. 2018-01-26 23:06:53 +01:00
d611cf9233 Fix mixed BSDF + BSSRDF sampling bug in path tracing, after 095a01a73a35.
Spotted by Ha Hyung-jin, thanks!
2018-01-26 18:47:21 +01:00
ce4915cddb Code refactor: store RGB BSSRDF in a single closure.
Previously we stored each color channel in a single closure, which was
convenient for sampling a closure and channel together. But this doesn't
work so well for algorithms where we want to render multiple color
channels together.
2018-01-26 18:47:21 +01:00
848f0c5b5b Code cleanup: simpler and faster detection of BVH refit. 2018-01-26 08:41:19 +01:00
da4c3f30d9 Cycles: rename displacement methods, default to displace, tweak panel layout.
Differential Revision: https://developer.blender.org/D3019
2018-01-25 14:25:21 +01:00
bf8f7304e0 Fix T53878: Cycles bug rendering multiple render layers with different passes.
This was caused by recent pass refactoring from f78e963.
2018-01-24 10:57:32 +01:00
4a3ddd8a7a Fix Cycles assert when resizing rendererd viewport. 2018-01-23 13:07:25 +01:00
b129ea843a Cycles: change material output displacement to vector.
Previously only scalar displacement along the normal was supported,
now displacement can go in any direction. For backwards compatibility,
a Displacement node will be automatically inserted in existing files.

This will make it possible to support vector displacement maps in the
future. It's already possible to use them to some extent, but requires
a manual shader node setup. For tangent space maps the right tangent
may also not be available yet, depends on the map.

Differential Revision: https://developer.blender.org/D3015
2018-01-23 12:49:35 +01:00
4a5ee1a5a2 Cycles: add Displacement node.
This converts object space height to world space displacement, to be
linked to the new vector displacement material output.

Differential Revision: https://developer.blender.org/D3015
2018-01-23 11:12:26 +01:00
2838cf0dfe Fix T53854: branched path tracing correlation bug with transparency in split kernel. 2018-01-23 11:11:48 +01:00
Ray Molenkamp
bf7e406766 Cycles: Fix optimal BVH selection. 2018-01-22 14:52:09 -07:00
Sergey Sharybin
2f79d1c058 Cycles: Replace use_qbvh boolean flag with an enum-based property
This was we can introduce other types of BVH, for example, wider ones, without
causing too much mess around boolean flags.

Thoughs:

- Ideally device info should probably return bitflag of what BVH types it
  supports.

  It is possible to implement based on simple logic in device/ and mesh.cpp,
  rest of the changes will stay the same.

- Not happy with workarounds in util_debug and duplicated enum in kernel.
  Maybe enbum should be stores in kernel, but then it's kind of weird to include
  kernel types from utils. Soudns some cyclkic dependency.

Reviewers: brecht, maxim_d33

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D3011
2018-01-22 17:19:20 +01:00
8a2d09eb9f Fix T53854: branched path tracing correlation bug with transparency.
This was broken in d750d18.
2018-01-22 14:02:58 +01:00
Sergey Sharybin
b06bd20a6b Cycles: Cleanup, remove unused argument 2018-01-22 10:59:14 +01:00
cc64872b88 Fix T49159: missing Cycles tangents for adaptive subdivision. 2018-01-21 15:43:59 +01:00
Sergey Sharybin
fa91b43e8c Cycles: Make it more proper check on vectorization flags from DebugFlags
Mimics to checks in system_cpu_support() checks.
2018-01-19 15:48:42 +01:00
Sergey Sharybin
ccec1e7667 Cycles: Cleanup, stop using debug flags in system utilities
Debug flags are to be controlling render behavior, nothing to do with low level
system utilities.

it was simple to hack, but logically is wrong. Lets do things where they are
supposed to be done!
2018-01-19 15:22:32 +01:00
Sergey Sharybin
54632dc830 Cycles: Remove util_debug include from kernel code
Not sure why it was in there, all the debug flags stuff is to be handled outside
of kernel.
2018-01-19 15:21:34 +01: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
0fe41009f0 Fix T53830: Cycles OpenCL debug assert on macOS,
This was probably harmless besides some unnecessary memory usage due to
aligning allocations too much.
2018-01-19 11:35:07 +01:00
Campbell Barton
7a24e0d175 Cleanup: typos 2018-01-19 15:34:54 +11:00
Mai Lavelle
abb3a86e10 Fix T53833: Particle Info node and Displacement Crash
The displacement shared was running before particle data was copied to the
device causing bad memory access when the particle info node was used. Fix
is simply to move particle update before mesh update so the data is
available to displacement shaders.

(Altho this fixes the crash the particle info node is still mostly useless
with displacement for now...)
2018-01-18 22:40:48 -05:00
a6700362c7 Memory: add MEM_malloc_arrayN() function to protect against overflow.
Differential Revision: https://developer.blender.org/D3002
2018-01-17 19:59:47 +01:00
Sergey Sharybin
2c2203d82a Cycles: CLeanup, remove unused function argument 2018-01-15 11:45:16 +01:00
Mai Lavelle
5bd9b12dc4 Cycles: adaptive subdivision support for panoramic cameras.
Adds the code to get screen size of a point in world space, which is
used for subdividing geometry to the correct level. The approximate
method of treating the point as if it were directly in front of the
camera is used, as panoramic projections can become very distorted
near the edges of an image. This should be fine for most uses.

There is also no support yet for offscreen dicing scale, though
panorama cameras are often used for rendering 360° renders anyway.

Fixes T49254.

Differential Revision: https://developer.blender.org/D2468
2018-01-12 23:57:45 +01:00
b603792fec Code refactor: adjust camera update for easier code sharing with kernel. 2018-01-12 23:57:45 +01:00
5cf032678f Code cleanup: remove test code to disable motion blur, no longer useful. 2018-01-12 23:57:14 +01:00
Lukas Stockner
322f0223d0 Cycles: option to make background visible through glass transparent.
This can be enabled in the Film panel, with an option to control the
transmisison roughness below which glass becomes transparent.

Differential Revision: https://developer.blender.org/D2904
2018-01-12 01:34:28 +01:00
Mai Lavelle
cce280dd67 Cycles: add offscreen dicing scale and dicing camera.
The offscreen dicing scale helps to significantly reduce memory usage,
by reducing the dicing rate for objects the further they are outside of
the camera view.

The dicing camera can be specified now, to keep the geometry fixed and
avoid crawling artifacts in animation. It is also useful for debugging,
to see the tesselation from a different camera location.

Differential Revision: https://developer.blender.org/D2891
2018-01-12 01:34:07 +01:00
2dbcc17897 Fix Cycles bevel normal baking having some random incorrect pixels.
The bevel and SSS code could result in NaNs in some cases, tweak the
formulas so this can't happen.
2018-01-11 22:30:31 +01:00
6dd164a188 Fix T53755: Cycles OpenCL lamp shaders have incorrect normal. 2018-01-11 08:48:32 +01:00
Stefan Werner
25b794a39d Cycles: support animated object scale in motion blur.
This was disabled previously due to CUDA compiler bugs, see T32900.

Differential Revision: https://developer.blender.org/D2937
2018-01-11 02:58:29 +01:00
c27cab268b Fix Windows compiler warning using WITH_CYCLES_NATIVE_ONLY. 2018-01-11 00:00:48 +01:00
d0892a6648 Fix issue with moving CUDA memory to host and multiple devices.
This is not expected to fix all issues. Also adds some more details
to error reporting to investigate failures.
2018-01-11 00:00:48 +01:00
0f4b46cee6 Fix T53692: OpenCL multi GPU rendering not using all GPUs.
Ensure each OpenCL device has a unique ID even if the hardware ID is not
unique for some reason.
2018-01-11 00:00:48 +01:00
c621832d3d Cycles: CUDA support for rendering scenes that don't fit on GPU.
In that case it can now fall back to CPU memory, at the cost of reduced
performance. For scenes that fit in GPU memory, this commit should not
cause any noticeable slowdowns.

We don't use all physical system RAM, since that can cause OS instability.
We leave at least half of system RAM or 4GB to other software, whichever
is smaller.

For image textures in host memory, performance was maybe 20-30% slower
in our tests (although this is highly hardware and scene dependent). Once
other type of data doesn't fit on the GPU, performance can be e.g. 10x
slower, and at that point it's probably better to just render on the CPU.

Differential Revision: https://developer.blender.org/D2056
2018-01-02 23:50:18 +01: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
7a6967cbe6 Fix mistake in previous fix for T53600, shows we really need a smarter solution. 2017-12-29 00:07:49 +01:00
948515c21a Fix T53600: Cycles shader mixing issue with principled BSDF and zero weights.
SVM nodes need to read all data to get the right offset for the following node.
This is quite weak, a more generic solution would be good in the future.
2017-12-25 23:59:20 +01:00
e8e92dffed Fix T53607: Cycles normal map baking problem when there is no bump. 2017-12-25 23:05:45 +01:00
Lukas Stockner
bf1dc39679 Fix T53567: Negative pixel values causing artifacts with denoising
Now negative color values are clamped to zero before the actual denoising.
2017-12-21 14:24:23 +01:00
Sergey Sharybin
5650fe77e4 Cycles: Cleanup, indentation 2017-12-20 17:42:50 +01:00
Sergey Sharybin
ab1af38c74 Cycles: Fix crash opening user preferences after adding extra GPU
We can not store pointers to elements of collection property in the
case we modify that collection. This is like storing pointers to
elements of array before calling realloc().
2017-12-19 15:51:28 +01:00
Sergey Sharybin
4895bd6ace Libmv: Add C-API function to set all markers within AutoTrack structure 2017-12-15 12:51:17 +01:00
Sergey Sharybin
2e8914549b Cycles: Fix difference in image Clip extension method between CPU and GPU
Our own implementation was behaving different comparing to OSL and GPU,
namely on the border pixels OSL and CUDA was doing interpolation with
black, but we were clamping coordinate.

This partially fixes issue reported in T53452.

Similar change should also be done for 3D interpolation perhaps, but this
is to be investigated separately.
2017-12-08 12:03:11 +01:00
Sergey Sharybin
f31fb4a014 Cycles: Cleanup, split 2D interpolation function 2017-12-08 11:22:04 +01:00
Lukas Stockner
2069102c56 Cycles: Fix constness for load_kernels in device_cpu.cpp 2017-12-06 00:00:18 +01:00
d64d8b5be5 Fix Cycles standalone crash when saving output, after recent refactoring. 2017-12-02 05:45:09 +01:00
Campbell Barton
28d2148b09 Haiku OS Support
D2860 by @miqlas

Even though Haiku is a niche OS, only minor changes are needed.
2017-11-30 18:05:21 +11:00
Lukas Stockner
fa3d50af95 Cycles: Improve denoising speed on GPUs with small tile sizes
Previously, the NLM kernels would be launched once per offset with one thread per pixel.
However, with the smaller tile sizes that are now feasible, there wasn't enough work to fully occupy GPUs which results in a significant slowdown.

Therefore, the kernels are now launched in a single call that handles all offsets at once.
This has two downsides: Memory accesses to accumulating buffers are now atomic, and more importantly, the temporary memory now has to be allocated for every shift at once, increasing the required memory.
On the other hand, of course, the smaller tiles significantly reduce the size of the memory.

The main bottleneck right now is the construction of the transformation - there is nothing to be parallelized there, one thread per pixel is the maximum.
I tried to parallelize the SVD implementation by storing the matrix in shared memory and launching one block per pixel, but that wasn't really going anywhere.

To make the new code somewhat readable, the handling of rectangular regions was cleaned up a bit and commented, it should be easier to understand what's going on now.
Also, some variables have been renamed to make the difference between buffer width and stride more apparent, in addition to some general style cleanup.
2017-11-30 07:37:08 +01:00
e4b54f44c1 Cycles: add object level holdout property.
This works the same as the holdout shader and Z mask layer. Combined with
overrides in 2.8 this is intended to replace the Z mask layer bits.
2017-11-29 18:11:40 +01:00
Maxym Dmytrychenko
7e349f2745 Cycles: improve triangle intersection performance.
Reduces render time by about 1-2% in benchmark scenes.

Differential Revision: https://developer.blender.org/D2911
2017-11-29 18:11:40 +01:00
Mathieu Menuet
83e80db56e Fix T53349: AO bounces not working correct with OpenCL. 2017-11-26 15:53:00 +01:00
Bastien Montagne
cf6e8edda5 atomic_ops: add atomic_cas_float helper. 2017-11-23 21:17:16 +01:00
Bastien Montagne
ff9eab7926 atomic_ops: Copy/adapt static assert macro from BLI_utildefines, and use it.
Checking for type sizes is much nicer with a static assert!
2017-11-23 20:25:55 +01:00
6be95f8778 Fix T53357: harmless assert after recent addition of render time pass. 2017-11-23 17:14:35 +01:00
e50ed90e4d Fix T53348: Cycles difference between gradient texture on CPU and GPU. 2017-11-23 17:14:04 +01:00
Bastien Montagne
e704d8a616 Moar attempt to fix bloody MSVC intrinsic mess... 2017-11-23 16:58:20 +01:00
Bastien Montagne
df06f1c816 Attempt to fix bloody MSVC atomic intrinsic mess... 2017-11-23 16:53:03 +01:00
Bastien Montagne
580b34e52b atomic_ops: add char versions of uint8_t atomic primitives. 2017-11-23 16:24:34 +01:00
Bastien Montagne
105b95835f atomic_ops: add signed versions of primitives.
Reason is motsly that dealing with type conversion in calling code is
not great, makes it less readable, and can generate hidden bugs in case
original type changes and atomic primitive calls are not updated
accordingly...
2017-11-23 16:24:33 +01:00
d77f1d6538 Fix T53313: bevel shader with transmission render artifacts. 2017-11-22 01:59:21 +01:00
Stefan Werner
58a15b2bfe Cycles: Fixed compilation of CUDA kernels. Follow-up fix for my last commit. 2017-11-21 10:43:40 +01:00
Mai Lavelle
d8f80fbe72 Cycles: Fix OSL brick node after recent fix 2017-11-21 04:30:12 -05:00
Stefan Werner
1febc85855 Cycles: Workaround for performance loss with the CUDA 9.0 SDK.
CUDA 9.0.176 apparently caused some slow down on high-end Pascal cards that can be mitigated by increasing the number of registers. See https://developer.blender.org/F1142667 for a detailed comparison.
2017-11-21 10:29:11 +01:00
Mai Lavelle
9325b9bf15 Fix T53365: OpenCL has wrong shading of brick texture
Looks like some weird compiler difference with signed vs unsigned ints.
2017-11-21 00:42:55 -05:00
d089875c4c Fix build with OSL 1.9.x, automatically aligns to 16 bytes now. 2017-11-20 23:24:24 +01:00
Sergey Sharybin
51e2844387 Cycles: Fix wrong behavior of sharpness in Cubic SSS
Was giving difference when using sharpness of 1.0 and 0.999 even though the
result was expected to be really close to each other.

This SSS profile will probably be removed in the future in favor of more
physically bases Burley, but for the time being don't see anything wrong
fixing an existing code.
2017-11-20 11:40:55 +01:00
Lukas Stockner
119846a6bb Mikktspace: Speed up the merging of identical vertices
Previously, Mikktspace just bucketed the vertices based on one spatial coordinate and then ran full pairwise comparisons inside each bucket.
However, since models are three-dimensional, the bucketing has a massive false-positive rate, and since pairwise comparison is O(n^2), the merging process is very slow.

But, since we only care about exactly identical vertices, there is a much more efficient approach - we can just hash all values belonging to each vertex and form buckets based on the hash.
Since the hash has 32 bits and considers all values, false-positives are very unlikely - and since both hashing and the radixsort that's used for bucketing are O(n), both asymptotical and
real-world performance (as well as code complexity) are significantly improved.
2017-11-17 18:34:53 +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
Lukas Stockner
a0c02e4d1b Cycles: Add Volume Direct and Volume Indirect passes for volume-scattered light
No color pass because it's hard to define what to use as color in a volume.

Reviewers: sergey, brecht

Differential Revision: https://developer.blender.org/D2903
2017-11-17 16:39:45 +01:00
Lukas Stockner
f78e963858 Cycles: Refactor PassType from bitflag to index in order to allow for more passes 2017-11-17 16:34:19 +01:00
Mai Lavelle
470b4cb62f Cycles: Fix crash with split branched path tracing
ShaderData memory was getting clobbered in the branched path code paths.

Was caused by 087331c495b04ebd37903c0dc0e46262354cf026
2017-11-16 04:59:31 -05:00
Sergey Sharybin
67ddc28055 Smoke: Pass non-trivial arguments by const reference 2017-11-14 17:11:48 +01:00
Sergey Sharybin
2868dcbe2b Fix compilation error with clang-5 2017-11-14 17:11:48 +01:00
Lukas Stockner
212a8d9e5a Cycles: Make per-object random value output also work for Lamps 2017-11-14 04:17:54 +01:00
Lukas Stockner
d8066fb0f1 Cycles: Refactor closure roughness detection to fix a potential bug with Denoising of specular shaders 2017-11-14 04:17:54 +01:00
Sergey Sharybin
d1a761c4d4 Cycles: Fix compilation error of standalone application 2017-11-13 10:49:05 +01:00
Sergey Sharybin
42dff6cc2e Cycles: Fix compilation error with OIIO compiled against system PugiXML 2017-11-13 10:42:29 +01:00
e568c1a975 Fix T53289: CUDA missing textures not showing pink, after recent changes. 2017-11-12 20:45:47 +01:00
Mai Lavelle
e389ae9dca Cycles: Set error if a split kernel fails to load
To help catch cases where adding a new kernel is missed for one of the
device implementations.
2017-11-11 01:01:14 -05:00
Sergey Sharybin
db7a78a2be Cycles: Fix compilation error with latest OIIO
There was some changes about namespaces, which causes ambiguities.

Replaces using namespace with an explicit symbols we need. Is good idea to NOT
pull in the whole namespace anyway!
2017-11-10 10:04:33 +01:00
a466d7ae24 Cycles: better distance sampling for chromatic volume extinction.
Previously we picked one of the RGB channels with equal probability, but this
works poorly in a dense volume after many bounces. Now we take into account
the throughput and single scattering albedo.

This makes it a little more practical to do brute force SSS with volumes, but
is still very inefficient because we do direct light sampling at every volume
bounce even when inside an opaque mesh. In theory there could be a light inside
the mesh so we can't automatically disable direct lighting.
2017-11-10 01:37:10 +01:00
21a535840d Fix T53270: crash with multiscatter GGX after recent refactoring.
In fact this was an existing issue when exceeding the number of available
closure, but it's more common now that we set the number to 0 for shadows
and emission
2017-11-09 20:28:00 +01:00
1ffa01b6f8 Fix (harmless) valgrind warning. 2017-11-09 20:28:00 +01:00
bd4bea3e98 Cycles: avoid reallocating tile denoising memory many times during render. 2017-11-09 20:28:00 +01:00
Dalai Felinto
08a023d7ca Cycles: Silence warning when building without OSL 2017-11-09 08:39:30 -02:00
Mai Lavelle
087331c495 Cycles: Replace __MAX_CLOSURE__ build option with runtime integrator variable
Goal is to reduce OpenCL kernel recompilations.

Currently viewport renders are still set to use 64 closures as this seems to
be faster and we don't want to cause a performance regression there. Needs
to be investigated.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2775
2017-11-09 01:04:06 -05:00
26f39e6359 Cycles: add bevel shader, for raytrace based rounded edges.
The algorithm averages normals from nearby surfaces. It uses the same
sampling strategy as BSSRDFs, casting rays along the normal and two
orthogonal axes, and combining the samples with MIS.

The main concern here is that we are introducing raytracing inside
shader evaluation, which could be quite bad for GPU performance and
stack memory usage. In practice it doesn't seem so bad though.

Note that using this feature can easily slow down renders 20%, and
that if you care about performance then it's better to use a bevel
modifier. Mainly this is useful for baking, and for cases where the
mesh topology makes it difficult for the bevel modifier to work well.

Differential Revision: https://developer.blender.org/D2803
2017-11-07 22:35:12 +01:00
f79f386731 Code refactor: rename subsurface to local traversal, for reuse. 2017-11-07 22:35:12 +01:00
d0af56fe3b Cycles: antialias normal baking if the mesh has a bump map. 2017-11-07 22:35:12 +01:00
ff34e48911 Cycles: add an extra CUDA synchronize before rendering.
It should not be needed as far as I know, but just in case it fixes any
of the recent issues like T52572.
2017-11-07 22:35:12 +01:00
e74b229342 Fix incorrect MIS weights in Cycles with multiple lights.
This causes some difference in the classroom scene, where ray visibility
tricks are used and break the MIS balance. Otherwise there doesn't seem
to be much effect, but better to use the right formulas. Problem originally
identified by Lukas.
2017-11-07 22:35:12 +01:00
Sergey Sharybin
1a1fb5a47c Cycles: Cleanup, style 2017-11-07 13:55:58 +01:00
8a72be7697 Cycles: reduce closure memory usage for emission/shadow shader data.
With a Titan Xp, reduces path trace local memory from 1092MB to 840MB.
Benchmark performance was within 1% with both RX 480 and Titan Xp.

Original patch was implemented by Sergey.

Differential Revision: https://developer.blender.org/D2249
2017-11-05 20:48:33 +01:00
c571be4e05 Code refactor: sum transparent and absorption weights outside closures. 2017-11-05 18:13:44 +01:00
2c02a04c46 Code refactor: remove emission and background closures, sum directly. 2017-11-05 18:13:44 +01:00
cac3d4d166 Cycles: fix inefficient attribute map storage, saves 615MB in victor scene. 2017-11-05 18:00:48 +01:00
5801ef71e4 Code refactor: device memory cleanups, preparing for mapped host memory. 2017-11-05 15:22:04 +01:00
5475314f49 Cycles: reserve CUDA local memory ahead of time.
This way we can log the amount of memory used, and it will be important
for host mapped memory support.
2017-11-05 15:22:04 +01:00
33b5e8daff Code refactor: replace CUDA array with linear memory for 1D and 2D textures.
This is a prequisite for getting host memory allocation to work. There appears
to be no support for 3D textures using host memory. The original version of
this code was written by Stefan Werner for D2056.
2017-11-04 02:23:00 +01:00
6ec599c682 Fix T53247: mixed CPU + GPU render wrong texture limits. 2017-11-03 20:32:29 +01:00
50c129760d Fix Cycles showing empty tiles while they are being denoised. 2017-11-02 15:23:55 +01:00
ff97dcebf3 Fix T53182: cancelling save buffers + denoising render clears image. 2017-11-02 14:31:05 +01:00
Mai Lavelle
5cb8730689 Cycles: Add another limit to OpenCL memory usage
Some drivers may report very large allocation sizes, which could cause
unnecessary memory usage. This is now limited to 2gb which should
still be enough to get the needed performance benefits without waste.
2017-11-02 08:14:21 -04:00
Sergey Sharybin
71f46bc367 Cycles: Add utility function to distinguish between scatter and absorption volume ID 2017-11-01 11:10:51 +01:00
Sergey Sharybin
5d7138c08a Cycles: Cleanup, make it more obvious what preprocessor belongs to 2017-11-01 11:10:10 +01:00
Sergey Sharybin
7f45acee80 Cycles: Cleanup, delete trailing whitespace 2017-11-01 11:06:55 +01:00
Sergey Sharybin
5296c2e099 Experiment with adding output file meta data from render engine
The idea is to make it possible to report extra meta data from
render engine to the file writing. This way we can provide
additional information such as number of samples rendered by
resumable Cycles rendering so we can easily combine files back.

Currently only report number of samples from Cycles when rendering
a single render-layer scene. This is something what was required
here at the studio. We can easily extend that further.

Ideally we would also need to support non-string metadata, but
that's for later.

Reviewers: mont29, campbellbarton

Reviewed By: mont29, campbellbarton

Subscribers: sybren, candreacchio

Differential Revision: https://developer.blender.org/D2502
2017-10-31 15:05:53 +01:00
Sergey Sharybin
46963f359d Cycles: Bump version number to 1.9.0
This matches Blender Release 2.79.
2017-10-31 13:34:34 +01:00
Sergey Sharybin
39671ac504 Fix crash of standalone app after recent refactor 2017-10-31 13:34:23 +01:00
Arto Kitula
076abf6cd8 MacOS: Use correct Cocoa protocol on any compiler 2017-10-31 11:30:55 +02:00
bbc7eb8ae5 Cycles: restore SOBOL_SKIP hack, for some cases where it helps still. 2017-10-29 16:44:20 +01:00
Arto Kitula
1effab7809 Fix T52984. Trackpad rotation to natural direction 2017-10-26 23:11:25 +03:00
171c4e982f Cycles: use AO factor to let user adjust intensity of AO bounces.
We are already using the AO distance, so might as well offer this extra
control over the intensity. Useful when an interior scene is supposed to
be significantly darker than the background shader.
2017-10-25 21:46:23 +02:00
Campbell Barton
2103194f79 Fix T53004: XWayland ignores cursor-warp calls
There is currently a limitation in XWayland,
the cursor needs to be hidden during warp calls.
2017-10-25 20:12:12 +11:00
83877632a3 Fix one more assert being triggered due to recent changes. 2017-10-25 01:22:16 +02:00
34fe3f9c06 Code refactor: remove MEM_WRITE_ONLY, always use MEM_READ_WRITE.
It's unlikely the driver can do useful optimizations with this, and if
we sum multiple samples we are reading from the memory anyway.
2017-10-24 23:53:09 +02:00
fe253389e0 Fix Cycles gtests build on macOS. 2017-10-24 17:52:20 +02:00
ec49503a33 Fix T53146: incomplete multi GPU and CPU + GPU memory statistics.
Part due to recent changes, part old bug.
2017-10-24 17:40:43 +02:00
Sergey Sharybin
e03df90bf3 Cycles: Fix compilation in debug mode
Please check compilation before committing refactor changes!
2017-10-24 12:09:02 +02:00
Sergey Sharybin
eccd18a91f Cycles: Fix compilation error without C++11 2017-10-24 11:14:01 +02:00
Sergey Sharybin
d0f48d33f4 Cycles: Fix memory leak in test and simplify code 2017-10-24 11:12:28 +02:00
Sergey Sharybin
1dd33b2f23 Cycles: Fix test compilation failure after recent refactor
The test will leak CPU devices, but is all passing other than that.
Leak will be fixed shortly.

P.S. Committing code refactor without running regression tests, tsk ;)
2017-10-24 10:48:16 +02:00
a1aad1f8d1 Fix T53134: denoising with CPU + GPU render leaves some tiles noisy. 2017-10-24 04:09:48 +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
aa8b4c5d81 Code refactor: use device_only_memory and device_vector in more places. 2017-10-24 01:25:13 +02:00
7ad9333fad Code refactor: store device/interp/extension/type in each device_memory. 2017-10-24 01:03:59 +02:00
ae41f38f78 Code refactor: pass device to scene, check OSL with device info. 2017-10-24 01:03:59 +02:00
57a0cb797d Code refactor: avoid some unnecessary device memory copying. 2017-10-21 20:58:28 +02:00
92ec4863c2 Code refactor: simplify image device memory allocation. 2017-10-21 20:58:28 +02:00
0836795a0d Fix issue with resumable rendering in recent changes. 2017-10-21 20:57:52 +02:00
6199a606a6 Cycles: disable progressive refine if denoising or save buffers is used.
Progressive refine undoes memory saving from save buffers, so enabling
both does not make much sense. Previously enabling progressive refine
would disable denoising, but it should be the other way around since
denoise actually affects the render result.

Includes some code refactor for progressive refine render buffers, and
avoids recomputing tiles for each progressive sample.
2017-10-21 20:29:21 +02:00
dc9eb8234f Cycles: combined CPU + GPU rendering support.
CPU rendering will be restricted to a BVH2, which is not ideal for raytracing
performance but can be shared with the GPU. Decoupled volume shading will be
disabled to match GPU volume sampling.

The number of CPU rendering threads is reduced to leave one core dedicated to
each GPU. Viewport rendering will also only use GPU rendering still. So along
with the BVH2 usage, perfect scaling should not be expected.

Go to User Preferences > System to enable the CPU to render alongside the GPU.

Differential Revision: https://developer.blender.org/D2873
2017-10-21 20:13:44 +02:00
3df2e6d76b Fix T53109: denoising variance debug passes not working after recent changes. 2017-10-20 14:41:24 +02:00
Sergey Sharybin
910dd7fb1b Cycles: Add extra logging in CUDA device detection code 2017-10-19 11:26:10 +02:00
d85a0a722e Fix part of T53038: principled BSDF clearcoat weight has no effect with 0 roughness. 2017-10-18 23:35:54 +02:00
Sergey Sharybin
01a0649354 Cycles: Fix wrong shading when some mesh triangle has non-finite coordinate
This is fully unpredictable for artists when one damaged object makes the whole
scene to render incorrectly. This involves two main changes:

- It is not enough to check triangle bounds to be valid when building BVH.
  This is because triangle might have some finite vertices and some non-finite.

- We shouldn't add non-finite triangle area to the overall area for MIS.
2017-10-18 12:19:53 +02:00
92611dada6 Fix T53098, T53079: OpenCL world texture errors after recent changes. 2017-10-18 03:13:25 +02:00
Campbell Barton
99520e3f92 Cleanup: use 'e' prefix for enum typedefs
Convention was only followed loosely,
apply to DNA where changes aren't likely to conflict.

(Skipped ModifierType for eg).
2017-10-17 13:49:20 +11:00
811dbf5525 Code cleanup: deduplicate primitive refit code. 2017-10-15 21:53:58 +02:00
2e50add164 Fix OpenCL performance regression after cubic interpolation.
Reorganize code to reduce register pressure.
2017-10-15 17:46:50 +02:00
Sergey Sharybin
5ea729845d Fix T53048: OSL Volume is broken in Blender 2.79
Was a mistake in optimization commit which was disconnecting closures and nodes
which does not make sense for volume output.

OSL script we can't ignore and can't currently know in advance if it's a proper
volume shader or not. So we never disconnect OSL nodes from volume output.

This is a good candidate for corrective release.
2017-10-11 15:22:40 +05:00
Sergey Sharybin
4fce3c7ac0 Cycles: Speedup up tangent space calculation
This patch goes away form using C++ RNA during tangent space calculation which
avoids quite a bit of overhead. Now all calculation is done using data which
already exists in ccl::Mesh. This means, tangent space is now calculated from
triangles, which doesn't seem to be any different (at least as far as regression
tests are concerned).

One of the positive sides is that this change makes it possible to move tangent
space calculation from blender/ to render/ so we will have Cycles standalone
supporting tangent space.

Reviewers: brecht, lukasstockner97, campbellbarton

Differential Revision: https://developer.blender.org/D2810
2017-10-11 13:19:15 +05:00
Sergey Sharybin
a421607569 Cycles: Add utility function to calculate triangle's normal 2017-10-11 13:18:59 +05:00
Sergey Sharybin
552d15c976 Cycles: Add utility function to remove given attribute 2017-10-11 13:18:59 +05:00
Sergey Sharybin
4782000fd5 Cycles: Fix possible race condition when initializing devices list 2017-10-11 12:48:19 +05:00
Sergey Sharybin
8d73ba58b6 Cycles: Fix compilation of sm_20 and sm_21 kernels
Was broken since the bicubic commit for GPU support.
2017-10-10 12:26:02 +05:00
e360d003ea Cycles: schedule more work for non-display and compute preemption CUDA cards.
This change affects CUDA GPUs not connected to a display or connected to a
display but supporting compute preemption so that the display does not
freeze. I couldn't find an official list, but compute preemption seems to be
only supported with GTX 1070+ and Linux (not GTX 1060- or Windows).

This helps improve small tile rendering performance further if there are
sufficient samples x number of pixels in a single tile to keep the GPU busy.
2017-10-08 21:12:16 +02:00
Mathieu Menuet
5aa08eb3cc Fix T53017: Cycles not detecting AMD GPU when there is an NVidia GPU too.
Best guess is that cuInit() somehow interferes with the AMD graphics driver
on Windows, and switching the initialization order to do OpenCL first seems
to solve the issue.
2017-10-08 18:36:02 +02:00
cdb0b3b1dc Code refactor: use DeviceInfo to enable QBVH and decoupled volume shading. 2017-10-08 13:17:33 +02:00
f61c340bc1 Cycles: OpenCL bicubic and tricubic texture interpolation support. 2017-10-08 02:55:44 +02:00
c040dedc12 Fix incorrect MIS with principled BSDF and specular roughness 0. 2017-10-07 22:10:02 +02:00
d7eabc6765 Code cleanup: simplify cmake kernel install. 2017-10-07 15:32:20 +02:00
2d92988f6b Cycles: CUDA bicubic and tricubic texture interpolation support.
While cubic interpolation is quite expensive on the CPU compared to linear
interpolation, the difference on the GPU is quite small.
2017-10-07 15:30:57 +02:00
23098cda99 Code refactor: make texture code more consistent between devices.
* Use common TextureInfo struct for all devices, except CUDA fermi.
* Move image sampling code to kernels/*/kernel_*_image.h files.
* Use arrays for data textures on Fermi too, so device_vector<Struct> works.
2017-10-07 14:53:14 +02:00
Sergey Sharybin
83ce02879f Cycles: Fix possible race condition when generating Beckmann table
Two issues here:

- Checking table size to be non-zero is not a proper way to go here. This is
  because we first resize the table and then fill it in. So it was possible that
  non-initialized table was used.

  Trickery with using temporary memory and then doing table.swap() might work,
  but we can not guarantee that table size will be set after the data pointer.

- Mutex guard was useless, because every thread was using own mutex. Need to
  make mutex guard static so all threads are using same mutex.
2017-10-06 21:06:15 +05:00
Sergey Sharybin
837383ac78 Cycles: Cleanup, indendation 2017-10-06 19:33:59 +05:00
Sergey Sharybin
a950af8e24 Fix T53012: Shadow catcher creates artifacts on contact area
The issue was caused by light sample being evaluated to nan at some point.
This is root of the cause which is to be fixed, but is very hard to trace down
especially via ssh (the issue only happens on AVX2 release build). Will give it
a closer look when back to my AVX2 machine.

For until then this is a good check to have anyway, it corresponds to what's
happening in regular radiance sum.
2017-10-06 17:27:34 +05:00
Sergey Sharybin
0d3c8d0701 Cycles: Cleanup, indentation and wrapping 2017-10-06 16:54:37 +05:00
4537e85584 Fix T53001: more workarounds for crash in AMD compiler with recent drivers. 2017-10-05 17:57:58 +02:00
fb99ea79f8 Code refactor: split displace/background into separate kernels, remove luma. 2017-10-05 17:57:58 +02:00
49199963bf Fix incorrect CUDA remaining time estimate after previous commit. 2017-10-04 23:25:51 +02:00
6da6f8d33f Cycles: CUDA faster rendering of small tiles, using multiple samples like OpenCL.
The work size is still very conservative, and this doesn't help for progressive
refine. For that we will need to render multiple tiles at the same time. But this
should already help for denoising renders that require too much memory with big
tiles, and just generally soften the performance dropoff with small tiles.

Differential Revision: https://developer.blender.org/D2856
2017-10-04 21:58:47 +02:00
77f300e2a9 Fix use of uninitialized memory in Cycles normal baking. 2017-10-04 21:11:14 +02: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
12f4538205 Code refactor: use split variance calculation for mega kernels too.
There is no significant difference in denoised benchmark scenes and
denoising ctests, so might as well make it all consistent.
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
5b7d6ea54b Code refactor: add WorkTile struct for passing work to kernel.
This makes sharing some code between mega/split in following commits a bit
easier, and also paves the way for rendering multiple tiles later.
2017-10-04 21:11:14 +02:00
660e8e59e7 Fix T52645, T52645: AMD OpenCL compiler crash with recent drivers.
Work around the bug by reshuffling code.
2017-10-04 21:00:46 +02:00
Ray Molenkamp
57d7e5b6ee Fix T42489 and T52936: Loading blend with minimized window results in crash or empty screen on windows.
Reviewed By: @brecht , @sergey

Differential Revision: http://developer.blender.org/D2866
2017-10-04 11:44:22 -06:00
Sergey Sharybin
61d5c5a64f Fix T52981: 2D Curve shapes do not render untill extruded
Regression since 9298c53.
2017-10-03 15:29:39 +05:00
f55735e533 CMake: support CUDA 9 toolkit, and automatically disable sm_2x binaries.
Fermi cards (GTX 4xx and 5xx) are no longer supported with this version, so
we can keep supporting both CUDA 8 and 9 for a while.
2017-10-01 14:14:53 +02:00
9298c53e4c Fix T52943: don't export curves objects with no faces to Cycles.
Also skip any objects with zero ray visibility and meshes with
zero faces.
2017-09-29 14:54:34 +02:00
d2bbd41b4e Fix Cycles OpenCL compiler error after recent changes. 2017-09-29 14:54:10 +02:00
Campbell Barton
5a1954a5cb Drop platform support for Solaris & AIX
These platforms didn't see maintenance in years.
This commit just removes ifdef's & cmake check.
2017-09-29 19:16:34 +10:00
c10ac1bb5c macOS: officially upgrade to 10.9 libraries from lib/darwin.
This removes a bunch of code that is no longer needed, and running
"make update" will now automatically download the new libraries.

Differential Revision: https://developer.blender.org/D2861
2017-09-28 20:53:06 +02:00
Kim Christensen
2a36ee16c1 Fix T52574: make Cycles rendered tile counter more clear.
Differential Revision: https://developer.blender.org/D2853
2017-09-28 15:18:53 +02:00