Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-04-01Cycles: approximate shadow caustics using manifold next event estimationOlivier Maury
This adds support for selective rendering of caustics in shadows of refractive objects. Example uses are rendering of underwater caustics and eye caustics. This is based on "Manifold Next Event Estimation", a method developed for production rendering. The idea is to selectively enable shadow caustics on a few objects in the scene where they have a big visual impact, without impacting render performance for the rest of the scene. The Shadow Caustic option must be manually enabled on light, caustic receiver and caster objects. For such light paths, the Filter Glossy option will be ignored and replaced by sharp caustics. Currently this method has a various limitations: * Only caustics in shadows of refractive objects work, which means no caustics from reflection or caustics that outside shadows. Only up to 4 refractive caustic bounces are supported. * Caustic caster objects should have smooth normals. * Not currently support for Metal GPU rendering. In the future this method may be extended for more general caustics. TECHNICAL DETAILS This code adds manifold next event estimation through refractive surface(s) as a new sampling technique for direct lighting, i.e. finding the point on the refractive surface(s) along the path to a light sample, which satisfies Fermat's principle for a given microfacet normal and the path's end points. This technique involves walking on the "specular manifold" using a pseudo newton solver. Such a manifold is defined by the specular constraint matrix from the manifold exploration framework [2]. For each refractive interface, this constraint is defined by enforcing that the generalized half-vector projection onto the interface local tangent plane is null. The newton solver guides the walk by linearizing the manifold locally before reprojecting the linear solution onto the refractive surface. See paper [1] for more details about the technique itself and [3] for the half-vector light transport formulation, from which it is derived. [1] Manifold Next Event Estimation Johannes Hanika, Marc Droske, and Luca Fascione. 2015. Comput. Graph. Forum 34, 4 (July 2015), 87–97. https://jo.dreggn.org/home/2015_mnee.pdf [2] Manifold exploration: a Markov Chain Monte Carlo technique for rendering scenes with difficult specular transport Wenzel Jakob and Steve Marschner. 2012. ACM Trans. Graph. 31, 4, Article 58 (July 2012), 13 pages. https://www.cs.cornell.edu/projects/manifolds-sg12/ [3] The Natural-Constraint Representation of the Path Space for Efficient Light Transport Simulation. Anton S. Kaplanyan, Johannes Hanika, and Carsten Dachsbacher. 2014. ACM Trans. Graph. 33, 4, Article 102 (July 2014), 13 pages. https://cg.ivd.kit.edu/english/HSLT.php The code for this samping technique was inserted at the light sampling stage (direct lighting). If the walk is successful, it turns off path regularization using a specialized flag in the path state (PATH_MNEE_SUCCESS). This flag tells the integrator not to blur the brdf roughness further down the path (in a child ray created from BSDF sampling). In addition, using a cascading mechanism of flag values, we cull connections to caustic lights for this and children rays, which should be resolved through MNEE. This mechanism also cancels the MIS bsdf counter part at the casutic receiver depth, in essence leaving MNEE as the only sampling technique from receivers through refractive casters to caustic lights. This choice might not be optimal when the light gets large wrt to the receiver, though this is usually not when you want to use MNEE. This connection culling strategy removes a fair amount of fireflies, at the cost of introducing a slight bias. Because of the selective nature of the culling mechanism, reflective caustics still benefit from the native path regularization, which further removes fireflies on other surfaces (bouncing light off casters). Differential Revision: https://developer.blender.org/D13533
2022-03-31Cleanup: spelling, trailing space for comment-blocksCampbell Barton
2022-03-30Cleanup: spelling in commentsCampbell Barton
2022-03-24Fix Cycles Metal build error and GCC warning after recent changesBrecht Van Lommel
Function overloading of make_float4() doesn't work since it's a macro, just don't do this minor cleanup then.
2022-03-23Cleanup: use make_float4(f) zero_float4() to simplify codeEthan-Hall
Differential Revision: https://developer.blender.org/D14426
2022-03-23Cycles: optimize CPU texture sampler interpolationEthan-Hall
Use templates to optimize the CPU texture sampler to interpolate using float for single component datatypes instead of using float4 for all types. Differential Revision: https://developer.blender.org/D14424
2022-03-23Cycles: Add Hydra render delegatePatrick Mours
This patch adds a Hydra render delegate to Cycles, allowing Cycles to be used for rendering in applications that provide a Hydra viewport. The implementation was written from scratch against Cycles X, for integration into the Blender repository to make it possible to continue developing it in step with the rest of Cycles. For this purpose it follows the style of the rest of the Cycles code and can be built with a CMake option (`WITH_CYCLES_HYDRA_RENDER_DELEGATE=1`) similar to the existing standalone version of Cycles. Since Hydra render delegates need to be built against the exact USD version and other dependencies as the target application is using, this is intended to be built separate from Blender (`WITH_BLENDER=0` CMake option) and with support for library versions different from what Blender is using. As such the CMake build scripts for Windows had to be modified slightly, so that the Cycles Hydra render delegate can e.g. be built with MSVC 2017 again even though Blender requires MSVC 2019 now, and it's possible to specify custom paths to the USD SDK etc. The codebase supports building against the latest USD release 22.03 and all the way back to USD 20.08 (with some limitations). Reviewed By: brecht, LazyDodo Differential Revision: https://developer.blender.org/D14398
2022-02-25Merge remote-tracking branch 'origin/blender-v3.1-release'Kévin Dietrich
2022-02-25Fix T95977: Point Info node radius wrong under rotationBrecht Van Lommel
2022-02-16Merge branch 'blender-v3.1-release'Brecht Van Lommel
2022-02-16Cycles: restore basic standalone GUI, now using SDLBrecht Van Lommel
GLUT does not support offscreen contexts, which is required for the new display driver. So we use SDL instead. Note that this requires using a system SDL package, the Blender precompiled SDL does not include the video subsystem. There is currently no text display support, instead info is printed to the terminal. This would require adding an embedded font and GLSL shaders, or using GUI library. Another improvement to be made is supporting OpenColorIO display transforms, right now we assume Rec.709 scene linear and display. All OpenGL, GLEW and SDL code was move out of core cycles and into app/opengl. This serves as a template for apps that want to integrate Cycles interactive rendering, with a simple OpenGLDisplayDriver example. In general this would be adapted to the graphics API and color management used by the app. Ref T91846
2022-02-11Cycles: use SPDX license headersBrecht Van Lommel
* Replace license text in headers with SPDX identifiers. * Remove specific license info from outdated readme.txt, instead leave details to the source files. * Add list of SPDX license identifiers used, and corresponding license texts. * Update copyright dates while we're at it. Ref D14069, T95597
2022-02-11Merge branch 'blender-v3.1-release'Sergey Sharybin
2022-02-11Fix Cycles compilation on 32bit ARM platformSergey Sharybin
The rbit instruction is only available starting with ARMv6T2 and the register prefix is different from what AARCH64 uses. Separate the 32 and 64 bit ARM branches, add missing ISA checks. Made sure the code works as intended on macMini with Apple silicon, and on Raspberry Pi 4 B running 32bit Raspbian OS. Differential Revision: https://developer.blender.org/D14056
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-02-10Fix size_t -> int -> size_t round trip in CyclesSergey Sharybin
There are two things achieved by this change: - No possible downcast of size_t to int when calculating motion steps. - Disambiguate call to `min()` which was for some reason considered ambiguous on 32bit platforms `min(int, unsigned int)`. - Do the same for the `max()` call to keep them symmetrical. On an implementation side the `min()` is defined for a fixed width integer type to disambiguate uint from size_t on 32bit platforms, and yet be able to use it for 32bit operands on 64bit platforms without upcast. This ended up in a bit bigger change as the conditional compile-in of functions is easiest if the functions is templated. Making the functions templated required to remove the other source of ambiguity which is `algorithm.h` which was pulling min/max from std. Now it is the `math.h` which is the source of truth for min/max. It was only one place which was relying on `algorithm.h` for these functions, hence the choice of `math.h` as the safest and least intrusive. Fixes 32bit platforms (such as i386) in Debian package build system. Differential Revision: https://developer.blender.org/D14062
2022-02-09Revert "Fix size_t -> int -> size_t round trip in Cycles"Sergey Sharybin
This reverts commit d74bb7be1916744ae56347b49333eac22ebb7339. Need to re-iterate to have a proper support of all platforms.
2022-02-09Fix size_t -> int -> size_t round trip in CyclesSergey Sharybin
There are two things achieved by this change: - No possible downcast of size_t to int when calculating motion steps. - Disambiguate call to min() which was for some reason considered ambiguous on 32bit platforms `min(int, unsigned int)`. On an implementation side the `min()` is defined for a fixed width integer type to disambiguate uint from size_t on 32bit platforms, and yet be able to use it for 32bit operands on 64bit platforms without upcast. Fixes 32bit platforms (such as i386) in Debian package build system. Differential Revision: https://developer.blender.org/D13992
2022-01-26Cleanup: spelling in commentsCampbell Barton
2022-01-20Cycles: Fix bvh2 gen on Apple Silicon and use it to speed up rendersMichael Jones
This patch fixes a correctness issue discovered in the `int4 select(...)` function on Apple Silicon machines, which causes bad bvh2 builds. Although the generated bvh2s give correct renders, the resulting runtime performance is terrible. This fix allows us to switch over to bvh2 on Apple Silicon giving a significant performance uplift for many of the standard benchmarking assets. It also fixes some unit test failures stemming from the use of MetalRT, and trivially enables the new pointcloud primitive. Ref T92212 Reviewed By: brecht Maniphest Tasks: T92212 Differential Revision: https://developer.blender.org/D13877
2022-01-19Cleanup: Strict compiler warning in CyclesSergey Sharybin
The ustring is not a trivially copyable object from the C++ standard point of view, so using memcpy on it is strictly wrong. In practice, however, this is OK since it is just a thin wrapper around char*. For now use explicit cast to void* same as it was done in other places of ccl::array implementation. But also localize the place where memory copy happens to make it easier to support proper non-trivial C++ objects in the future.
2022-01-13Fix Cycles CPU + GPU render not using CPU after recent changesBrecht Van Lommel
In some places the task scheduler was not initialized in time.
2022-01-10Fix T93727: Tiled render error in Cycles after changing temp directorySergey Sharybin
Consider temporary directory to be variant part of session configuration which gets communicated to the tile manager on render reset. This allows to be able to render with one temp directory, change the directory, render again and have proper render result even with enabled persistent data. For the ease of access to the temp directory expose it via the render engine API (engine.temp_directory). Differential Revision: https://developer.blender.org/D13790
2022-01-07Cycles: Remove usage of libnumaapiSergey Sharybin
No need for it now since all the threading queries and scheduling is done via TBB. Should be no functional changes as all the removed code is supposed to be unused.
2022-01-07Fix T94310: Blender doesn't support with 128 threads well in Win11Jagannadhan Ravi
Query TBB for the maximum allowed concurrency, which is free from a bug in own concurrency detection code. One thing to keep in mind is that now Cycles is limited by the number of threads in the TBB areana from which Session is created. This isn't a problem for Blender since we do not limit arena on Blender side. Could be something to watch out for in other Cycles integrations. Differential Revision: https://developer.blender.org/D13658
2021-12-07Cleanup: fix compiler warningBrecht Van Lommel
2021-12-07Cycles: Metal host-side codeMichael Jones
This patch adds the Metal host-side code: - Add all core host-side Metal backend files (device_impl, queue, etc) - Add MetalRT BVH setup files - Integrate with Cycles device enumeration code - Revive `path_source_replace_includes` in util/path (required for MSL compilation) This patch also includes a couple of small kernel-side fixes: - Add an implementation of `lgammaf` for Metal [Nemes, Gergő (2010), "New asymptotic expansion for the Gamma function", Archiv der Mathematik](https://users.renyi.hu/~gergonemes/) - include "work_stealing.h" inside the Metal context class because it accesses state now Ref T92212 Reviewed By: brecht Maniphest Tasks: T92212 Differential Revision: https://developer.blender.org/D13423
2021-12-01Cycles: fix bugs in point and spot light multiple importance samplingSebastian Herholz
* Spot lights are now handled as disks aligned with the direction of the spotlight instead of view aligned disks. * Point light is now handled separately from the spot light, to fix a case where multiple lights are intersected in a row. Before the origin of the ray was the previously intersected light and not the origin of the initial ray traced from the last surface/volume interaction. This makes both strategies in multiple importance sampling converge to the same result. It changes the render results in some scenes, for example the junkshop scene where there are large point lights overlapping scene geometry and each other. Differential Revision: https://developer.blender.org/D13233
2021-11-30Cleanup: remove blank lines in comment blocksCampbell Barton
2021-11-30Cleanup: capitalize NOTE tagCampbell Barton
2021-11-29Cycles: MetalRT support (kernel side)Michael Jones
This patch adds MetalRT support to Cycles kernel code. It is mostly additive in nature or confined to Metal-specific code, however there are a few areas where this interacts with other code: - MetalRT closely follows the Optix implementation, and in some cases (notably handling of transforms) it makes sense to extend Optix special-casing to MetalRT. For these generalisations we now have `__KERNEL_GPU_RAYTRACING__` instead of `__KERNEL_OPTIX__`. - MetalRT doesn't support primitive offsetting (as with `primitiveIndexOffset` in Optix), so we define and populate a new kernel texture, `__object_prim_offset`, containing per-object primitive / curve-segment offsets. This is referenced and applied in MetalRT intersection handlers. - Two new BVH layout enum values have been added: `BVH_LAYOUT_METAL` and `BVH_LAYOUT_MULTI_METAL_EMBREE` for XPU mode). Some host-side enum case handling has been updated where it is trivial to do so. Ref T92212 Reviewed By: brecht Maniphest Tasks: T92212 Differential Revision: https://developer.blender.org/D13353
2021-11-22Fix T93283: Cycles render error with CUDA CPU + GPU after recent optimizationBrecht Van Lommel
BVH2 triangle intersection was broken on the GPU since packed floats can't be loaded directly into SSE. The better long term solution for performance would be to build a BVH2 for GPU and Embree for CPU, similar to what we do for OptiX.
2021-11-19Cleanup: fix typos in comments and docsBrecht Van Lommel
Contributed by luzpaz. Differential Revision: https://developer.blender.org/D10447
2021-11-18Cycles: declare constants at program scope on MetalMichael Jones
MSL requires that constant address space literals be declared at program scope. This patch moves the `blackbody_table_r/g/b` and `cie_colour_match` constants into separate files so they can be declared at the appropriate scope. Ref T92212 Differential Revision: https://developer.blender.org/D13241
2021-11-18Cycles: several small fixes and additions for MSLMichael Jones
This patch contains many small leftover fixes and additions that are required for Metal-enablement: - Address space fixes and a few other small compile fixes - Addition of missing functionality to the Metal adapter headers - Addition of various scattered `__KERNEL_METAL__` blocks (e.g. for atomic support & maths functions) Ref T92212 Differential Revision: https://developer.blender.org/D13263
2021-11-17Fix Cycles CUDA/HIP compiler error after recent changesBrecht Van Lommel
2021-11-17Cycles: add packed_float3 type for storageBrecht Van Lommel
Introduce a packed_float3 type for smaller storage that is exactly 3 floats, instead of 4. For computation float3 is still used since it can use SIMD instructions. Ref T92212 Differential Revision: https://developer.blender.org/D13243
2021-11-17Build: match GCC and Clang float conversion warnings in CyclesBrecht Van Lommel
2021-11-16Fix T93125: Cycles wrong remaining render time with high number of samplesBrecht Van Lommel
Avoid integer overflow.
2021-11-12Fix T92601: Disable profiling when the profiler is deemed not active.William Leeson
Adds a method to profiler that can be used to check if it is active. This is used to determine if stop_profiling and start_profiling should be called. | patch | Juans Scene UI 256 samples | Juans Scene bg 256 samples | junkshop UI | junkshop bg | | No patch | 6:16.59 | 4:05.37 | 2:08.48 | 1:59.7 | | D13187 | 4:12.15 | 3:57.36 | 2:07.25 | 1:58.16 | | D13185 | 4.11.18 |3:54.74 | 2:07.44 | 1:58.03 | | D13190 | 4:12.39 | 3:55.42 | 2:07.62 | 1:58.68 | UI - means rendered from within Blender bg - means rendered from the command line using ##blender -b scene.blend -f 1## Reviewed By: sergey, brecht Maniphest Tasks: T92601 Differential Revision: https://developer.blender.org/D13190
2021-11-01Fix T92671: confusing Cycles debug logs about CPU architectureBrecht Van Lommel
Instead of printing debug flags listing various CPU and GPU settings that may or may not be used, print when we are using them. This include CPU kernel types, OptiX debugging and CUDA and HIP adaptive compilation. BVH type was already printed.
2021-10-28Cleanup: compiler warnings in with Cycles OSL and clangBrecht Van Lommel
2021-10-27Cycles: Replace saturate with saturatefWilliam Leeson
saturate is depricated in favour of __saturatef this replaces saturate with __saturatef on CUDA by createing a saturatef function which replaces all instances of saturate and are hooked up to the correct function on all platforms. Reviewed By: brecht Differential Revision: https://developer.blender.org/D13010
2021-10-26Cycles: remove prefix from source code file namesBrecht Van Lommel
Remove prefix of filenames that is the same as the folder name. This used to help when #includes were using individual files, but now they are always relative to the cycles root directory and so the prefixes are redundant. For patches and branches, git merge and rebase should be able to detect the renames and move over code to the right file.
2021-10-22Cleanup: refactor float/half conversions for clarityBrecht Van Lommel
2021-10-15Cleanup: add utility functions for packing integersBrecht Van Lommel
2021-10-14Cycles: Kernel address space changes for MSLMichael Jones
This is the first of a sequence of changes to support compiling Cycles kernels as MSL (Metal Shading Language) in preparation for a Metal GPU device implementation. MSL requires that all pointer types be declared with explicit address space attributes (device, thread, etc...). There is already precedent for this with Cycles' address space macros (ccl_global, ccl_private, etc...), therefore the first step of MSL-enablement is to apply these consistently. Line-for-line this represents the largest change required to enable MSL. Applying this change first will simplify future patches as well as offering the emergent benefit of enhanced descriptiveness. The vast majority of deltas in this patch fall into one of two cases: - Ensuring ccl_private is specified for thread-local pointer types - Ensuring ccl_global is specified for device-wide pointer types Additionally, the ccl_addr_space qualifier can be removed. Prior to Cycles X, ccl_addr_space was used as a context-dependent address space qualifier, but now it is either redundant (e.g. in struct typedefs), or can be replaced by ccl_global in the case of pointer types. Associated function variants (e.g. lcg_step_float_addrspace) are also redundant. In cases where address space qualifiers are chained with "const", this patch places the address space qualifier first. The rationale for this is that the choice of address space is likely to have the greater impact on runtime performance and overall architecture. The final part of this patch is the addition of a metal/compat.h header. This is partially complete and will be extended in future patches, paving the way for the full Metal implementation. Ref T92212 Reviewed By: brecht Maniphest Tasks: T92212 Differential Revision: https://developer.blender.org/D12864
2021-10-11Cleanup: Spelling in commentSergey Sharybin
2021-09-28Cycles: add HIP device support for AMD GPUsBrian Savery
NOTE: this feature is not ready for user testing, and not yet enabled in daily builds. It is being merged now for easier collaboration on development. HIP is a heterogenous compute interface allowing C++ code to be executed on GPUs similar to CUDA. It is intended to bring back AMD GPU rendering support on Windows and Linux. https://github.com/ROCm-Developer-Tools/HIP. As of the time of writing, it should compile and run on Linux with existing HIP compilers and driver runtimes. Publicly available compilers and drivers for Windows will come later. See task T91571 for more details on the current status and work remaining to be done. Credits: Sayak Biswas (AMD) Arya Rafii (AMD) Brian Savery (AMD) Differential Revision: https://developer.blender.org/D12578
2021-09-24Fix T91660: Cycles remaining render time does not take into account time limitBrecht Van Lommel