blender/intern
Alexander Gavrilov f61ff22967 Attribute Node: support accessing attributes of View Layer and Scene.
The attribute node already allows accessing attributes associated
with objects and meshes, which allows changing the behavior of the
same material between different objects or instances. The same idea
can be extended to an even more global level of layers and scenes.

Currently view layers provide an option to replace all materials
with a different one. However, since the same material will be applied
to all objects in the layer, varying the behavior between layers while
preserving distinct materials requires duplicating objects.

Providing access to properties of layers and scenes via the attribute
node enables making materials with built-in switches or settings that
can be controlled globally at the view layer level. This is probably
most useful for complex NPR shading and compositing. Like with objects,
the node can also access built-in scene properties, like render resolution
or FOV of the active camera. Lookup is also attempted in World, similar
to how the Object mode checks the Mesh datablock.

In Cycles this mode is implemented by replacing the attribute node with
the attribute value during sync, allowing constant folding to take the
values into account. This means however that materials that use this
feature have to be re-synced upon any changes to scene, world or camera.

The Eevee version uses a new uniform buffer containing a sorted array
mapping name hashes to values, with binary search lookup. The array
is limited to 512 entries, which is effectively limitless even
considering it is shared by all materials in the scene; it is also
just 16KB of memory so no point trying to optimize further.
The buffer has to be rebuilt when new attributes are detected in a
material, so the draw engine keeps a table of recently seen attribute
names to minimize the chance of extra rebuilds mid-draw.

Differential Revision: https://developer.blender.org/D15941
2022-10-08 16:43:18 +03:00
..
atomic Cleanup: remove workarounds and version checks for unsupported compilers 2022-09-27 07:05:13 +10:00
audaspace CMake: fix AUDASPACE disabling WITH_PYTHON for Blender 2022-05-20 11:18:49 +10:00
clog
cycles Attribute Node: support accessing attributes of View Layer and Scene. 2022-10-08 16:43:18 +03:00
dualcon Cleanup: Compilation warnings 2022-03-18 12:07:08 +01:00
eigen File headers: manually convert files to use SPDX headers 2022-02-11 15:15:49 +11:00
ffmpeg Merge branch 'blender-v3.1-release' 2022-02-22 17:34:07 +01:00
ghost Cleanup: use doxy sections 2022-10-07 16:05:39 +11:00
guardedalloc Cleanup: use 'u' prefixed integer types for brevity in C code 2022-09-26 11:33:22 +10:00
iksolver Cleanup: spelling in comments, capitalize tags 2022-05-13 09:29:25 +10:00
itasc Cleanup: remove argument to doxygen \file 2022-03-25 12:10:30 +11:00
libc_compat Fix compilation on Linux, glibc 2.34, and CentOS libraries 2022-09-13 10:38:42 +02:00
libmv Cleanup: replace C-style casts with functional casts for numeric types 2022-09-25 22:31:31 +10:00
locale
mantaflow Merge branch 'blender-v3.3-release' 2022-08-22 16:13:30 +02:00
memutil
mikktspace Fix T101185: New Mikktspace crashes on meshes without valid triangles 2022-10-05 02:42:43 +02:00
opencolorio Metal: GLSL shader compatibility changes for global uniform and interface name collision. 2022-09-22 17:53:56 +02:00
opensubdiv Cleanup: use lowercase function calls & macros in for CMake 2022-09-23 14:33:44 +10:00
openvdb
quadriflow
rigidbody Cleanup: spelling in comments, capitalize tags 2022-05-13 09:29:25 +10:00
sky Cleanup: replace C-style casts with functional casts for numeric types 2022-09-26 17:58:36 +10:00
utfconv Cleanup: use C++ comments for disabled code 2022-04-13 13:47:04 +10:00
wayland_dynload GHOST/Wayland: support dynamic loading libraries for Wayland 2022-07-06 15:30:47 +10:00
CMakeLists.txt GPU: replace GLEW with libepoxy 2022-08-15 16:10:29 +02:00