Commit Graph

5530 Commits

Author SHA1 Message Date
Patrick Mours
8caeae9f40 Fix crash if OptiX context creation fails in Cycles
When encountering an error during context creation, the "OptiXDevice" constructor aborts early.
This means the "cuda_stream" vector is never resized and the destructor iterated over non-existent data.
2019-11-28 17:07:14 +01:00
Patrick Mours
70a32adfeb Fix assert in Cycles memory statistics when using OptiX on multiple GPUs
The acceleration structure built by OptiX may be different between GPUs, so cannot assume the memory size is the same for all.
This fixes that by moving the memory management for all OptiX acceleration structures into the responsibility of each device (was already the case for BLAS previously, now for TLAS too).
2019-11-28 13:57:02 +01:00
Lukas Stockner
4659fa5471 Cycles: Scale denoising albedo contribution of Principled BSDFs according to average fresnel
The Principled BSDF uses Microfacet closures that include a fresnel term,
which are a special case since their weight tends to be near white even
if their average contribution is fairly low.

The sample weight is scaled by the average fresnel weight to account for
this, but the denoising albedo still used the unscaled weight.

This was fine for the original denoiser, but apparently OIDN can't handle
the resulting albedo pass well. Therefore, this commit adds the described
scaling to the albedo pass contribution as well.

This problem was described in T69770.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D6289
2019-11-27 21:26:47 +01:00
Jeroen Bakker
2e6159a494 Curve: CurveMapping Extend Option
Extend options are currently stored per curve. This was not clearly
communicated to the user and they expected this to be a setting per
CurveMapping.

This change will move the option from `Curve` to `CurveMapping`. In
order to support this the API had to be changed.

BPY: CurveMap.evaluate is also moved to CurveMapping.evaluate what
breaks Python API. Cycles has been updated but other add-ons have
not. After release of 2.81 we can merge this to master and adapt
the add-ons.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D6169
2019-11-27 16:05:54 +01:00
OmarSquircleArt
1c2f7b022a Cycles: Add Random Per Island attribute.
The Random Per Island attribute is a random float associated with each
connected component (island) of the mesh. It is particularly useful
when artists want to add variations to meshes composed of separate
units. Like tree leaves created using particle systems, wood planks
created using array modifiers, or abstract splines created using AN.

Reviewed By: Sergey Sharybin, Jacques Lucke

Differential Revision: https://developer.blender.org/D6154
2019-11-27 12:07:20 +02:00
Patrick Mours
03cdfc2ff6 Fix potential access to deleted memory in OptiX kernel loading code
Calling "OptiXDevice::load_kernels" multiple times would call "optixPipelineDestroy" on a pipeline
pointer that may have already been deleted previously (since the PIP_SHADER_EVAL pipeline is only
created conditionally).
This change also avoids a CUDA kernel reload every time this is called. The CUDA kernels are
precompiled and don't change, so there is no need to reload them every time.
2019-11-25 18:36:55 +01:00
Campbell Barton
ace5677ef0 Cleanup: spelling, repeated words 2019-11-25 00:55:11 +11:00
Patrick Mours
59aef0ad5d Fix T71255: Particle hair not showing in viewport with OptiX after scaling
The OptiX intersection program for curves uses "optixGetObjectRayDirection"
to get the ray direction in object space (which was inverse transformed
with the current transformation matrix). OptiX does no additional operations
on it, so if there is a scaling transform, the direction is not normalized.
But the curve intersection routine expects that. In addition, the distances
used in "optixGetRayTmax()" and "optixReportIntersection()" are in world
space, so need to adjust them accordingly.
2019-11-22 17:30:22 +01:00
Campbell Barton
d7b3b3b22f Merge branch 'blender-v2.81-release' 2019-11-14 00:59:44 +11:00
Jeroen Bakker
e527544b76 Cycles: OpenCL Performance
When using OpenCL with Cycles the rendering time increased substantial.
After doing some tests the bottleneck was found in 4d voronoi and 2d and
3d smooth voronoi.

This change will hide these behind a specific compile directive so the
speed will improve.

AMD RX480 + BMW scene

    2.80 (3:10)
    2.81 (5:48)
    2.81 excluding 4d voronoi+2d/3d smooth (3:50)

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D6231
2019-11-13 12:55:44 +01:00
Ray Molenkamp
a67aa11b12 Windows: Switch to the dynamic C runtime
This change switches windows to the dynamic C runtime
avoiding issues coming from mixing the static and dynamic
runtime like the ones outlined in [1]

[1] https://developer.blender.org/D5387#122165

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

Reviewed by: @Sergey
2019-11-08 09:01:00 -07:00
Campbell Barton
bda58b8a89 Cleanup: clang-format 2019-11-08 11:44:23 +11:00
Sergey Sharybin
4ab0b2b5aa Merge branch 'blender-v2.81-release' 2019-11-07 11:12:44 +01:00
Sergey Sharybin
aa2904ea13 Cycles: Fix strict compiler warning
Pointer used for math arithmetics in assert().
CUDA device pointer is actually an integer type, not a pointer.
2019-11-07 11:06:41 +01:00
Dalai Felinto
af33dbd714 Merge remote-tracking branch 'origin/blender-v2.81-release' 2019-11-06 17:49:17 -03:00
6528fcaeea Fix T69845: OSL wrong texture node output for fixed vector value 2019-11-06 19:29:04 +01:00
af9a50bfe6 Merge branch 'blender-v2.81-release' 2019-11-05 17:35:27 +01:00
Ha Hyung-jin
9a9e93e804 Fix T71071: errors when using multiple CUDA/Optix GPUs and host mapped memory
The multi device code did not correctly handle cases where some GPUs store a
resource in device memory and others store it in host mapped memory.

Differential Revision: https://developer.blender.org/D6126
2019-11-05 16:40:55 +01:00
Patrick Mours
3d5d7cff30 Merge branch 'blender-v2.81-release' 2019-11-05 14:20:00 +01:00
Patrick Mours
7a93abb264 Fix Cycles failing to compile when "WITH_CYCLES_LOGGING" is off 2019-11-05 14:19:33 +01:00
Patrick Mours
4b337a86f1 Merge branch 'blender-v2.81-release' 2019-11-04 18:10:56 +01:00
Patrick Mours
b45828ebe9 Fix T71123: OptiX error in Cycles viewport when adding HDRI
Cycles did not update the "is_enabled" flag on lights when they were synchronized again, which caused all lights disabled by "LightManager::disable_ineffective_light" to be disabled indefinitely. As a result the OptiX kernels were not reloaded with correct features when a change to a light was made. This fixes that by updating the "is_enabled" flag during synchronization.

Differential Revision: https://developer.blender.org/D6141
2019-11-04 18:09:56 +01:00
Robert Guetzkow
3f3d1ad480 Correct naming of cryptomatte output sockets on the render layers node
The cryptomatte sockets were incorrectly numbered using a step size of two. While the increment by two is necessary to get the correct number of render passes, they should be numbered consecutively matching the socket names of the cryptomatte node.

Reviewed By: lukasstockner97

Differential Revision: https://developer.blender.org/D6185
2019-11-04 14:53:09 +01:00
eb95e28635 Merge branch 'blender-v2.81-release' 2019-10-31 15:57:55 +01:00
8c6c46469c Fix T71172: Cycles preferences.get_devices() not refreshing Optix devices 2019-10-31 15:54:44 +01:00
Philipp Oeser
367def2f16 Merge branch 'blender-v2.81-release' 2019-10-30 10:19:41 +01:00
Philipp Oeser
ff7be96322 Toggle 'PLAY' <> 'PAUSE' icons for pausing preview rendering
mentioned in T70974

Maniphest Tasks: T70974

Differential Revision: https://developer.blender.org/D6119
2019-10-30 10:09:51 +01:00
Campbell Barton
d310cbfa0f Merge branch 'blender-v2.81-release' 2019-10-29 01:38:34 +11:00
Campbell Barton
312075e688 CMake: add missing headers, use space before comments 2019-10-29 01:33:44 +11:00
Patrick Mours
200267eb96 Merge branch 'blender-v2.81-release' 2019-10-21 15:53:29 +02:00
Patrick Mours
d0cba5caf4 Fix T70937: Cycles fails in viewport when rendering with OptiX
Was caused by D6068, which did not handle "MEM_PIXELS" memory
when not in background mode. Before that it always fell back to using
generic device memory, so restoring that behavior. In future this
should be changes to use OpenGL interop for optimal performance.
2019-10-21 14:23:45 +02:00
Philipp Oeser
8148bf8cf0 Merge branch 'blender-v2.81-release' 2019-10-18 13:33:20 +02:00
Patrick Mours
8378db40c7 Cycles: Fix out of memory when rendering some scenes with OptiX that work with CUDA
The OptiX implementation wasn't trying to allocate memory on the host if device allocation failed, while the CUDA implementation did. This copies the implementation over to OptiX to remedy that.

Differential Revision: https://developer.blender.org/D6068
2019-10-18 12:23:27 +02:00
Campbell Barton
76e6d2f19d Cleanup: spelling
Also remove historic bftgl reference.
2019-10-17 12:40:36 +11:00
Stefan Werner
35a545b752 Cycles: Allow PTX targets for CUDA kernel build.
This is intended for developers on Windows primarily:
Now, CUDA architectures of type compute_xx are supported. This allows for quicker builds,
at the expense of the CUDA driver running ptxas the first time a kernel is loaded.

Differential Revision: https://developer.blender.org/D5953
2019-10-16 10:29:04 +02:00
Jacques Lucke
e3282fecae Merge branch 'blender-v2.81-release' 2019-10-15 17:37:35 +02:00
Jacques Lucke
2a9b162d94 Fix T70605: incorrect darken and lighten rgb mix mode
Differential Revision: https://developer.blender.org/D6058

Reviewers: brecht, fclem
2019-10-15 17:31:44 +02:00
Dalai Felinto
6d8f5679db Merge branch 'blender-v2.81-release' 2019-10-15 10:42:42 -03:00
Dalai Felinto
7df7a8f3f1 Fix T70838: crash on cycles render after recent fix
My bad for not figuring out how to run our unittests since I got back to
Windows.
2019-10-15 10:18:11 -03:00
Dalai Felinto
a4ef7a27d2 Merge branch 'blender-v2.81-release' 2019-10-14 22:47:07 -03:00
Dalai Felinto
280d6b03a7 Fix T70670: Hidden collections are still rendered by Cycles in the Viewport
Now local collections are fully working with cycles preview, while the
collection visibility bug is fixed.

Local collections were not working with cycles viewport even before the recent
commit to allow users to show collections that are hidden in the view layer.

It just got worse with said commit (0812949bbc3d).

Differential Revision: https://developer.blender.org/D6034
2019-10-14 22:45:33 -03:00
Campbell Barton
d105b620fa Cleanup: clang-format 2019-10-12 09:46:44 +11:00
ad84f22628 Fix T70602: error baking with Cycles OpenCL after recent changes 2019-10-07 16:53:46 +02:00
Philipp Oeser
d4c452ff39 Fix T70573: Crash on enter Cycles render preview with 'Scene world'
disabled and no world assigned to scene

BlenderSync::sync_world still relied on a blender world (mixes the world
viewport color with the studio light), for now just take black if no
world is present.

Maybe we should we use the theme color in the future here (seems eevee
does this in that case) -- we'd have to pass down `b_userpref` from
`BlenderSession::render` down to `sync_data > sync_shaders > sync_world`
then afaics.

Reviewed By: jbakker, brecht

Maniphest Tasks: T70573

Differential Revision: https://developer.blender.org/D6005
2019-10-07 12:26:25 +02:00
OmarSquircleArt
8afa93d82d Fix: Clamping in Map Range node works incorrectly.
The clamp option in the Map Range node doesn't work correctly when the
inputs are linked. The code didn't put that into considration.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5987
2019-10-04 15:21:46 +02:00
Patrick Mours
0091b84df0 Fix T70268: Render failures with Vector pass active with OptiX in Cycles
Rendering would produce invalid results or crash if the Vector pass was active but motion blur was inactive. This caused the OptiX BVH to be built with motion (because objects reported motion available), but the pipeline to be built without motion support (since with disabled motion blur this is not in the list of requested features). The two are not compatible and therefore caused issues. This patch fixes that by not building the BVH with motion if motion blur is not active (which makes sense).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5968
2019-10-02 13:23:29 +02:00
Patrick Mours
8dd9172aa2 Fix "motion_blur" tests with OptiX in Cycles
Curves with motion blur produced wrong results with OptiX (T69801). This is because the AABBs for the motion steps were calculated from incorrect attribute data because the offset into the attribute data array was incorrect.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5961
2019-10-01 20:01:51 +02:00
Stefan Werner
5eebd7cc1f Cycles: Fixed Camera inside volumes with Embree turned on.
The Embree backend did not properly recognize when the camera was
inside a volume and ended up ignoring those.
2019-10-01 19:35:56 +02:00
Patrick Mours
b89a1687ce Fix "denoise_animation" tests with OptiX in Cycles
The OptiX device only loads the denoising kernels when the "use_denoising" feature is active. This was not set by the calling code however and therefore they were never loaded and attempting to launch them failed (see T69801).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5946
2019-09-30 15:38:07 +02:00
Patrick Mours
91f6aa6a57 Fix memory leak after using OptiX in Cycles
The "optix_devices" array was not freed on exit, which caused a memory leak (see T69801).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5944
2019-09-30 14:05:40 +02:00