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-10-08Attribute Node: support accessing attributes of View Layer and Scene.Alexander Gavrilov
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-06Cleanup: spelling in code commentsCampbell Barton
2022-10-03Cleanup: fix source comment/documentation typosBrecht Van Lommel
Contributed by luzpaz. Differential Revision: https://developer.blender.org/D16071
2022-09-16Eevee: Add support for Nishita sky textureLukas Stockner
Sun Disc is currently not supported because it'll need special handling - on the one hand, I'm not sure if Eevee would handle a 1e6 coming out of a background shader without issues, and on the other hand it won't actually cast sharp shadows anyways. I guess we'd want to internally add a sun to the lamps if Sun Disc is enabled, but getting that right is tricky since the user could e.g. swap RGB channels in the node tree and the lamp wouldn't match that. Anyways, that can be handled later, the sky itself is already a start. Reviewed By: fclem Differential Revision: https://developer.blender.org/D13522
2022-09-05Merge branch 'blender-v3.3-release'Clément Foucault
2022-09-05Fix T100649: Regression: Environment texture is stretched when added to meshClément Foucault
The new code was not using the correct default attribute. Add access to `g_data.P` through `node_tex_coord_position()` to replace the old `GPU_builtin(GPU_VIEW_POSITION)` which was used before. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15862
2022-09-02DRW-Next: Add uniform attributes (object attributes) supportClément Foucault
This replaces the direct shader uniform layout declaration by a linear search through a global buffer. Each instance has an attribute offset inside the global buffer and an attribute count. This removes any padding and tighly pack all uniform attributes inside a single buffer. This would also remove the limit of 8 attribute but it is kept because of compatibility with the old system that is still used by the old draw manager.
2022-09-02Merge branch 'blender-v3.3-release'Clément Foucault
# Conflicts: # release/scripts/addons
2022-09-02Fix T100163: Eevee: Regression: Displacement maps affected by rotationClément Foucault
This was an oversight as the matrix multiplication present in original code was reversed. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15858
2022-09-02Fix T100377: EEVEE: Regression 3.2 normalmap node brokenClément Foucault
This was caused by un-wanted normalization. This is a requirement of the MikkTspace. The issue is that g_data.N is expected to be normalized by many other functions and overriden by bump displacement. Adding a new global variable containing the interpolated normal fixes the issue AND make it match cycles behavior better (mix between bump and interpolated normal).
2022-09-02Fix T99528: EEVEE: Regression: Faulty shaders when using Volume Info nodeClément Foucault
Workaround the issue by adding an intermediate function. This is usually the case when working with attributes. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15860
2022-09-02Fix T98190: EEVEE: Very slow rendering on Intel HD Graphics 4400Clément Foucault
This particular GPU driver does not constant fold all the way in order to discard the unused branches. To workaround that, we introduce a series of material flag that generates defines that only keep used branches. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15852
2022-08-31Node: Mix nodeCharlie Jolly
This patch is a response to T92588 and is implemented as a Function/Shader node. This node has support for Float, Vector and Color data types. For Vector it supports uniform and non-uniform mixing. For Color it now has the option to remove factor clamping. It replaces the Mix RGB for Shader and Geometry node trees. As discussed in T96219, this patch converts existing nodes in .blend files. The old node is still available in the Python API but hidden from the menus. Reviewed By: HooglyBoogly, JacquesLucke, simonthommes, brecht Maniphest Tasks: T92588 Differential Revision: https://developer.blender.org/D13749
2022-08-26Merge branch 'blender-v3.3-release'Bastien Montagne
2022-08-26Fix T55284: error in Hybrid MultiFractal Musgrave textureLuis Pereira
The calculation was revised to address two issues: * Discontinuities occurring when detail was a non-integer greater than 2. * Levels of detail in the interval [0,1) repeating the levels of detail in the interval [1,2). This fixes Cycles, Eevee and geometry nodes. Differential Revision: https://developer.blender.org/D15785
2022-08-17Cleanup: strip blank lines around comment blocksCampbell Barton
2022-06-20Fix T99019 EEVEE: Regression: Specular BSDF does not apply occlusionClément Foucault
Since the occlusion input is going to be removed in EEVEE-Next, I just added a temporary workaround. The occlusion is passed as SSS radius as the Specular BSDF does not use it. The final result matches 3.1 release
2022-06-20Fix T99018: EEVEE: Regression: Specular BSDF apply specular color input twiceClément Foucault
This was an oversight. I checked that no other node had the same regression.
2022-06-07Merge branch 'blender-v3.2-release'Clément Foucault
# Conflicts: # source/blender/draw/engines/eevee/shaders/volumetric_vert.glsl
2022-06-07Fix T98647: EEVEE: Camera Data Node's View Vector BrokenClément Foucault
Fix regression and remove duplicated computation.
2022-06-02Merge branch 'blender-v3.2-release'Clément Foucault
2022-06-02Fix T98538 EEVEE: Geometry input node breaks with Displacement TextureClément Foucault
This was due to older drivers not honoring varying attributes shadowing by local variables. Renaming the input argument fixes the issue.
2022-05-23Merge branch 'blender-v3.2-release'Brecht Van Lommel
2022-05-23Fix Eevee blackbody wrong with non-default scene linear color spaceBrecht Van Lommel
* Port over new code tables from Cycles * Convert Rec.709 to scene linear for lookup table. * Move code for wavelength and blackbody to IMB so they can access the required transforms, which are not in blenlib. * Remove clamping from blackbody shader to bypass the texture read. Since it's variable now easiest to just always read from the texture than pass additional parameters. * Fold XYZ to RGB conversion into the wavelength table. Ref T68926
2022-05-23EEVEE: Fix unreported broken normal map node modesClément Foucault
A compilation error was making it impossible to use normal map modes other than tangent.
2022-05-23EEVEE: Fix unreported broken normal map node modesClément Foucault
A compilation error was making it impossible to use normal map modes other than tangent.
2022-05-10Merge branch 'blender-v3.2-release'Jeroen Bakker
2022-05-10Eevee: Fix GLSL compilation error.Jeroen Bakker
Introduced by {35594f4b92fa4cbb5b848f447b7a3323e572b676}. Some platforms do not support temp variables to be used as inout parameter. Detected on Mac with Intel iGPU.
2022-05-10Merge branch 'blender-v3.2-release'Clément Foucault
2022-05-10Fix T97985 EEVEE: Shader mixing not working correctly when reusing shader nodesClément Foucault
This was caused by the `Closure` members being added to the final contribution more than once. The workaround is to clear the members once a closure has been added to the final contribution. I used `inout` on `Closure` inputs so that the render engine implementation of mix and add closure nodes can do its own thing. The nodegraph handling of inout was changed for this to work.
2022-05-09Fix T97983 EEVEE: Tangent Normal of Curves info behaves differently in EeveeClément Foucault
Curve tangent was correctly mistaken with curve normal. This patch fixes the name of the output in the glsl function and make curve attributes more explicit (with `curve_` prefix). This also improve the normal computation by making it per pixel to match cycles. Also ports the changes to eevee-next.
2022-05-06EEVEE: Refactor curve nodesOmar Emara
This patches rewrites the GPU shaders of curve nodes for easier future development. This is a non-functional change. The new code avoids code duplication by moving common code into BKE curve mapping functions. It also avoids ambiguous data embedding into the gradient vectors that are passed to vectors and reduces the size of uniforms uploaded to the shader by avoiding redundancies. This is needed in preparation for the viewport compositor, which will utilize and extend this implementation. Reviewed By: fclem Differential Revision: https://developer.blender.org/D14689
2022-05-06GPU: Move common shaders into a common directoryOmar Emara
This patch moves some of the utility library shaders into a common directory and makes the necessary renames across shaders. Additionally, material-specific transform functions were moved outside of math utils into a separate transform_utils.glsl file. This is needed in preparation for the viewport compositor, which will make use of some of those utilities and will require all material specific bit to be removed out of those files. Reviewed By: fclem Differential Revision: https://developer.blender.org/D14688
2022-05-04Nodes: Add general Combine/Separate Color nodesHallam Roberts
Inspired by D12936 and D12929, this patch adds general purpose "Combine Color" and "Separate Color" nodes to Geometry, Compositor, Shader and Texture nodes. - Within Geometry Nodes, it replaces the existing "Combine RGB" and "Separate RGB" nodes. - Within Compositor Nodes, it replaces the existing "Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA" nodes. - Within Texture Nodes, it replaces the existing "Combine RGBA" and "Separate RGBA" nodes. - Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and "Separate RGB/HSV" nodes. Python addons have not been updated to the new nodes yet. **New shader code** In node_color.h, color.h and gpu_shader_material_color_util.glsl, missing methods hsl_to_rgb and rgb_to_hsl are added by directly converting existing C code. They always produce the same result. **Old code** As requested by T96219, old nodes still exist but are not displayed in the add menu. This means Python scripts can still create them as usual. Otherwise, versioning replaces the old nodes with the new nodes when opening .blend files. Differential Revision: https://developer.blender.org/D14034
2022-05-04Fix T97827: material preview not displaying texturesKévin Dietrich
Caused by rB281bcc1c1dd6 which did not properly made use of `vec4` for UVs which are now loaded as attributes.
2022-05-03Fix T93179: geonodes UVs and Vertex colors do not work in EEVEEKévin Dietrich
Overwriting UV map or vertex color data in Geometry nodes will move the layers to another CustomData channel, and as such, will make attribute lookup fail from the UVMap and Vertex Color nodes in EEVEE as the CustomDataType will also be modified (i.e. no longer `CD_MTFACE` or `CD_MCOL`). As discussed in T93179, the solution is to use `CD_PROP_AUTO_FROM_NAME` so that the render engine is able to find the attributes. This also makes EEVEE emulate Cycles behaviour in this regard. `attr_load_uv` and `attr_load_color` are also removed in favor of the generic attribute API in the various GLSL shaders. Although `CD_PROP_AUTO_FROM_NAME` is now used even for UV maps, the active UV map is still used in case the attribute name is empty, to preserve the old behavior. Differential Revision: https://developer.blender.org/D13730
2022-04-20Cleanup: clang-formatCampbell Barton
2022-04-19GPU: Replace `GPUMaterialVolumeGrid` by `GPUMaterialAttribute`Clément Foucault
This is to make the codegen and shading nodes object type agnostic. This is essential for flexibility of the engine to use the nodetree as it see fits. The essential volume attributes struct properties are moved to the `GPUMaterialAttribute` which see its final input name set on creation. The binding process is centralized into `draw_volume.cc` to avoid duplicating the code between multiple engines. It mimics the hair attributes process. Volume object grid transforms and other per object uniforms are packed into one UBO per object. The grid transform is now based on object which simplify the matrix preparations. This also gets rid of the double transforms and use object info orco factors for volume objects. Tagging @brecht because he did the initial implementation of Volume Grids.
2022-04-14GPU: Make nodetree GLSL Codegen render engine agnosticClément Foucault
This commit removes all EEVEE specific code from the `gpu_shader_material*.glsl` files. It defines a clear interface to evaluate the closure nodes leaving more flexibility to the render engine. Some of the long standing workaround are fixed: - bump mapping support is no longer duplicating a lot of node and is instead compiled into a function call. - bump rewiring to Normal socket is no longer needed as we now use a global `g_data.N` for that. Closure sampling with upstread weight eval is now supported if the engine needs it. This also makes all the material GLSL sources use `GPUSource` for better debugging experience. The `GPUFunction` parsing now happens in `GPUSource` creation. The whole `GPUCodegen` now uses the `ShaderCreateInfo` and is object type agnostic. Is has also been rewritten in C++. This patch changes a view behavior for EEVEE: - Mix shader node factor imput is now clamped. - Tangent Vector displacement behavior is now matching cycles. - The chosen BSDF used for SSR might change. - Hair shading may have very small changes on very large hairs when using hair polygon stripes. - ShaderToRGB node will remove any SSR and SSS form a shader. - SSS radius input now is no longer a scaling factor but defines an average radius. The SSS kernel "shape" (radii) are still defined by the socket default values. Appart from the listed changes no other regressions are expected.
2022-04-14Metal: GLSL shader compatibility 3rd passJason Fielder
Undefined behaviour for divergent control-flow fixes, replacement for partial vector references, and resolution of a number of calculation precision issues occuring on macOS. Authored by Apple: Michael Parkin-White Ref: T96261 Reviewed By: fclem Differential Revision: https://developer.blender.org/D14437
2022-03-22Cleanup: make format and fix warningJacques Lucke
2022-03-22Metal: Make GLSL shader source MSL compliant alsoJason Fielder
Metal shading language follows the C++ 14 standard and in some cases requires a greater level of explicitness than GLSL. There are also some small language differences: - Explicit type-casts (C++ requirements) - Explicit constant values (C++ requirements, e.g. floating point values using 0.0 instead of 0). - Metal/OpenGL compatibility paths - GLSL Function prototypes - Explicit accessors for vector types when sampling textures. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D14378
2022-03-11Cleanup: fix source typos homogenous->homogeneousBrecht Van Lommel
Contributed by luzpaz. Differential Revision: https://developer.blender.org/D14306
2022-03-07Shader Nodes: add Alpha output to Object Info nodeEthan-Hall
An alpha component can be specified for an object's color. This adds an alpha socket to the object info shader node allowing for the alpha component of the object's color to be accessed in the shader editor. Differential Revision: https://developer.blender.org/D14141
2022-02-08Eevee: support the no-op Bump node optimization like in Cycles.Alexander Gavrilov
A Bump node without a Height input is meaningless and does nothing. As such, it is available as an old workaround that allows making Node Group inputs that default to normal when not connected, by routing via a no-op Bump node before doing math. Cycles specifically recognizes this use case and either bypasses the node, or converts it into a Geometry Normal node, but Eevee was still evaluating it as usual. That incurred performance cost, and also normalized the vector unlike Cycles. This implements the same bypass logic for Eevee. Since I'm not sure if it's possible to totally remove the node at this stage, it emits a no-op function call to copy the input vector. Differential Revision: https://developer.blender.org/D14045
2022-01-31Cleanup: use our own conventions for tags in commentsCampbell Barton
2022-01-25Cycles: add Point Info nodeBrecht Van Lommel
With (center) position, radius and random value outputs. Eevee does not yet support rendering point clouds, but an untested implementation of this node was added for when it does. Ref T92573
2022-01-18Fix T95003: Shader issue using voronoi noise.Jeroen Bakker
Cause of the issue isn't that clear, but the NVIDIA GLSL compiler complained that it couldn't find an overloaded function when the second parameter is an interger. This change fixes it by using a float.
2021-12-14Nodes: Add vector support to Map Range nodeCharlie Jolly
This replaces lost functionality from the old GN Attribute Map Range node. This also adds vector support to the shader version of the node. Notes: This breaks forward compatibility as this node now uses data storage. Reviewed By: HooglyBoogly, brecht Differential Revision: https://developer.blender.org/D12760
2021-12-10Fix T92036: `Magic Texture` in Volumetric World Shaders render differently ↵William Leeson
with the CPU and GPU When rendering volume surfaces in unbounded worlds the volume stepping can produce large values. If used with a magic texture node the values can results in a Inf float which when used in a sin or cos produces a NaN. To fix this the input values are mapped into the periodic range of the sin and cos functions (-2*PI 2*PI) this stops the possibility of a Inf occurring and thus the NaN. It also improves the accuracy and smoothness of the result due to loss of precision when large values are summed with smaller ones effectively removing the parts of the smaller number (i.e. those in the -2PI to 2PI range) that result in variation of the output of sin and cos. Reviewed By: brecht Maniphest Tasks: T92036 Differential Revision: https://developer.blender.org/D12821