Commit Graph

291 Commits

Author SHA1 Message Date
Campbell Barton dd42a9718d Cleanup: format 2024-03-12 17:08:29 +11:00
Campbell Barton 5b9740c913 Cleanup: use braces for sources in intern/
Omitted intern/itasc as some of these sources are from KDL:
https://www.orocos.org/kdl.html
2023-09-17 09:05:40 +10:00
Lukas Stockner 825cc14e74 Cleanup: Cycles: Remove unused argument 2023-09-10 18:58:43 +02:00
Lukas Stockner e20f86547a Cycles: Fix compilation of the shader table precomputing tool 2023-09-10 18:58:43 +02:00
Lukas Stockner 2ac0b36e4e Cycles: Rework component layering in Principled BSDF
Overall, this commit reworks the component layering in the Principled BSDF
in order to ensure that energy is preserved and conserved.

This includes:
- Implementing support for the OSL `layer()` function
- Implementing albedo estimation for some of the closures for layering purposes
  - The specular layer that the Principled BSDF uses has a proper tabulated
    albedo lookup, the others are still approximations
- Removing the custom "Principled Diffuse" and replacing it with the classic
  lambertian Diffuse, since the layering logic takes care of energy now
- Making the merallic component independent of the IOR

Note that this changes the look of the Principled BSDF noticeably in some
cases, but that's needed, since the cases where it looks different are the
ones that strongly violate energy conservation (mostly grazing reflections
with strong Specular).

Pull Request: https://projects.blender.org/blender/blender/pulls/110864
2023-08-10 23:53:37 +02:00
Campbell Barton c12994612b License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
Campbell Barton 4b8434fabd License headers: add missing header 2023-06-14 16:51:35 +10:00
Lukas Stockner 888bdc1419 Cycles: Remove MultiGGX code, replace with albedo scaling
While the multiscattering GGX code is cool and solves the darkening problem at higher roughnesses, it's also currently buggy, hard to maintain and often impractical to use due to the higher noise and render time.

In practice, though, having the exact correct directional distribution is not that important as long as the overall albedo is correct and we a) don't get the darkening effect and b) do get the saturation effect at higher roughnesses.

This can simply be achieved by adding a second lobe (https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf) or scaling the single-scattering GGX lobe (https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf). Both approaches require the same precomputation and produce outputs of comparable quality, so I went for the simple albedo scaling since it's easier to implement and more efficient.

Overall, the results are pretty good: All scenarios that I tested (Glossy BSDF, Glass BSDF, Principled BSDF with metallic or transmissive = 1) pass the white furnace test (a material with pure-white color in front of a pure-white background should be indistinguishable from the background if it preserves energy), and the overall albedo for non-white materials matches that produced by the real multi-scattering code (with the expected saturation increase as the roughness increases).

In order to produce the precomputed tables, the PR also includes a utility that computes them. This is not built by default, since there's no reason for a user to run it (it only makes sense for documentation/reproducibility purposes and when making changes to the microfacet models).

Pull Request: https://projects.blender.org/blender/blender/pulls/107958
2023-06-05 02:20:57 +02:00
Campbell Barton 6859bb6e67 Cleanup: format (with BraceWrapping::AfterControlStatement "MultiLine") 2023-05-02 09:37:49 +10:00
Brecht Van Lommel b288c4004e Cleanup: fix various Cycles compilar warnings
Mainly for the build configuration of the Hydra render delegate and
standalone repo.
2023-04-05 19:48:19 +02:00
Brecht Van Lommel 861debcb10 Fix Cycles standalone and Hydra build issues in some configurations
Bring the build in sync with the Cycles standalone repo.
2023-04-03 17:32:35 +02:00
Sergey Sharybin d32d787f5f Clang-Format: Allow empty functions to be single-line
For example

```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```

becomes

```
OIIOOutputDriver::~OIIOOutputDriver() {}
```

Saves quite some vertical space, which is especially handy for
constructors.

Pull Request: https://projects.blender.org/blender/blender/pulls/105594
2023-03-29 16:50:54 +02:00
Campbell Barton b6b0bc4531 Cleanup: spelling in comments 2023-03-17 16:45:42 +11:00
howetuft 937130a294 Cycles: apply basic gamma correction in stadalone OpenImageIO output driver
For file formats like PNG, JPEG and TIFF. Eventually this should use
the OpenColorIO view transform, but this at least makes the image
closer to what it should be in most cases.

Differential Revision: https://developer.blender.org/D16482
2022-12-07 18:34:57 +01:00
Brecht Van Lommel 617cf2f291 Cycles: remove cubin compiler build option
This was previously needed due to poor compatibility between Visual Studio and
NVCC. But it has not been used for a while now as compatibility seems to have
improved.
2022-11-17 16:04:07 +01:00
Campbell Barton 89525fae59 Cleanup: CMake include paths
Remove redundant separators & redundant references to parent paths.
2022-10-19 21:37:10 +11:00
Sebastian Parborg 8ffc11dbcb Cleanup OpenGL linking and related code after libepoxy merge
This cleans up the OpenGL build flags and linking.
It additionally also removes some dead code.

One of these dead code paths is WITH_X11_ALPHA which actually never was
active even with the build flag on. The call to use this was never
called because the default initializer for GHOST was set to have it off
per default. Nothing called this function with a boolean value to enable it.

These cleanups are needed to support true headless OpenGL rendering.
Without these cleanups libepoxy will fail to load the correct OpenGL
Libraries as we have already linked them to the blender binary.

Reviewed By: Brecht, Campbell, Jeroen

Differential Revision: http://developer.blender.org/D15554
2022-08-15 16:47:20 +02:00
Christian Rauch a296b8f694 GPU: replace GLEW with libepoxy
With libepoxy we can choose between EGL and GLX at runtime, as well as
dynamically open EGL and GLX libraries without linking to them.

This will make it possible to build with Wayland, EGL, GLVND support while
still running on systems that only have X11, GLX and libGL. It also paves
the way for headless rendering through EGL.

libepoxy is a new library dependency, and is included in the precompiled
libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed.

Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton
and Sergey Sharybin.

Ref T76428

Differential Revision: https://developer.blender.org/D15291
2022-08-15 16:10:29 +02:00
Brecht Van Lommel 9b92ce9dc0 Cycles: add USD as a file format for Cycles standalone rendering
Long term, this should replace the XML format. This reuses the Hydra render
delegate implementation, and so supports the same features. The same command
line options and GUI work for both XML and USD also.

The implementation of this is still disabled, waiting for some refactoring of
USD library linking. However we want the Cycles code to be in sync between
repositories for the 3.2 release.

Ref T96731
2022-04-29 19:19:19 +02:00
Brecht Van Lommel 060a50a5f7 Cycles: refactor Hydra render delegate building
* Leave code for building the render delegate against other applications and
  their USD libraries to the Cycles repository, since this is not a great fit.
  In the Blender repository, always use Blender's USD libraries now that they
  include Hydra support.
* Hide non-USD symbols from the hdCycles shared library, to avoid library
  version conflicts.
* Share Apple framework linking between the standalone app and plugin.
* Add cycles_hydra module, to be shared between the standalone app and plugin.
* Bring external libs code in sync with standalone repo, adding various missing
  libraries.
* Move some cmake include directories to the top level cycles source folder
  because we need to control their global order, to ensure we link against the
  correct headers with mixed Blender libraries and external USD libraries.
2022-04-29 19:03:06 +02:00
Brecht Van Lommel e0315a5ef0 Cycles: add profiling command line argument to standalone
Like --cycles-print-stats for Blender.
2022-04-29 18:08:41 +02:00
Brecht Van Lommel 0634bb24ee Cleanup: remove unused server app after network render was removed 2022-04-29 17:39:04 +02:00
Campbell Barton 8898251584 Cleanup: run autopep8 on intern/cycles/
Disable autopep8 for the block that yields passes in list_render_passes,
for better readability.
2022-04-20 16:10:05 +10:00
Brecht Van Lommel 0de0950ad5 Cycles: various Linux build fixes related to Hydra render delegate
* Add missing GLEW and hgiGL libraries for Hydra
* Fix wrong case sensitive include
* Fix link errors by adding external libs to static Hydra lib
* Work around weird Hydra link error with MAX_SAMPLES
* Use Embree by default for Hydra
* Sync external libs code with standalone
* Update version number to match Blender
* Remove unneeded CLEW/GLEW from test executable

None of this should affect Cycles in Blender.

Ref T96731
2022-04-07 19:52:53 +02:00
howetuft fcf06d2ad7 Fix standalone image output not working when not running in background mode
Differential Revision: https://developer.blender.org/D14471
2022-04-06 21:30:10 +02:00
Charles Flèche e7b1be52e0 Cycles: add Alembic procedural to Cycles standalone xml
Example:

<alembic filepath="/tmp/cube.abc" scale="1.45">
  <object path="/Cube/Cube" />
</alembic>

Differential Revision: https://developer.blender.org/D14391
2022-03-23 20:06:12 +01:00
Campbell Barton 7393cc1db7 Cleanup: Remove repeated word in comments 2022-02-23 18:24:37 +11:00
Campbell Barton 4c423ccbd6 CMake: include missing files
Also use SRC_ prefix for source variables so cmake_consistency_check.py
detects these files as being known to CMake.
2022-02-23 12:31:46 +11:00
Brecht Van Lommel 259f4e50ef Merge branch 'blender-v3.1-release' 2022-02-16 15:35:18 +01:00
Brecht Van Lommel f059bdc823 Cycles: restore basic standalone GUI, now using SDL
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-16 15:30:43 +01:00
Brecht Van Lommel 9cfc7967dd Cycles: use SPDX license headers
* 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-11 17:47:34 +01:00
Campbell Barton c434782e3a File headers: SPDX License migration
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-11 09:14:36 +11:00
Brecht Van Lommel 29450a2af3 Build: remove usage of link_directories
We are now always using absolute paths for libraries, as recommended by the
CMake docs.

Followup to D9177.
2022-01-13 10:40:38 +01:00
Brecht Van Lommel f7a0f6a0e4 Fix T94563: Cycles standalone build error on with strict float/double casting
Thanks to John David for finding this.
2022-01-05 20:05:16 +01:00
Brecht Van Lommel fd25e883e2 Cycles: remove prefix from source code file names
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-26 15:37:04 +02:00
Brecht Van Lommel d7d40745fa Cycles: changes to source code folders structure
* Split render/ into scene/ and session/. The scene/ folder now contains the
  scene and its nodes. The session/ folder contains the render session and
  associated data structures like drivers and render buffers.
* Move top level kernel headers into new folders kernel/camera/, kernel/film/,
  kernel/light/, kernel/sample/, kernel/util/
* Move integrator related kernel headers into kernel/integrator/
* Move OSL shaders from kernel/shaders/ to kernel/osl/shaders/

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-26 15:36:39 +02:00
Brecht Van Lommel 1a134c4c30 Cycles: refactor API for render output
* Add OutputDriver, replacing function callbacks in Session.
* Add PathTraceTile, replacing tile access methods in Session.
* Add more detailed comments about how this driver should be implemented.
* Add OIIOOutputDriver for Cycles standalone to output an image.

Differential Revision: https://developer.blender.org/D12627
2021-09-30 20:53:27 +02:00
Brecht Van Lommel 585998987a Cycles: some steps towards getting standalone compiling again
Render output and display still need to be rewritten to work with the new
system.
2021-09-24 16:34:14 +02:00
Brecht Van Lommel 0803119725 Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.

Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.

Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles

Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)

For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.

Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-21 14:55:54 +02:00
Campbell Barton f1e4903854 Cleanup: full sentences in comments, improve comment formatting 2021-06-26 21:50:48 +10:00
Stefan Werner 042df5fd6a Cycles standalone: Fixed macOS dependencies.
Added IOKit and Accerelate as linked frameworks where necessary.
2021-05-03 22:07:09 +02:00
Brecht Van Lommel 68dd7617d7 Cycles: add utility functions for zero float2/float3/float4/transform
Ref D8237, T78710
2021-02-17 16:26:24 +01:00
Campbell Barton 17e1e2bfd8 Cleanup: correct spelling in comments 2021-02-05 16:23:34 +11:00
Charles Flèche 76ab0381d1 Fix Cycles standalone compilation following API changes
The changes to the socket API were not applied to the standalone app.

Also modify Camera.compute_auto_viewplane() to use Camera.full_width and Camera.full_height as it is not possible to publicly access Camera.width and Camera.height anymore, so the aspect ratio could be computed with stale data.

Differential Revision: https://developer.blender.org/D9961
2021-01-26 14:39:32 +01:00
Brecht Van Lommel f04260d8c6 CMake: refresh building and external library handling of Cycles standalone
* Support precompiled libraries on Linux
* Add license headers
* Refactoring to deduplicate code

Includes work by Ray Molenkamp and Grische for precompiled libraries.

Ref D8769
2020-09-04 17:10:50 +02:00
Stefan Werner 17cf500101 Cycles: Fixed Cycles standalone build.
The node refactor in 429afe0c62 was missing in the standalone code.
2020-09-01 14:13:17 +02:00
Szymon Ulatowski 9de09220fc EEVEE: Implement the missing Sky texture
I'm not sure if the Sky was deliberately left out or was just waiting for a
better moment, but so many I was disappointed that Sky in EEVEE is
completely white.

There are already 2 implementations (osl and gpu) so this is the third one.
Looking at other cases it seems that we are not supposed to share sources
between cycles and the rest? So the new util_sky_model files are just
copies of what is already in cycles, except that the data file uses the RGB
variant of the Hosek/Wilkie model, because we output RGB anyway (but can be
easily changed to XYZ if desired - the results are nearly identical).
I am not sure if it is okay to pass 3*9 float values as 3 mat4 uniforms (I
wanted to use mat3 but it does not work).
Also, should I cache the sky model data between renders if the parameters
do not change?

Reviewed By: fclem, brecht

Differential Revision: https://developer.blender.org/D7108
2020-07-09 17:31:36 +02:00
Brecht Van Lommel 86385d7ebd Fix build error for Cycles standalone
This does not affect the Blender release.

Ref D7915
2020-06-03 19:10:51 +02:00
Ray Molenkamp 86c61ce64f Cycles: Restore cycles_cubin_cc to working order
Reviewed by: brecht pmoursnv
Differential Revision: https://developer.blender.org/D7136
2020-03-26 11:41:44 -06:00
Dalai Felinto 2d1cce8331 Cleanup: `make format` after SortedIncludes change 2020-03-19 09:33:58 +01:00