2022-02-11 13:53:21 +01:00
|
|
|
/* SPDX-License-Identifier: Apache-2.0
|
|
|
|
* Copyright 2011-2022 Blender Foundation */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
#ifndef __NODES_H__
|
|
|
|
#define __NODES_H__
|
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "graph/node.h"
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "scene/image.h"
|
|
|
|
#include "scene/shader_graph.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "util/array.h"
|
|
|
|
#include "util/string.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class ImageManager;
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
class LightManager;
|
2015-11-20 18:18:27 +05:00
|
|
|
class Scene;
|
2012-12-12 06:51:06 +00:00
|
|
|
class Shader;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
/* Texture Mapping */
|
|
|
|
|
|
|
|
class TextureMapping {
|
|
|
|
public:
|
|
|
|
TextureMapping();
|
|
|
|
Transform compute_transform();
|
|
|
|
bool skip();
|
|
|
|
void compile(SVMCompiler &compiler, int offset_in, int offset_out);
|
2016-05-07 19:48:28 +02:00
|
|
|
int compile(SVMCompiler &compiler, ShaderInput *vector_in);
|
2012-11-20 17:40:10 +00:00
|
|
|
void compile(OSLCompiler &compiler);
|
2011-10-12 22:42:13 +00:00
|
|
|
|
2016-05-02 20:12:42 +02:00
|
|
|
int compile_begin(SVMCompiler &compiler, ShaderInput *vector_in);
|
|
|
|
void compile_end(SVMCompiler &compiler, ShaderInput *vector_in, int vector_offset);
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
float3 translation;
|
|
|
|
float3 rotation;
|
|
|
|
float3 scale;
|
|
|
|
|
2012-05-07 20:24:38 +00:00
|
|
|
float3 min, max;
|
|
|
|
bool use_minmax;
|
|
|
|
|
2013-09-25 20:28:49 +00:00
|
|
|
enum Type { POINT = 0, TEXTURE = 1, VECTOR = 2, NORMAL = 3 };
|
|
|
|
Type type;
|
|
|
|
|
2012-06-09 18:56:12 +00:00
|
|
|
enum Mapping { NONE = 0, X = 1, Y = 2, Z = 3 };
|
2011-10-12 22:42:13 +00:00
|
|
|
Mapping x_mapping, y_mapping, z_mapping;
|
|
|
|
|
|
|
|
enum Projection { FLAT, CUBE, TUBE, SPHERE };
|
|
|
|
Projection projection;
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Nodes */
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class TextureNode : public ShaderNode {
|
|
|
|
public:
|
2016-05-07 19:48:28 +02:00
|
|
|
explicit TextureNode(const NodeType *node_type) : ShaderNode(node_type)
|
|
|
|
{
|
|
|
|
}
|
2011-10-12 22:42:13 +00:00
|
|
|
TextureMapping tex_mapping;
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(float3, tex_mapping, translation)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(float3, tex_mapping, rotation)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(float3, tex_mapping, scale)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(float3, tex_mapping, min)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(float3, tex_mapping, max)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(bool, tex_mapping, use_minmax)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(TextureMapping::Type, tex_mapping, type)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(TextureMapping::Mapping, tex_mapping, x_mapping)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(TextureMapping::Mapping, tex_mapping, y_mapping)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(TextureMapping::Mapping, tex_mapping, z_mapping)
|
|
|
|
NODE_SOCKET_API_STRUCT_MEMBER(TextureMapping::Projection, tex_mapping, projection)
|
2011-10-12 22:42:13 +00:00
|
|
|
};
|
|
|
|
|
2016-05-02 00:05:16 +02:00
|
|
|
/* Any node which uses image manager's slot should be a subclass of this one. */
|
|
|
|
class ImageSlotTextureNode : public TextureNode {
|
2015-04-02 20:37:57 +05:00
|
|
|
public:
|
2016-05-07 19:48:28 +02:00
|
|
|
explicit ImageSlotTextureNode(const NodeType *node_type) : TextureNode(node_type)
|
|
|
|
{
|
2016-05-02 00:05:16 +02:00
|
|
|
special_type = SHADER_SPECIAL_TYPE_IMAGE_SLOT;
|
2015-12-15 21:56:27 +05:00
|
|
|
}
|
2020-03-08 10:42:11 +01:00
|
|
|
|
2020-03-08 14:21:29 +01:00
|
|
|
virtual bool equals(const ShaderNode &other)
|
|
|
|
{
|
|
|
|
const ImageSlotTextureNode &other_node = (const ImageSlotTextureNode &)other;
|
|
|
|
return TextureNode::equals(other) && handle == other_node.handle;
|
|
|
|
}
|
|
|
|
|
2020-03-08 10:42:11 +01:00
|
|
|
ImageHandle handle;
|
2015-04-02 20:37:57 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
class ImageTextureNode : public ImageSlotTextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(ImageTextureNode)
|
Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.
Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.
Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.
Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.
This is part of T79131.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:20:51 +02:00
|
|
|
ShaderNode *clone(ShaderGraph *graph) const;
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-02 15:45:31 +02:00
|
|
|
virtual bool equals(const ShaderNode &other)
|
|
|
|
{
|
2020-03-08 14:21:29 +01:00
|
|
|
const ImageTextureNode &other_node = (const ImageTextureNode &)other;
|
|
|
|
return ImageSlotTextureNode::equals(other) && animated == other_node.animated;
|
2019-05-02 15:45:31 +02:00
|
|
|
}
|
|
|
|
|
2020-03-08 14:21:29 +01:00
|
|
|
ImageParams image_params() const;
|
2020-02-20 00:52:50 +01:00
|
|
|
|
2019-05-02 15:45:31 +02:00
|
|
|
/* Parameters. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, filename)
|
|
|
|
NODE_SOCKET_API(ustring, colorspace)
|
|
|
|
NODE_SOCKET_API(ImageAlphaType, alpha_type)
|
|
|
|
NODE_SOCKET_API(NodeImageProjection, projection)
|
|
|
|
NODE_SOCKET_API(InterpolationType, interpolation)
|
|
|
|
NODE_SOCKET_API(ExtensionType, extension)
|
|
|
|
NODE_SOCKET_API(float, projection_blend)
|
|
|
|
NODE_SOCKET_API(bool, animated)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2021-09-09 16:39:45 +02:00
|
|
|
NODE_SOCKET_API_ARRAY(array<int>, tiles)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Add support for tiled images and the UDIM naming scheme
This patch contains the work that I did during my week at the Code Quest - adding support for tiled images to Blender.
With this patch, images now contain a list of tiles. By default, this just contains one tile, but if the source type is set to Tiled, the user can add additional tiles. When acquiring an ImBuf, the tile to be loaded is specified in the ImageUser.
Therefore, code that is not yet aware of tiles will just access the default tile as usual.
The filenames of the additional tiles are derived from the original filename according to the UDIM naming scheme - the filename contains an index that is calculated as (1001 + 10*<y coordinate of the tile> + <x coordinate of the tile>), where the x coordinate never goes above 9.
Internally, the various tiles are stored in a cache just like sequences. When acquired for the first time, the code will try to load the corresponding file from disk. Alternatively, a new operator can be used to initialize the tile similar to the New Image operator.
The following features are supported so far:
- Automatic detection and loading of all tiles when opening the first tile (1001)
- Saving all tiles
- Adding and removing tiles
- Filling tiles with generated images
- Drawing all tiles in the Image Editor
- Viewing a tiled grid even if no image is selected
- Rendering tiled images in Eevee
- Rendering tiled images in Cycles (in SVM mode)
- Automatically skipping loading of unused tiles in Cycles
- 2D texture painting (also across tiles)
- 3D texture painting (also across tiles, only limitation: individual faces can not cross tile borders)
- Assigning custom labels to individual tiles (drawn in the Image Editor instead of the ID)
- Different resolutions between tiles
There still are some missing features that will be added later (see T72390):
- Workbench engine support
- Packing/Unpacking support
- Baking support
- Cycles OSL support
- many other Blender features that rely on images
Thanks to Brecht for the review and to all who tested the intermediate versions!
Differential Revision: https://developer.blender.org/D3509
2019-12-12 16:06:08 +01:00
|
|
|
protected:
|
|
|
|
void cull_tiles(Scene *scene, ShaderGraph *graph);
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2015-04-02 20:37:57 +05:00
|
|
|
class EnvironmentTextureNode : public ImageSlotTextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(EnvironmentTextureNode)
|
Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.
Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.
Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.
Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.
This is part of T79131.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:20:51 +02:00
|
|
|
ShaderNode *clone(ShaderGraph *graph) const;
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
2015-06-01 17:48:45 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-02 15:45:31 +02:00
|
|
|
virtual bool equals(const ShaderNode &other)
|
|
|
|
{
|
2020-03-08 14:21:29 +01:00
|
|
|
const EnvironmentTextureNode &other_node = (const EnvironmentTextureNode &)other;
|
|
|
|
return ImageSlotTextureNode::equals(other) && animated == other_node.animated;
|
2019-05-02 15:45:31 +02:00
|
|
|
}
|
|
|
|
|
2020-03-08 14:21:29 +01:00
|
|
|
ImageParams image_params() const;
|
2020-02-20 00:52:50 +01:00
|
|
|
|
2019-05-02 15:45:31 +02:00
|
|
|
/* Parameters. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, filename)
|
|
|
|
NODE_SOCKET_API(ustring, colorspace)
|
|
|
|
NODE_SOCKET_API(ImageAlphaType, alpha_type)
|
|
|
|
NODE_SOCKET_API(NodeEnvironmentProjection, projection)
|
|
|
|
NODE_SOCKET_API(InterpolationType, interpolation)
|
|
|
|
NODE_SOCKET_API(bool, animated)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class SkyTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SkyTextureNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeSkyType, sky_type)
|
|
|
|
NODE_SOCKET_API(float3, sun_direction)
|
|
|
|
NODE_SOCKET_API(float, turbidity)
|
|
|
|
NODE_SOCKET_API(float, ground_albedo)
|
|
|
|
NODE_SOCKET_API(bool, sun_disc)
|
|
|
|
NODE_SOCKET_API(float, sun_size)
|
|
|
|
NODE_SOCKET_API(float, sun_intensity)
|
|
|
|
NODE_SOCKET_API(float, sun_elevation)
|
|
|
|
NODE_SOCKET_API(float, sun_rotation)
|
|
|
|
NODE_SOCKET_API(float, altitude)
|
|
|
|
NODE_SOCKET_API(float, air_density)
|
|
|
|
NODE_SOCKET_API(float, dust_density)
|
|
|
|
NODE_SOCKET_API(float, ozone_density)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
Cycles: Add new Sky Texture method including direct sunlight
This commit adds a new model to the Sky Texture node, which is based on a
method by Nishita et al. and works by basically simulating volumetric
scattering in the atmosphere.
By making some approximations (such as only considering single scattering),
we get a fairly simple and fast simulation code that takes into account
Rayleigh and Mie scattering as well as Ozone absorption.
This code is used to precompute a 512x128 texture which is then looked up
during render time, and is fast enough to allow real-time tweaking in the
viewport.
Due to the nature of the simulation, it exposes several parameters that
allow for lots of flexibility in choosing the look and matching real-world
conditions (such as Air/Dust/Ozone density and altitude).
Additionally, the same volumetric approach can be used to compute absorption
of the direct sunlight, so the model also supports adding direct sunlight.
This makes it significantly easier to set up Sun+Sky illumination where
the direction, intensity and color of the sun actually matches the sky.
In order to support properly sampling the direct sun component, the commit
also adds logic for sampling a specific area to the kernel light sampling
code. This is combined with portal and background map sampling using MIS.
This sampling logic works for the common case of having one Sky texture
going into the Background shader, but if a custom input to the Vector
node is used or if there are multiple Sky textures, it falls back to using
only background map sampling (while automatically setting the resolution to
4096x2048 if auto resolution is used).
More infos and preview can be found here:
https://docs.google.com/document/d/1gQta0ygFWXTrl5Pmvl_nZRgUw0mWg0FJeRuNKS36m08/view
Underlying model, implementation and documentation by Marco (@nacioss).
Improvements, cleanup and sun sampling by @lukasstockner.
Differential Revision: https://developer.blender.org/D7896
2020-06-17 20:27:10 +02:00
|
|
|
ImageHandle handle;
|
2020-08-17 17:48:53 +02:00
|
|
|
|
|
|
|
float get_sun_size()
|
|
|
|
{
|
|
|
|
/* Clamping for numerical precision. */
|
|
|
|
return fmaxf(sun_size, 0.0005f);
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class OutputNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(OutputNode)
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(Node *, surface)
|
|
|
|
NODE_SOCKET_API(Node *, volume)
|
|
|
|
NODE_SOCKET_API(float3, displacement)
|
|
|
|
NODE_SOCKET_API(float3, normal)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2015-12-15 21:56:27 +05:00
|
|
|
/* Don't allow output node de-duplication. */
|
2016-05-07 19:48:28 +02:00
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2019-12-04 19:57:28 +01:00
|
|
|
class OutputAOVNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(OutputAOVNode)
|
|
|
|
virtual void simplify_settings(Scene *scene);
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, value)
|
|
|
|
NODE_SOCKET_API(float3, color)
|
2019-12-04 19:57:28 +01:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, name)
|
2019-12-04 19:57:28 +01:00
|
|
|
|
|
|
|
/* Don't allow output node de-duplication. */
|
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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-20 17:59:20 +02:00
|
|
|
int offset;
|
2019-12-04 19:57:28 +01:00
|
|
|
bool is_color;
|
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class GradientTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2011-11-06 21:05:58 +00:00
|
|
|
SHADER_NODE_CLASS(GradientTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeGradientType, gradient_type)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class NoiseTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2011-11-06 21:05:58 +00:00
|
|
|
SHADER_NODE_CLASS(NoiseTextureNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(int, dimensions)
|
|
|
|
NODE_SOCKET_API(float, w)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(float, detail)
|
|
|
|
NODE_SOCKET_API(float, roughness)
|
|
|
|
NODE_SOCKET_API(float, distortion)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class VoronoiTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VoronoiTextureNode)
|
|
|
|
|
2019-11-13 08:03:44 +01:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
int result = ShaderNode::get_feature();
|
|
|
|
if (dimensions == 4) {
|
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-20 17:59:20 +02:00
|
|
|
result |= KERNEL_FEATURE_NODE_VORONOI_EXTRA;
|
2019-11-13 08:03:44 +01:00
|
|
|
}
|
|
|
|
else if (dimensions >= 2 && feature == NODE_VORONOI_SMOOTH_F1) {
|
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-20 17:59:20 +02:00
|
|
|
result |= KERNEL_FEATURE_NODE_VORONOI_EXTRA;
|
2019-11-13 08:03:44 +01:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(int, dimensions)
|
|
|
|
NODE_SOCKET_API(NodeVoronoiDistanceMetric, metric)
|
|
|
|
NODE_SOCKET_API(NodeVoronoiFeature, feature)
|
|
|
|
NODE_SOCKET_API(float, w)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(float, exponent)
|
|
|
|
NODE_SOCKET_API(float, smoothness)
|
|
|
|
NODE_SOCKET_API(float, randomness)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class MusgraveTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MusgraveTextureNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(int, dimensions)
|
|
|
|
NODE_SOCKET_API(NodeMusgraveType, musgrave_type)
|
|
|
|
NODE_SOCKET_API(float, w)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(float, detail)
|
|
|
|
NODE_SOCKET_API(float, dimension)
|
|
|
|
NODE_SOCKET_API(float, lacunarity)
|
|
|
|
NODE_SOCKET_API(float, offset)
|
|
|
|
NODE_SOCKET_API(float, gain)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class WaveTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2011-11-06 21:05:58 +00:00
|
|
|
SHADER_NODE_CLASS(WaveTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeWaveType, wave_type)
|
|
|
|
NODE_SOCKET_API(NodeWaveBandsDirection, bands_direction)
|
|
|
|
NODE_SOCKET_API(NodeWaveRingsDirection, rings_direction)
|
|
|
|
NODE_SOCKET_API(NodeWaveProfile, profile)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(float, distortion)
|
|
|
|
NODE_SOCKET_API(float, detail)
|
|
|
|
NODE_SOCKET_API(float, detail_scale)
|
|
|
|
NODE_SOCKET_API(float, detail_roughness)
|
|
|
|
NODE_SOCKET_API(float, phase)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class MagicTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MagicTextureNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(int, depth)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(float, distortion)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2012-01-08 14:55:43 +00:00
|
|
|
class CheckerTextureNode : public TextureNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CheckerTextureNode)
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, vector)
|
|
|
|
NODE_SOCKET_API(float3, color1)
|
|
|
|
NODE_SOCKET_API(float3, color2)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
2012-01-08 14:55:43 +00:00
|
|
|
};
|
|
|
|
|
2012-09-04 13:29:07 +00:00
|
|
|
class BrickTextureNode : public TextureNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BrickTextureNode)
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, offset)
|
|
|
|
NODE_SOCKET_API(float, squash)
|
|
|
|
NODE_SOCKET_API(int, offset_frequency)
|
|
|
|
NODE_SOCKET_API(int, squash_frequency)
|
|
|
|
|
|
|
|
NODE_SOCKET_API(float3, color1)
|
|
|
|
NODE_SOCKET_API(float3, color2)
|
|
|
|
NODE_SOCKET_API(float3, mortar)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(float, mortar_size)
|
|
|
|
NODE_SOCKET_API(float, mortar_smooth)
|
|
|
|
NODE_SOCKET_API(float, bias)
|
|
|
|
NODE_SOCKET_API(float, brick_width)
|
|
|
|
NODE_SOCKET_API(float, row_height)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2012-09-04 13:29:07 +00:00
|
|
|
};
|
|
|
|
|
2015-07-18 22:09:20 +02:00
|
|
|
class PointDensityTextureNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(PointDensityTextureNode)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-07-18 22:09:20 +02:00
|
|
|
~PointDensityTextureNode();
|
Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.
Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.
Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.
Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.
This is part of T79131.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:20:51 +02:00
|
|
|
ShaderNode *clone(ShaderGraph *graph) const;
|
2015-07-18 22:09:20 +02:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
2015-07-18 22:09:20 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-07-18 22:09:20 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-02 15:45:31 +02:00
|
|
|
/* Parameters. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, filename)
|
|
|
|
NODE_SOCKET_API(NodeTexVoxelSpace, space)
|
|
|
|
NODE_SOCKET_API(InterpolationType, interpolation)
|
|
|
|
NODE_SOCKET_API(Transform, tfm)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-02 15:45:31 +02:00
|
|
|
/* Runtime. */
|
2020-03-08 10:42:11 +01:00
|
|
|
ImageHandle handle;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-08 14:21:29 +01:00
|
|
|
ImageParams image_params() const;
|
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
virtual bool equals(const ShaderNode &other)
|
|
|
|
{
|
2020-03-08 14:21:29 +01:00
|
|
|
const PointDensityTextureNode &other_node = (const PointDensityTextureNode &)other;
|
|
|
|
return ShaderNode::equals(other) && handle == other_node.handle;
|
2015-12-15 21:56:27 +05:00
|
|
|
}
|
2015-07-18 22:09:20 +02:00
|
|
|
};
|
|
|
|
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
class IESLightNode : public TextureNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(IESLightNode)
|
|
|
|
|
|
|
|
~IESLightNode();
|
Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.
Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.
Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.
Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.
This is part of T79131.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:20:51 +02:00
|
|
|
ShaderNode *clone(ShaderGraph *graph) const;
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, filename)
|
|
|
|
NODE_SOCKET_API(ustring, ies)
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, strength)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
LightManager *light_manager;
|
|
|
|
int slot;
|
|
|
|
|
|
|
|
void get_slot();
|
|
|
|
};
|
|
|
|
|
2019-08-21 20:04:09 +02:00
|
|
|
class WhiteNoiseTextureNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(WhiteNoiseTextureNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(int, dimensions)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
|
|
|
NODE_SOCKET_API(float, w)
|
2019-08-21 20:04:09 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class MappingNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MappingNode)
|
2019-09-04 23:17:13 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, vector)
|
|
|
|
NODE_SOCKET_API(float3, location)
|
|
|
|
NODE_SOCKET_API(float3, rotation)
|
|
|
|
NODE_SOCKET_API(float3, scale)
|
|
|
|
NODE_SOCKET_API(NodeMappingType, mapping_type)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2016-05-29 12:24:47 +02:00
|
|
|
class RGBToBWNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(RGBToBWNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
2016-05-29 12:24:47 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class ConvertNode : public ShaderNode {
|
|
|
|
public:
|
2016-05-08 01:32:09 +02:00
|
|
|
ConvertNode(SocketType::Type from, SocketType::Type to, bool autoconvert = false);
|
2021-02-14 15:01:26 +01:00
|
|
|
ConvertNode(const ConvertNode &other);
|
2011-04-27 11:58:34 +00:00
|
|
|
SHADER_NODE_BASE_CLASS(ConvertNode)
|
|
|
|
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2015-12-23 21:41:59 +01:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
private:
|
2016-05-08 01:32:09 +02:00
|
|
|
SocketType::Type from, to;
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
union {
|
|
|
|
float value_float;
|
|
|
|
int value_int;
|
|
|
|
float3 value_color;
|
|
|
|
float3 value_vector;
|
|
|
|
float3 value_point;
|
|
|
|
float3 value_normal;
|
|
|
|
};
|
|
|
|
ustring value_string;
|
|
|
|
|
|
|
|
static const int MAX_TYPE = 12;
|
|
|
|
static bool register_types();
|
|
|
|
static Node *create(const NodeType *type);
|
|
|
|
static const NodeType *node_types[MAX_TYPE][MAX_TYPE];
|
|
|
|
static bool initialized;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2017-04-21 12:50:04 +02:00
|
|
|
class BsdfBaseNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
BsdfBaseNode(const NodeType *node_type);
|
|
|
|
|
2017-08-20 17:36:16 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return closure;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2017-08-20 17:36:16 +02:00
|
|
|
virtual bool has_bump();
|
|
|
|
|
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
|
|
|
{
|
|
|
|
/* TODO(sergey): With some care BSDF nodes can be de-duplicated. */
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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-20 17:59:20 +02:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
return ShaderNode::get_feature() | KERNEL_FEATURE_NODE_BSDF;
|
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
protected:
|
2017-04-21 12:50:04 +02:00
|
|
|
ClosureType closure;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BsdfNode : public BsdfBaseNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2016-05-07 19:48:28 +02:00
|
|
|
explicit BsdfNode(const NodeType *node_type);
|
2017-03-22 12:27:12 +01:00
|
|
|
SHADER_NODE_BASE_CLASS(BsdfNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2013-09-03 22:39:17 +00:00
|
|
|
void compile(SVMCompiler &compiler,
|
|
|
|
ShaderInput *param1,
|
|
|
|
ShaderInput *param2,
|
|
|
|
ShaderInput *param3 = NULL,
|
|
|
|
ShaderInput *param4 = NULL);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
NODE_SOCKET_API(float3, normal)
|
|
|
|
NODE_SOCKET_API(float, surface_mix_weight)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2014-06-08 12:16:28 +02:00
|
|
|
class AnisotropicBsdfNode : public BsdfNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2014-06-08 12:16:28 +02:00
|
|
|
SHADER_NODE_CLASS(AnisotropicBsdfNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, tangent)
|
|
|
|
NODE_SOCKET_API(float, roughness)
|
|
|
|
NODE_SOCKET_API(float, anisotropy)
|
|
|
|
NODE_SOCKET_API(float, rotation)
|
|
|
|
NODE_SOCKET_API(ClosureType, distribution)
|
2014-06-08 12:16:28 +02:00
|
|
|
|
2016-07-30 19:16:29 +02:00
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return distribution;
|
|
|
|
}
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DiffuseBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(DiffuseBsdfNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, roughness)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2017-04-18 11:43:09 +02:00
|
|
|
/* Disney principled BRDF */
|
2017-04-21 12:50:04 +02:00
|
|
|
class PrincipledBsdfNode : public BsdfBaseNode {
|
2017-04-18 11:43:09 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(PrincipledBsdfNode)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-12 14:39:30 +02:00
|
|
|
void expand(ShaderGraph *graph);
|
2017-07-12 04:36:46 -04:00
|
|
|
bool has_surface_bssrdf();
|
2017-04-18 11:43:09 +02:00
|
|
|
bool has_bssrdf_bump();
|
|
|
|
void compile(SVMCompiler &compiler,
|
|
|
|
ShaderInput *metallic,
|
|
|
|
ShaderInput *subsurface,
|
|
|
|
ShaderInput *subsurface_radius,
|
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-20 17:59:20 +02:00
|
|
|
ShaderInput *subsurface_ior,
|
|
|
|
ShaderInput *subsurface_anisotropy,
|
2017-04-18 11:43:09 +02:00
|
|
|
ShaderInput *specular,
|
|
|
|
ShaderInput *roughness,
|
|
|
|
ShaderInput *specular_tint,
|
|
|
|
ShaderInput *anisotropic,
|
2017-06-21 19:24:57 +02:00
|
|
|
ShaderInput *sheen,
|
|
|
|
ShaderInput *sheen_tint,
|
|
|
|
ShaderInput *clearcoat,
|
|
|
|
ShaderInput *clearcoat_roughness,
|
2017-05-18 13:15:32 +02:00
|
|
|
ShaderInput *ior,
|
|
|
|
ShaderInput *transmission,
|
|
|
|
ShaderInput *anisotropic_rotation,
|
|
|
|
ShaderInput *transmission_roughness);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, base_color)
|
|
|
|
NODE_SOCKET_API(float3, subsurface_color)
|
|
|
|
NODE_SOCKET_API(float3, subsurface_radius)
|
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-20 17:59:20 +02:00
|
|
|
NODE_SOCKET_API(float, subsurface_ior)
|
|
|
|
NODE_SOCKET_API(float, subsurface_anisotropy)
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, metallic)
|
|
|
|
NODE_SOCKET_API(float, subsurface)
|
|
|
|
NODE_SOCKET_API(float, specular)
|
|
|
|
NODE_SOCKET_API(float, roughness)
|
|
|
|
NODE_SOCKET_API(float, specular_tint)
|
|
|
|
NODE_SOCKET_API(float, anisotropic)
|
|
|
|
NODE_SOCKET_API(float, sheen)
|
|
|
|
NODE_SOCKET_API(float, sheen_tint)
|
|
|
|
NODE_SOCKET_API(float, clearcoat)
|
|
|
|
NODE_SOCKET_API(float, clearcoat_roughness)
|
|
|
|
NODE_SOCKET_API(float, ior)
|
|
|
|
NODE_SOCKET_API(float, transmission)
|
|
|
|
NODE_SOCKET_API(float, anisotropic_rotation)
|
|
|
|
NODE_SOCKET_API(float, transmission_roughness)
|
|
|
|
NODE_SOCKET_API(float3, normal)
|
|
|
|
NODE_SOCKET_API(float3, clearcoat_normal)
|
|
|
|
NODE_SOCKET_API(float3, tangent)
|
|
|
|
NODE_SOCKET_API(float, surface_mix_weight)
|
|
|
|
NODE_SOCKET_API(ClosureType, distribution)
|
|
|
|
NODE_SOCKET_API(ClosureType, subsurface_method)
|
|
|
|
NODE_SOCKET_API(float3, emission)
|
|
|
|
NODE_SOCKET_API(float, emission_strength)
|
|
|
|
NODE_SOCKET_API(float, alpha)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
private:
|
|
|
|
ClosureType distribution_orig;
|
|
|
|
|
|
|
|
public:
|
2017-04-18 11:43:09 +02:00
|
|
|
bool has_integrator_dependency();
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2017-04-18 11:43:09 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class TranslucentBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TranslucentBsdfNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class TransparentBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TransparentBsdfNode)
|
2012-12-12 06:51:06 +00:00
|
|
|
|
|
|
|
bool has_surface_transparent()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class VelvetBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VelvetBsdfNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, sigma)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class GlossyBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GlossyBsdfNode)
|
|
|
|
|
2015-11-25 13:52:39 +01:00
|
|
|
void simplify_settings(Scene *scene);
|
2015-11-20 18:18:27 +05:00
|
|
|
bool has_integrator_dependency();
|
2016-07-30 19:16:29 +02:00
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return distribution;
|
|
|
|
}
|
2015-11-18 18:47:56 +01:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, roughness)
|
|
|
|
NODE_SOCKET_API(ClosureType, distribution)
|
|
|
|
|
|
|
|
private:
|
|
|
|
float roughness_orig;
|
|
|
|
ClosureType distribution_orig;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class GlassBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GlassBsdfNode)
|
|
|
|
|
2015-11-25 13:52:39 +01:00
|
|
|
void simplify_settings(Scene *scene);
|
2015-11-20 18:18:27 +05:00
|
|
|
bool has_integrator_dependency();
|
2016-07-30 19:16:29 +02:00
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return distribution;
|
|
|
|
}
|
2015-11-18 18:47:56 +01:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, roughness)
|
|
|
|
NODE_SOCKET_API(float, IOR)
|
|
|
|
NODE_SOCKET_API(ClosureType, distribution)
|
|
|
|
|
|
|
|
private:
|
|
|
|
float roughness_orig;
|
|
|
|
ClosureType distribution_orig;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2012-11-06 19:59:02 +00:00
|
|
|
class RefractionBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(RefractionBsdfNode)
|
|
|
|
|
2015-11-25 13:52:39 +01:00
|
|
|
void simplify_settings(Scene *scene);
|
2015-11-20 18:18:27 +05:00
|
|
|
bool has_integrator_dependency();
|
2016-07-30 19:16:29 +02:00
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return distribution;
|
|
|
|
}
|
2015-11-18 18:47:56 +01:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, roughness)
|
|
|
|
NODE_SOCKET_API(float, IOR)
|
|
|
|
NODE_SOCKET_API(ClosureType, distribution)
|
|
|
|
|
|
|
|
private:
|
|
|
|
float roughness_orig;
|
|
|
|
ClosureType distribution_orig;
|
2012-11-06 19:59:02 +00:00
|
|
|
};
|
|
|
|
|
2013-05-23 17:45:20 +00:00
|
|
|
class ToonBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ToonBsdfNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, smooth)
|
|
|
|
NODE_SOCKET_API(float, size)
|
|
|
|
NODE_SOCKET_API(ClosureType, component)
|
2013-05-23 17:45:20 +00:00
|
|
|
};
|
|
|
|
|
2013-04-01 20:26:52 +00:00
|
|
|
class SubsurfaceScatteringNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SubsurfaceScatteringNode)
|
|
|
|
bool has_surface_bssrdf()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2013-08-18 14:15:57 +00:00
|
|
|
bool has_bssrdf_bump();
|
2016-07-30 19:16:29 +02:00
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
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-20 17:59:20 +02:00
|
|
|
return method;
|
2016-07-30 19:16:29 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(float3, radius)
|
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-20 17:59:20 +02:00
|
|
|
NODE_SOCKET_API(float, subsurface_ior)
|
|
|
|
NODE_SOCKET_API(float, subsurface_anisotropy)
|
|
|
|
NODE_SOCKET_API(ClosureType, method)
|
2013-04-01 20:26:52 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class EmissionNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(EmissionNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2012-12-12 06:51:06 +00:00
|
|
|
bool has_surface_emission()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2017-03-21 17:18:25 +01:00
|
|
|
bool has_volume_support()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
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-20 17:59:20 +02:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
return ShaderNode::get_feature() | KERNEL_FEATURE_NODE_EMISSION;
|
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
NODE_SOCKET_API(float, strength)
|
|
|
|
NODE_SOCKET_API(float, surface_mix_weight)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BackgroundNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BackgroundNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
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-20 17:59:20 +02:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
return ShaderNode::get_feature() | KERNEL_FEATURE_NODE_EMISSION;
|
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
NODE_SOCKET_API(float, strength)
|
|
|
|
NODE_SOCKET_API(float, surface_mix_weight)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
class HoldoutNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HoldoutNode)
|
2016-05-23 14:09:27 +02:00
|
|
|
virtual ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return CLOSURE_HOLDOUT_ID;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, surface_mix_weight)
|
|
|
|
NODE_SOCKET_API(float, volume_mix_weight)
|
2011-08-28 13:55:59 +00:00
|
|
|
};
|
|
|
|
|
2012-11-06 19:59:02 +00:00
|
|
|
class AmbientOcclusionNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AmbientOcclusionNode)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
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-20 17:59:20 +02:00
|
|
|
virtual int get_feature()
|
2018-06-15 11:03:29 +02:00
|
|
|
{
|
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-20 17:59:20 +02:00
|
|
|
return KERNEL_FEATURE_NODE_RAYTRACE;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
NODE_SOCKET_API(float, distance)
|
|
|
|
NODE_SOCKET_API(float3, normal)
|
|
|
|
NODE_SOCKET_API(int, samples)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(bool, only_local)
|
|
|
|
NODE_SOCKET_API(bool, inside)
|
2012-11-06 19:59:02 +00:00
|
|
|
};
|
|
|
|
|
2011-09-27 20:03:16 +00:00
|
|
|
class VolumeNode : public ShaderNode {
|
|
|
|
public:
|
2016-05-07 19:48:28 +02:00
|
|
|
VolumeNode(const NodeType *node_type);
|
|
|
|
SHADER_NODE_BASE_CLASS(VolumeNode)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-27 20:03:16 +00:00
|
|
|
void compile(SVMCompiler &compiler, ShaderInput *param1, ShaderInput *param2);
|
2016-05-23 12:58:25 +02:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
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-20 17:59:20 +02:00
|
|
|
return ShaderNode::get_feature() | KERNEL_FEATURE_NODE_VOLUME;
|
2016-05-23 12:58:25 +02:00
|
|
|
}
|
2016-05-23 14:09:27 +02:00
|
|
|
virtual ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return closure;
|
2017-03-21 17:18:25 +01:00
|
|
|
}
|
|
|
|
virtual bool has_volume_support()
|
|
|
|
{
|
|
|
|
return true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
NODE_SOCKET_API(float, density)
|
|
|
|
NODE_SOCKET_API(float, volume_mix_weight)
|
|
|
|
|
|
|
|
protected:
|
2011-09-27 20:03:16 +00:00
|
|
|
ClosureType closure;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
public:
|
2016-05-07 19:48:28 +02:00
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
2015-12-15 21:56:27 +05:00
|
|
|
{
|
|
|
|
/* TODO(sergey): With some care Volume nodes can be de-duplicated. */
|
|
|
|
return false;
|
|
|
|
}
|
2011-09-27 20:03:16 +00:00
|
|
|
};
|
|
|
|
|
2013-12-28 01:54:44 +01:00
|
|
|
class AbsorptionVolumeNode : public VolumeNode {
|
2011-09-27 20:03:16 +00:00
|
|
|
public:
|
2013-12-28 01:54:44 +01:00
|
|
|
SHADER_NODE_CLASS(AbsorptionVolumeNode)
|
2011-09-27 20:03:16 +00:00
|
|
|
};
|
|
|
|
|
2013-12-28 01:54:44 +01:00
|
|
|
class ScatterVolumeNode : public VolumeNode {
|
2011-09-27 20:03:16 +00:00
|
|
|
public:
|
2013-12-28 01:54:44 +01:00
|
|
|
SHADER_NODE_CLASS(ScatterVolumeNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, anisotropy)
|
2011-09-27 20:03:16 +00:00
|
|
|
};
|
|
|
|
|
2018-01-30 15:05:19 +01:00
|
|
|
class PrincipledVolumeNode : public VolumeNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(PrincipledVolumeNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, density_attribute)
|
|
|
|
NODE_SOCKET_API(ustring, color_attribute)
|
|
|
|
NODE_SOCKET_API(ustring, temperature_attribute)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, anisotropy)
|
|
|
|
NODE_SOCKET_API(float3, absorption_color)
|
|
|
|
NODE_SOCKET_API(float, emission_strength)
|
|
|
|
NODE_SOCKET_API(float3, emission_color)
|
|
|
|
NODE_SOCKET_API(float, blackbody_intensity)
|
|
|
|
NODE_SOCKET_API(float3, blackbody_tint)
|
|
|
|
NODE_SOCKET_API(float, temperature)
|
2018-01-30 15:05:19 +01:00
|
|
|
};
|
|
|
|
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Interface between the I/O sockets and the SVM/OSL backend. */
|
|
|
|
class PrincipledHairBsdfNode : public BsdfBaseNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(PrincipledHairBsdfNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Longitudinal roughness. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, roughness)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Azimuthal roughness. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, radial_roughness)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Randomization factor for roughnesses. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, random_roughness)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Longitudinal roughness factor for only the diffuse bounce (shiny undercoat). */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, coat)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Index of reflection. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, ior)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Cuticle tilt angle. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, offset)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Direct coloring's color. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Melanin concentration. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, melanin)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Melanin redness ratio. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, melanin_redness)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Dye color. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, tint)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Randomization factor for melanin quantities. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, random_color)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Absorption coefficient (unfiltered). */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, absorption_coefficient)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, normal)
|
|
|
|
NODE_SOCKET_API(float, surface_mix_weight)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* If linked, here will be the given random number. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, random)
|
2018-07-18 11:14:43 +02:00
|
|
|
/* Selected coloring parametrization. */
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodePrincipledHairParametrization, parametrization)
|
2018-07-18 11:14:43 +02:00
|
|
|
};
|
|
|
|
|
2013-09-15 23:58:00 +00:00
|
|
|
class HairBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HairBsdfNode)
|
2016-07-30 19:16:29 +02:00
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return component;
|
|
|
|
}
|
2013-09-15 23:58:00 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ClosureType, component)
|
|
|
|
NODE_SOCKET_API(float, offset)
|
|
|
|
NODE_SOCKET_API(float, roughness_u)
|
|
|
|
NODE_SOCKET_API(float, roughness_v)
|
|
|
|
NODE_SOCKET_API(float3, tangent)
|
2013-09-15 23:58:00 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class GeometryNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GeometryNode)
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2019-03-14 09:20:11 +01:00
|
|
|
int get_group();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, normal_osl)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TextureCoordinateNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TextureCoordinateNode)
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
2015-01-21 22:19:31 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, normal_osl)
|
|
|
|
NODE_SOCKET_API(bool, from_dupli)
|
|
|
|
NODE_SOCKET_API(bool, use_transform)
|
|
|
|
NODE_SOCKET_API(Transform, ob_tfm)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2014-04-02 11:40:29 +02:00
|
|
|
class UVMapNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(UVMapNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
2015-06-01 17:48:45 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, attribute)
|
|
|
|
NODE_SOCKET_API(bool, from_dupli)
|
2014-04-02 11:40:29 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class LightPathNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(LightPathNode)
|
|
|
|
};
|
|
|
|
|
2012-05-07 20:24:38 +00:00
|
|
|
class LightFalloffNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(LightFalloffNode)
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, strength)
|
|
|
|
NODE_SOCKET_API(float, smooth)
|
2012-05-07 20:24:38 +00:00
|
|
|
};
|
|
|
|
|
2012-05-21 12:52:28 +00:00
|
|
|
class ObjectInfoNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ObjectInfoNode)
|
|
|
|
};
|
|
|
|
|
2012-06-08 16:17:57 +00:00
|
|
|
class ParticleInfoNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ParticleInfoNode)
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2012-06-08 16:17:57 +00:00
|
|
|
};
|
|
|
|
|
2012-12-28 14:21:30 +00:00
|
|
|
class HairInfoNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HairInfoNode)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2022-01-25 13:25:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class PointInfoNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(PointInfoNode)
|
|
|
|
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
2015-06-01 14:48:24 +05:00
|
|
|
{
|
2022-01-25 13:25:33 +01:00
|
|
|
return true;
|
2015-06-01 14:48:24 +05:00
|
|
|
}
|
2012-12-28 14:21:30 +00:00
|
|
|
};
|
|
|
|
|
2019-08-21 20:22:24 +02:00
|
|
|
class VolumeInfoNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VolumeInfoNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
void expand(ShaderGraph *graph);
|
|
|
|
};
|
|
|
|
|
2019-09-12 17:42:13 +02:00
|
|
|
class VertexColorNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VertexColorNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, layer_name)
|
2019-09-12 17:42:13 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class ValueNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ValueNode)
|
|
|
|
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2015-12-06 23:47:38 +01:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, value)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ColorNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ColorNode)
|
|
|
|
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2015-12-06 23:47:38 +01:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, value)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class AddClosureNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AddClosureNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MixClosureNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MixClosureNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, fac)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2012-11-26 21:59:41 +00:00
|
|
|
class MixClosureWeightNode : public ShaderNode {
|
|
|
|
public:
|
2017-03-22 12:27:12 +01:00
|
|
|
SHADER_NODE_CLASS(MixClosureWeightNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, weight)
|
|
|
|
NODE_SOCKET_API(float, fac)
|
2012-11-26 21:59:41 +00:00
|
|
|
};
|
|
|
|
|
2011-12-03 23:05:35 +00:00
|
|
|
class InvertNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(InvertNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, fac)
|
|
|
|
NODE_SOCKET_API(float3, color)
|
2011-12-03 23:05:35 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class MixNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MixNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeMix, mix_type)
|
|
|
|
NODE_SOCKET_API(bool, use_clamp)
|
|
|
|
NODE_SOCKET_API(float3, color1)
|
|
|
|
NODE_SOCKET_API(float3, color2)
|
|
|
|
NODE_SOCKET_API(float, fac)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
Nodes: Add general Combine/Separate Color nodes
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-04 18:44:03 +02:00
|
|
|
class CombineColorNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CombineColorNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
|
|
|
|
NODE_SOCKET_API(NodeCombSepColorType, color_type)
|
|
|
|
NODE_SOCKET_API(float, r)
|
|
|
|
NODE_SOCKET_API(float, g)
|
|
|
|
NODE_SOCKET_API(float, b)
|
|
|
|
};
|
|
|
|
|
2011-12-01 21:46:10 +00:00
|
|
|
class CombineRGBNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CombineRGBNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, r)
|
|
|
|
NODE_SOCKET_API(float, g)
|
|
|
|
NODE_SOCKET_API(float, b)
|
2011-12-01 21:46:10 +00:00
|
|
|
};
|
|
|
|
|
2013-07-03 23:46:56 +00:00
|
|
|
class CombineHSVNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CombineHSVNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, h)
|
|
|
|
NODE_SOCKET_API(float, s)
|
|
|
|
NODE_SOCKET_API(float, v)
|
2013-07-03 23:46:56 +00:00
|
|
|
};
|
|
|
|
|
2014-06-13 21:44:48 +02:00
|
|
|
class CombineXYZNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CombineXYZNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, x)
|
|
|
|
NODE_SOCKET_API(float, y)
|
|
|
|
NODE_SOCKET_API(float, z)
|
2014-06-13 21:44:48 +02:00
|
|
|
};
|
|
|
|
|
2011-12-16 20:35:06 +00:00
|
|
|
class GammaNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GammaNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
NODE_SOCKET_API(float, gamma)
|
2011-12-16 20:35:06 +00:00
|
|
|
};
|
|
|
|
|
2012-01-24 16:32:31 +00:00
|
|
|
class BrightContrastNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BrightContrastNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
NODE_SOCKET_API(float, bright)
|
|
|
|
NODE_SOCKET_API(float, contrast)
|
2012-01-24 16:32:31 +00:00
|
|
|
};
|
|
|
|
|
Nodes: Add general Combine/Separate Color nodes
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-04 18:44:03 +02:00
|
|
|
class SeparateColorNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SeparateColorNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
|
|
|
|
NODE_SOCKET_API(NodeCombSepColorType, color_type)
|
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
};
|
|
|
|
|
2011-12-01 21:46:10 +00:00
|
|
|
class SeparateRGBNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SeparateRGBNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
2011-12-01 21:46:10 +00:00
|
|
|
};
|
|
|
|
|
2013-07-03 23:46:56 +00:00
|
|
|
class SeparateHSVNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SeparateHSVNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, color)
|
2013-07-03 23:46:56 +00:00
|
|
|
};
|
|
|
|
|
2014-06-13 21:44:48 +02:00
|
|
|
class SeparateXYZNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SeparateXYZNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, vector)
|
2014-06-13 21:44:48 +02:00
|
|
|
};
|
|
|
|
|
2011-12-02 16:57:37 +00:00
|
|
|
class HSVNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HSVNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, hue)
|
|
|
|
NODE_SOCKET_API(float, saturation)
|
|
|
|
NODE_SOCKET_API(float, value)
|
|
|
|
NODE_SOCKET_API(float, fac)
|
|
|
|
NODE_SOCKET_API(float3, color)
|
2011-12-02 16:57:37 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class AttributeNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AttributeNode)
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(ustring, attribute)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-12-02 20:36:13 +00:00
|
|
|
class CameraNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CameraNode)
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-12-02 20:36:13 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class FresnelNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(FresnelNode)
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, normal)
|
|
|
|
NODE_SOCKET_API(float, IOR)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class LayerWeightNode : public ShaderNode {
|
2011-09-16 13:14:02 +00:00
|
|
|
public:
|
2011-11-06 21:05:58 +00:00
|
|
|
SHADER_NODE_CLASS(LayerWeightNode)
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, normal)
|
|
|
|
NODE_SOCKET_API(float, blend)
|
2011-09-16 13:14:02 +00:00
|
|
|
};
|
|
|
|
|
2013-05-20 15:58:37 +00:00
|
|
|
class WireframeNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(WireframeNode)
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, size)
|
|
|
|
NODE_SOCKET_API(bool, use_pixel_size)
|
2013-05-20 15:58:37 +00:00
|
|
|
};
|
|
|
|
|
2013-06-09 20:46:22 +00:00
|
|
|
class WavelengthNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(WavelengthNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, wavelength)
|
2013-06-09 20:46:22 +00:00
|
|
|
};
|
|
|
|
|
2013-07-31 20:56:32 +00:00
|
|
|
class BlackbodyNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BlackbodyNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, temperature)
|
2013-07-31 20:56:32 +00:00
|
|
|
};
|
|
|
|
|
2021-12-13 21:20:07 +00:00
|
|
|
class VectorMapRangeNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorMapRangeNode)
|
|
|
|
void expand(ShaderGraph *graph);
|
|
|
|
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
|
|
|
NODE_SOCKET_API(float3, from_min)
|
|
|
|
NODE_SOCKET_API(float3, from_max)
|
|
|
|
NODE_SOCKET_API(float3, to_min)
|
|
|
|
NODE_SOCKET_API(float3, to_max)
|
|
|
|
NODE_SOCKET_API(float3, steps)
|
|
|
|
NODE_SOCKET_API(NodeMapRangeType, range_type)
|
|
|
|
NODE_SOCKET_API(bool, use_clamp)
|
|
|
|
};
|
|
|
|
|
2019-08-13 16:29:32 +02:00
|
|
|
class MapRangeNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MapRangeNode)
|
2019-08-14 10:53:19 +02:00
|
|
|
void expand(ShaderGraph *graph);
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, value)
|
|
|
|
NODE_SOCKET_API(float, from_min)
|
|
|
|
NODE_SOCKET_API(float, from_max)
|
|
|
|
NODE_SOCKET_API(float, to_min)
|
|
|
|
NODE_SOCKET_API(float, to_max)
|
|
|
|
NODE_SOCKET_API(float, steps)
|
|
|
|
NODE_SOCKET_API(NodeMapRangeType, range_type)
|
|
|
|
NODE_SOCKET_API(bool, clamp)
|
2019-08-13 16:29:32 +02:00
|
|
|
};
|
|
|
|
|
2019-08-13 22:22:15 +02:00
|
|
|
class ClampNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ClampNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, value)
|
|
|
|
NODE_SOCKET_API(float, min)
|
|
|
|
NODE_SOCKET_API(float, max)
|
|
|
|
NODE_SOCKET_API(NodeClampType, clamp_type)
|
2019-08-13 22:22:15 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class MathNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MathNode)
|
2019-08-18 11:16:04 +02:00
|
|
|
void expand(ShaderGraph *graph);
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, value1)
|
|
|
|
NODE_SOCKET_API(float, value2)
|
|
|
|
NODE_SOCKET_API(float, value3)
|
|
|
|
NODE_SOCKET_API(NodeMathType, math_type)
|
|
|
|
NODE_SOCKET_API(bool, use_clamp)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-12-16 18:15:07 +00:00
|
|
|
class NormalNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(NormalNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, direction)
|
|
|
|
NODE_SOCKET_API(float3, normal)
|
2011-12-16 18:15:07 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class VectorMathNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorMathNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, vector1)
|
|
|
|
NODE_SOCKET_API(float3, vector2)
|
|
|
|
NODE_SOCKET_API(float3, vector3)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(NodeVectorMathType, math_type)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2020-02-17 15:15:46 +00:00
|
|
|
class VectorRotateNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorRotateNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeVectorRotateType, rotate_type)
|
|
|
|
NODE_SOCKET_API(bool, invert)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
|
|
|
NODE_SOCKET_API(float3, center)
|
|
|
|
NODE_SOCKET_API(float3, axis)
|
|
|
|
NODE_SOCKET_API(float, angle)
|
|
|
|
NODE_SOCKET_API(float3, rotation)
|
2020-02-17 15:15:46 +00:00
|
|
|
};
|
|
|
|
|
2013-07-31 21:18:23 +00:00
|
|
|
class VectorTransformNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorTransformNode)
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeVectorTransformType, transform_type)
|
|
|
|
NODE_SOCKET_API(NodeVectorTransformConvertSpace, convert_from)
|
|
|
|
NODE_SOCKET_API(NodeVectorTransformConvertSpace, convert_to)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
2013-07-31 21:18:23 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class BumpNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BumpNode)
|
2016-07-16 13:16:54 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2015-06-02 11:53:10 +05:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
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-20 17:59:20 +02:00
|
|
|
return KERNEL_FEATURE_NODE_BUMP;
|
2015-06-02 11:53:10 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(bool, invert)
|
|
|
|
NODE_SOCKET_API(bool, use_object_space)
|
|
|
|
NODE_SOCKET_API(float, height)
|
|
|
|
NODE_SOCKET_API(float, sample_center)
|
|
|
|
NODE_SOCKET_API(float, sample_x)
|
|
|
|
NODE_SOCKET_API(float, sample_y)
|
|
|
|
NODE_SOCKET_API(float3, normal)
|
|
|
|
NODE_SOCKET_API(float, strength)
|
|
|
|
NODE_SOCKET_API(float, distance)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2016-06-21 00:19:51 +02:00
|
|
|
class CurvesNode : public ShaderNode {
|
2012-03-26 12:45:14 +00:00
|
|
|
public:
|
2016-06-21 00:19:51 +02:00
|
|
|
explicit CurvesNode(const NodeType *node_type);
|
2017-03-22 12:27:12 +01:00
|
|
|
SHADER_NODE_BASE_CLASS(CurvesNode)
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2021-09-09 16:39:45 +02:00
|
|
|
NODE_SOCKET_API_ARRAY(array<float3>, curves)
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, min_x)
|
|
|
|
NODE_SOCKET_API(float, max_x)
|
|
|
|
NODE_SOCKET_API(float, fac)
|
|
|
|
NODE_SOCKET_API(float3, value)
|
2022-03-21 17:33:24 +01:00
|
|
|
NODE_SOCKET_API(bool, extrapolate)
|
2016-07-30 23:30:36 +02:00
|
|
|
|
|
|
|
protected:
|
2018-11-23 13:47:25 +01:00
|
|
|
using ShaderNode::constant_fold;
|
2016-07-30 23:30:36 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder, ShaderInput *value_in);
|
|
|
|
void compile(SVMCompiler &compiler, int type, ShaderInput *value_in, ShaderOutput *value_out);
|
|
|
|
void compile(OSLCompiler &compiler, const char *name);
|
2012-03-26 12:45:14 +00:00
|
|
|
};
|
|
|
|
|
2016-06-21 00:19:51 +02:00
|
|
|
class RGBCurvesNode : public CurvesNode {
|
2012-12-11 14:39:37 +00:00
|
|
|
public:
|
2016-06-21 00:19:51 +02:00
|
|
|
SHADER_NODE_CLASS(RGBCurvesNode)
|
2016-07-30 23:30:36 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-06-21 00:19:51 +02:00
|
|
|
};
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2016-06-21 00:19:51 +02:00
|
|
|
class VectorCurvesNode : public CurvesNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorCurvesNode)
|
2016-07-30 23:30:36 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2012-12-11 14:39:37 +00:00
|
|
|
};
|
|
|
|
|
2021-09-30 19:05:08 +01:00
|
|
|
class FloatCurveNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(FloatCurveNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
|
|
|
|
NODE_SOCKET_API_ARRAY(array<float>, curve)
|
|
|
|
NODE_SOCKET_API(float, min_x)
|
|
|
|
NODE_SOCKET_API(float, max_x)
|
|
|
|
NODE_SOCKET_API(float, fac)
|
|
|
|
NODE_SOCKET_API(float, value)
|
2022-03-21 17:33:24 +01:00
|
|
|
NODE_SOCKET_API(bool, extrapolate)
|
2021-09-30 19:05:08 +01:00
|
|
|
};
|
|
|
|
|
2012-03-26 12:45:14 +00:00
|
|
|
class RGBRampNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(RGBRampNode)
|
2016-07-30 23:30:36 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2021-09-09 16:39:45 +02:00
|
|
|
NODE_SOCKET_API_ARRAY(array<float3>, ramp)
|
|
|
|
NODE_SOCKET_API_ARRAY(array<float>, ramp_alpha)
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, fac)
|
|
|
|
NODE_SOCKET_API(bool, interpolate)
|
2012-03-26 12:45:14 +00:00
|
|
|
};
|
|
|
|
|
2012-10-10 15:56:43 +00:00
|
|
|
class SetNormalNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SetNormalNode)
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, direction)
|
2012-10-10 15:56:43 +00:00
|
|
|
};
|
|
|
|
|
2021-04-29 14:56:49 +02:00
|
|
|
class OSLNode final : public ShaderNode {
|
2012-11-03 14:32:35 +00:00
|
|
|
public:
|
Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.
Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.
Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.
Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.
This is part of T79131.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:20:51 +02:00
|
|
|
static OSLNode *create(ShaderGraph *graph, size_t num_inputs, const OSLNode *from = NULL);
|
2016-05-29 15:10:34 +02:00
|
|
|
~OSLNode();
|
|
|
|
|
2021-04-29 14:56:49 +02:00
|
|
|
static void operator delete(void *ptr)
|
|
|
|
{
|
|
|
|
/* Override delete operator to silence new-delete-type-mismatch ASAN warnings
|
|
|
|
* regarding size mismatch in the destructor. This is intentional as we allocate
|
|
|
|
* extra space at the end of the node. */
|
|
|
|
::operator delete(ptr);
|
|
|
|
}
|
|
|
|
static void operator delete(void *, void *)
|
|
|
|
{
|
|
|
|
/* Deliberately empty placement delete operator, to avoid MSVC warning C4291. */
|
|
|
|
}
|
|
|
|
|
Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.
Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.
Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.
Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.
This is part of T79131.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:20:51 +02:00
|
|
|
ShaderNode *clone(ShaderGraph *graph) const;
|
2016-06-18 12:30:59 +02:00
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
char *input_default_value();
|
|
|
|
void add_input(ustring name, SocketType::Type type);
|
|
|
|
void add_output(ustring name, SocketType::Type type);
|
|
|
|
|
2016-06-18 12:30:59 +02:00
|
|
|
SHADER_NODE_NO_CLONE_CLASS(OSLNode)
|
2014-04-03 22:04:39 +02:00
|
|
|
|
2021-02-05 16:23:34 +11:00
|
|
|
/* Ideally we could better detect this, but we can't query this now. */
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2017-10-11 15:21:26 +05:00
|
|
|
bool has_volume_support()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
string filepath;
|
|
|
|
string bytecode_hash;
|
|
|
|
};
|
|
|
|
|
2012-11-06 19:59:02 +00:00
|
|
|
class NormalMapNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(NormalMapNode)
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
2015-06-01 17:48:45 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeNormalMapSpace, space)
|
|
|
|
NODE_SOCKET_API(ustring, attribute)
|
|
|
|
NODE_SOCKET_API(float, strength)
|
|
|
|
NODE_SOCKET_API(float3, color)
|
|
|
|
NODE_SOCKET_API(float3, normal_osl)
|
2012-11-06 19:59:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TangentNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TangentNode)
|
2013-12-31 17:30:34 +01:00
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
2015-06-01 17:48:45 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeTangentDirectionType, direction_type)
|
|
|
|
NODE_SOCKET_API(NodeTangentAxis, axis)
|
|
|
|
NODE_SOCKET_API(ustring, attribute)
|
|
|
|
NODE_SOCKET_API(float3, normal_osl)
|
2012-11-06 19:59:02 +00:00
|
|
|
};
|
|
|
|
|
2017-08-18 18:37:05 +02:00
|
|
|
class BevelNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BevelNode)
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
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-20 17:59:20 +02:00
|
|
|
virtual int get_feature()
|
2017-08-18 18:37:05 +02:00
|
|
|
{
|
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-20 17:59:20 +02:00
|
|
|
return KERNEL_FEATURE_NODE_RAYTRACE;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, radius)
|
|
|
|
NODE_SOCKET_API(float3, normal)
|
|
|
|
NODE_SOCKET_API(int, samples)
|
2017-08-18 18:37:05 +02:00
|
|
|
};
|
|
|
|
|
2018-01-13 13:11:03 +01:00
|
|
|
class DisplacementNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(DisplacementNode)
|
2018-03-11 22:42:38 +01:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2018-01-13 13:11:03 +01:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
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-20 17:59:20 +02:00
|
|
|
return KERNEL_FEATURE_NODE_BUMP;
|
2018-01-13 13:11:03 +01:00
|
|
|
}
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeNormalMapSpace, space)
|
|
|
|
NODE_SOCKET_API(float, height)
|
|
|
|
NODE_SOCKET_API(float, midlevel)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
|
|
|
NODE_SOCKET_API(float3, normal)
|
2018-01-13 13:11:03 +01:00
|
|
|
};
|
|
|
|
|
2018-01-21 00:40:42 +01:00
|
|
|
class VectorDisplacementNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorDisplacementNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
2018-02-18 03:20:39 +01:00
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2018-03-11 22:42:38 +01:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2018-01-21 00:40:42 +01:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
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-20 17:59:20 +02:00
|
|
|
return KERNEL_FEATURE_NODE_BUMP;
|
2018-01-21 00:40:42 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(NodeNormalMapSpace, space)
|
|
|
|
NODE_SOCKET_API(ustring, attribute)
|
|
|
|
NODE_SOCKET_API(float3, vector)
|
|
|
|
NODE_SOCKET_API(float, midlevel)
|
|
|
|
NODE_SOCKET_API(float, scale)
|
2018-01-21 00:40:42 +01:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif /* __NODES_H__ */
|