2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
2014-12-25 02:50:24 +01:00
|
|
|
* limitations under the License.
|
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"
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "render/graph.h"
|
2020-02-20 00:52:50 +01:00
|
|
|
#include "render/image.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2018-11-09 11:54:24 +01:00
|
|
|
#include "util/util_array.h"
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "util/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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
TextureMapping();
|
|
|
|
Transform compute_transform();
|
|
|
|
bool skip();
|
|
|
|
void compile(SVMCompiler &compiler, int offset_in, int offset_out);
|
|
|
|
int compile(SVMCompiler &compiler, ShaderInput *vector_in);
|
|
|
|
void compile(OSLCompiler &compiler);
|
2011-10-12 22:42:13 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
int compile_begin(SVMCompiler &compiler, ShaderInput *vector_in);
|
|
|
|
void compile_end(SVMCompiler &compiler, ShaderInput *vector_in, int vector_offset);
|
2016-05-02 20:12:42 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 translation;
|
|
|
|
float3 rotation;
|
|
|
|
float3 scale;
|
2011-10-12 22:42:13 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 min, max;
|
|
|
|
bool use_minmax;
|
2012-05-07 20:24:38 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
enum Type { POINT = 0, TEXTURE = 1, VECTOR = 2, NORMAL = 3 };
|
|
|
|
Type type;
|
2013-09-25 20:28:49 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
enum Mapping { NONE = 0, X = 1, Y = 2, Z = 3 };
|
|
|
|
Mapping x_mapping, y_mapping, z_mapping;
|
2011-10-12 22:42:13 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
enum Projection { FLAT, CUBE, TUBE, SPHERE };
|
|
|
|
Projection projection;
|
2011-10-12 22:42:13 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Nodes */
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class TextureNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
explicit TextureNode(const NodeType *node_type) : ShaderNode(node_type)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextureMapping tex_mapping;
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
explicit ImageSlotTextureNode(const NodeType *node_type) : TextureNode(node_type)
|
|
|
|
{
|
|
|
|
special_type = SHADER_SPECIAL_TYPE_IMAGE_SLOT;
|
|
|
|
}
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(ImageTextureNode)
|
|
|
|
ShaderNode *clone() const;
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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. */
|
2019-04-17 06:17:24 +02:00
|
|
|
ustring filename;
|
2019-05-02 15:45:31 +02:00
|
|
|
ustring colorspace;
|
2019-05-18 20:52:20 +02:00
|
|
|
ImageAlphaType alpha_type;
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeImageProjection projection;
|
|
|
|
InterpolationType interpolation;
|
|
|
|
ExtensionType extension;
|
|
|
|
float projection_blend;
|
|
|
|
bool animated;
|
|
|
|
float3 vector;
|
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
|
|
|
ccl::vector<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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(EnvironmentTextureNode)
|
|
|
|
ShaderNode *clone() const;
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
|
|
|
|
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. */
|
2019-04-17 06:17:24 +02:00
|
|
|
ustring filename;
|
2019-05-02 15:45:31 +02:00
|
|
|
ustring colorspace;
|
2019-05-18 20:52:20 +02:00
|
|
|
ImageAlphaType alpha_type;
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeEnvironmentProjection projection;
|
|
|
|
InterpolationType interpolation;
|
|
|
|
bool animated;
|
|
|
|
float3 vector;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class SkyTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SkyTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeSkyType type;
|
|
|
|
float3 sun_direction;
|
|
|
|
float turbidity;
|
|
|
|
float ground_albedo;
|
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
|
|
|
bool sun_disc;
|
|
|
|
float sun_size;
|
2020-07-13 01:49:25 +02:00
|
|
|
float sun_intensity;
|
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
|
|
|
float sun_elevation;
|
|
|
|
float sun_rotation;
|
2020-07-13 01:49:25 +02:00
|
|
|
float altitude;
|
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
|
|
|
float air_density;
|
|
|
|
float dust_density;
|
|
|
|
float ozone_density;
|
2019-04-17 06:17:24 +02:00
|
|
|
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;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class OutputNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(OutputNode)
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void *surface;
|
|
|
|
void *volume;
|
|
|
|
float3 displacement;
|
|
|
|
float3 normal;
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Don't allow output node de-duplication. */
|
|
|
|
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);
|
|
|
|
|
|
|
|
float value;
|
|
|
|
float3 color;
|
|
|
|
|
|
|
|
ustring name;
|
|
|
|
|
2020-03-24 01:27:38 +01:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_4;
|
|
|
|
}
|
|
|
|
|
2019-12-04 19:57:28 +01:00
|
|
|
/* Don't allow output node de-duplication. */
|
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int slot;
|
|
|
|
bool is_color;
|
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class GradientTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GradientTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeGradientType type;
|
|
|
|
float3 vector;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class NoiseTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(NoiseTextureNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-09-04 17:54:32 +02:00
|
|
|
int dimensions;
|
2020-03-26 14:43:53 +01:00
|
|
|
float w, scale, detail, roughness, distortion;
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 vector;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class VoronoiTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VoronoiTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-11-13 08:03:44 +01:00
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
int result = ShaderNode::get_feature();
|
|
|
|
if (dimensions == 4) {
|
|
|
|
result |= NODE_FEATURE_VORONOI_EXTRA;
|
|
|
|
}
|
|
|
|
else if (dimensions >= 2 && feature == NODE_VORONOI_SMOOTH_F1) {
|
|
|
|
result |= NODE_FEATURE_VORONOI_EXTRA;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2019-09-12 13:09:31 +02:00
|
|
|
int dimensions;
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeVoronoiDistanceMetric metric;
|
|
|
|
NodeVoronoiFeature feature;
|
2019-09-12 13:09:31 +02:00
|
|
|
float w, scale, exponent, smoothness, randomness;
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 vector;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class MusgraveTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MusgraveTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-09-09 21:06:55 +02:00
|
|
|
int dimensions;
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeMusgraveType type;
|
2019-09-09 21:06:55 +02:00
|
|
|
float w, scale, detail, dimension, lacunarity, offset, gain;
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 vector;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class WaveTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(WaveTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeWaveType type;
|
2020-02-17 12:31:38 +01:00
|
|
|
NodeWaveBandsDirection bands_direction;
|
|
|
|
NodeWaveRingsDirection rings_direction;
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeWaveProfile profile;
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2020-03-26 14:43:53 +01:00
|
|
|
float scale, distortion, detail, detail_scale, detail_roughness, phase;
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 vector;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class MagicTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MagicTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
int depth;
|
|
|
|
float3 vector;
|
|
|
|
float scale, distortion;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2012-01-08 14:55:43 +00:00
|
|
|
class CheckerTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CheckerTextureNode)
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 vector, color1, color2;
|
|
|
|
float scale;
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2012-01-08 14:55:43 +00:00
|
|
|
};
|
|
|
|
|
2012-09-04 13:29:07 +00:00
|
|
|
class BrickTextureNode : public TextureNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BrickTextureNode)
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float offset, squash;
|
|
|
|
int offset_frequency, squash_frequency;
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color1, color2, mortar;
|
|
|
|
float scale, mortar_size, mortar_smooth, bias, brick_width, row_height;
|
|
|
|
float3 vector;
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2012-09-04 13:29:07 +00:00
|
|
|
};
|
|
|
|
|
2015-07-18 22:09:20 +02:00
|
|
|
class PointDensityTextureNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(PointDensityTextureNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
2020-03-24 01:27:38 +01:00
|
|
|
return NODE_GROUP_LEVEL_4;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
~PointDensityTextureNode();
|
|
|
|
ShaderNode *clone() const;
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-05-02 15:45:31 +02:00
|
|
|
/* Parameters. */
|
2019-04-17 06:17:24 +02:00
|
|
|
ustring filename;
|
|
|
|
NodeTexVoxelSpace space;
|
|
|
|
InterpolationType interpolation;
|
|
|
|
Transform tfm;
|
|
|
|
float3 vector;
|
|
|
|
|
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;
|
|
|
|
|
2019-04-17 06:17:24 +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;
|
2019-04-17 06:17:24 +02: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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(IESLightNode)
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
~IESLightNode();
|
|
|
|
ShaderNode *clone() const;
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ustring filename;
|
|
|
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float strength;
|
|
|
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
private:
|
|
|
|
LightManager *light_manager;
|
|
|
|
int slot;
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void get_slot();
|
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
|
|
|
};
|
|
|
|
|
2019-08-21 20:04:09 +02:00
|
|
|
class WhiteNoiseTextureNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(WhiteNoiseTextureNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
|
|
|
|
|
|
|
int dimensions;
|
|
|
|
float3 vector;
|
|
|
|
float w;
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class MappingNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MappingNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2019-09-04 23:17:13 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-09-04 23:17:13 +02:00
|
|
|
float3 vector, location, rotation, scale;
|
|
|
|
NodeMappingType type;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2016-05-29 12:24:47 +02:00
|
|
|
class RGBToBWNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(RGBToBWNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color;
|
2016-05-29 12:24:47 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class ConvertNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
ConvertNode(SocketType::Type from, SocketType::Type to, bool autoconvert = false);
|
|
|
|
SHADER_NODE_BASE_CLASS(ConvertNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2015-12-23 21:41:59 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
SocketType::Type from, to;
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
union {
|
|
|
|
float value_float;
|
|
|
|
int value_int;
|
|
|
|
float3 value_color;
|
|
|
|
float3 value_vector;
|
|
|
|
float3 value_point;
|
|
|
|
float3 value_normal;
|
|
|
|
};
|
|
|
|
ustring value_string;
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
private:
|
|
|
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
BsdfBaseNode(const NodeType *node_type);
|
2017-04-21 12:50:04 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return closure;
|
|
|
|
}
|
|
|
|
virtual bool has_bump();
|
2017-08-20 17:36:16 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
|
|
|
{
|
|
|
|
/* TODO(sergey): With some care BSDF nodes can be de-duplicated. */
|
|
|
|
return false;
|
|
|
|
}
|
2017-08-20 17:36:16 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ClosureType closure;
|
2017-04-21 12:50:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class BsdfNode : public BsdfBaseNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
explicit BsdfNode(const NodeType *node_type);
|
|
|
|
SHADER_NODE_BASE_CLASS(BsdfNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void compile(SVMCompiler &compiler,
|
|
|
|
ShaderInput *param1,
|
|
|
|
ShaderInput *param2,
|
|
|
|
ShaderInput *param3 = NULL,
|
|
|
|
ShaderInput *param4 = NULL);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color;
|
|
|
|
float3 normal;
|
|
|
|
float surface_mix_weight;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2014-06-08 12:16:28 +02:00
|
|
|
class AnisotropicBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AnisotropicBsdfNode)
|
2014-06-08 12:16:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 tangent;
|
|
|
|
float roughness, anisotropy, rotation;
|
|
|
|
ClosureType distribution;
|
2014-06-08 12:16:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return distribution;
|
|
|
|
}
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DiffuseBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(DiffuseBsdfNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(PrincipledBsdfNode)
|
|
|
|
|
2019-05-12 14:39:30 +02:00
|
|
|
void expand(ShaderGraph *graph);
|
2019-04-17 06:17:24 +02:00
|
|
|
bool has_surface_bssrdf();
|
|
|
|
bool has_bssrdf_bump();
|
|
|
|
void compile(SVMCompiler &compiler,
|
|
|
|
ShaderInput *metallic,
|
|
|
|
ShaderInput *subsurface,
|
|
|
|
ShaderInput *subsurface_radius,
|
|
|
|
ShaderInput *specular,
|
|
|
|
ShaderInput *roughness,
|
|
|
|
ShaderInput *specular_tint,
|
|
|
|
ShaderInput *anisotropic,
|
|
|
|
ShaderInput *sheen,
|
|
|
|
ShaderInput *sheen_tint,
|
|
|
|
ShaderInput *clearcoat,
|
|
|
|
ShaderInput *clearcoat_roughness,
|
|
|
|
ShaderInput *ior,
|
|
|
|
ShaderInput *transmission,
|
|
|
|
ShaderInput *anisotropic_rotation,
|
|
|
|
ShaderInput *transmission_roughness);
|
|
|
|
|
|
|
|
float3 base_color;
|
|
|
|
float3 subsurface_color, subsurface_radius;
|
|
|
|
float metallic, subsurface, specular, roughness, specular_tint, anisotropic, sheen, sheen_tint,
|
|
|
|
clearcoat, clearcoat_roughness, ior, transmission, anisotropic_rotation,
|
|
|
|
transmission_roughness;
|
|
|
|
float3 normal, clearcoat_normal, tangent;
|
|
|
|
float surface_mix_weight;
|
|
|
|
ClosureType distribution, distribution_orig;
|
|
|
|
ClosureType subsurface_method;
|
2019-05-12 14:39:30 +02:00
|
|
|
float3 emission;
|
|
|
|
float alpha;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
bool has_integrator_dependency();
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TranslucentBsdfNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TransparentBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TransparentBsdfNode)
|
2012-12-12 06:51:06 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
bool has_surface_transparent()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class VelvetBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VelvetBsdfNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float sigma;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class GlossyBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GlossyBsdfNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void simplify_settings(Scene *scene);
|
|
|
|
bool has_integrator_dependency();
|
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return distribution;
|
|
|
|
}
|
2015-11-18 18:47:56 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float roughness, roughness_orig;
|
|
|
|
ClosureType distribution, distribution_orig;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class GlassBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GlassBsdfNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void simplify_settings(Scene *scene);
|
|
|
|
bool has_integrator_dependency();
|
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return distribution;
|
|
|
|
}
|
2015-11-18 18:47:56 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float roughness, roughness_orig, IOR;
|
|
|
|
ClosureType distribution, distribution_orig;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2012-11-06 19:59:02 +00:00
|
|
|
class RefractionBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(RefractionBsdfNode)
|
2012-11-06 19:59:02 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void simplify_settings(Scene *scene);
|
|
|
|
bool has_integrator_dependency();
|
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return distribution;
|
|
|
|
}
|
2015-11-18 18:47:56 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float roughness, roughness_orig, IOR;
|
|
|
|
ClosureType distribution, distribution_orig;
|
2012-11-06 19:59:02 +00:00
|
|
|
};
|
|
|
|
|
2013-05-23 17:45:20 +00:00
|
|
|
class ToonBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ToonBsdfNode)
|
2013-05-23 17:45:20 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float smooth, size;
|
|
|
|
ClosureType component;
|
2013-05-23 17:45:20 +00:00
|
|
|
};
|
|
|
|
|
2013-04-01 20:26:52 +00:00
|
|
|
class SubsurfaceScatteringNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SubsurfaceScatteringNode)
|
|
|
|
bool has_surface_bssrdf()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_bssrdf_bump();
|
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return falloff;
|
|
|
|
}
|
|
|
|
|
|
|
|
float scale;
|
|
|
|
float3 radius;
|
|
|
|
float sharpness;
|
|
|
|
float texture_blur;
|
|
|
|
ClosureType falloff;
|
2013-04-01 20:26:52 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class EmissionNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(EmissionNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
bool has_surface_emission()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_volume_support()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color;
|
|
|
|
float strength;
|
|
|
|
float surface_mix_weight;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BackgroundNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BackgroundNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color;
|
|
|
|
float strength;
|
|
|
|
float surface_mix_weight;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
class HoldoutNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HoldoutNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
|
|
|
virtual ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return CLOSURE_HOLDOUT_ID;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float surface_mix_weight;
|
|
|
|
float volume_mix_weight;
|
2011-08-28 13:55:59 +00:00
|
|
|
};
|
|
|
|
|
2012-11-06 19:59:02 +00:00
|
|
|
class AmbientOcclusionNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AmbientOcclusionNode)
|
|
|
|
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
|
|
|
virtual bool has_raytrace()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
float3 color;
|
|
|
|
float distance;
|
|
|
|
float3 normal;
|
|
|
|
int samples;
|
|
|
|
|
|
|
|
bool only_local;
|
|
|
|
bool inside;
|
2012-11-06 19:59:02 +00:00
|
|
|
};
|
|
|
|
|
2011-09-27 20:03:16 +00:00
|
|
|
class VolumeNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
VolumeNode(const NodeType *node_type);
|
|
|
|
SHADER_NODE_BASE_CLASS(VolumeNode)
|
|
|
|
|
|
|
|
void compile(SVMCompiler &compiler, ShaderInput *param1, ShaderInput *param2);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
return ShaderNode::get_feature() | NODE_FEATURE_VOLUME;
|
|
|
|
}
|
|
|
|
virtual ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return closure;
|
|
|
|
}
|
|
|
|
virtual bool has_volume_support()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
float3 color;
|
|
|
|
float density;
|
|
|
|
float volume_mix_weight;
|
|
|
|
ClosureType closure;
|
|
|
|
|
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
|
|
|
{
|
|
|
|
/* 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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AbsorptionVolumeNode)
|
2011-09-27 20:03:16 +00:00
|
|
|
};
|
|
|
|
|
2013-12-28 01:54:44 +01:00
|
|
|
class ScatterVolumeNode : public VolumeNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ScatterVolumeNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float anisotropy;
|
2011-09-27 20:03:16 +00:00
|
|
|
};
|
|
|
|
|
2018-01-30 15:05:19 +01:00
|
|
|
class PrincipledVolumeNode : public VolumeNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(PrincipledVolumeNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ustring density_attribute;
|
|
|
|
ustring color_attribute;
|
|
|
|
ustring temperature_attribute;
|
|
|
|
|
|
|
|
float anisotropy;
|
|
|
|
float3 absorption_color;
|
|
|
|
float emission_strength;
|
|
|
|
float3 emission_color;
|
|
|
|
float blackbody_intensity;
|
|
|
|
float3 blackbody_tint;
|
|
|
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(PrincipledHairBsdfNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
|
|
|
|
/* Longitudinal roughness. */
|
|
|
|
float roughness;
|
|
|
|
/* Azimuthal roughness. */
|
|
|
|
float radial_roughness;
|
|
|
|
/* Randomization factor for roughnesses. */
|
|
|
|
float random_roughness;
|
|
|
|
/* Longitudinal roughness factor for only the diffuse bounce (shiny undercoat). */
|
|
|
|
float coat;
|
|
|
|
/* Index of reflection. */
|
|
|
|
float ior;
|
|
|
|
/* Cuticle tilt angle. */
|
|
|
|
float offset;
|
|
|
|
/* Direct coloring's color. */
|
|
|
|
float3 color;
|
|
|
|
/* Melanin concentration. */
|
|
|
|
float melanin;
|
|
|
|
/* Melanin redness ratio. */
|
|
|
|
float melanin_redness;
|
|
|
|
/* Dye color. */
|
|
|
|
float3 tint;
|
|
|
|
/* Randomization factor for melanin quantities. */
|
|
|
|
float random_color;
|
|
|
|
/* Absorption coefficient (unfiltered). */
|
|
|
|
float3 absorption_coefficient;
|
|
|
|
|
|
|
|
float3 normal;
|
|
|
|
float surface_mix_weight;
|
|
|
|
/* If linked, here will be the given random number. */
|
|
|
|
float random;
|
|
|
|
/* Selected coloring parametrization. */
|
|
|
|
NodePrincipledHairParametrization parametrization;
|
2018-07-18 11:14:43 +02:00
|
|
|
};
|
|
|
|
|
2013-09-15 23:58:00 +00:00
|
|
|
class HairBsdfNode : public BsdfNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HairBsdfNode)
|
|
|
|
ClosureType get_closure_type()
|
|
|
|
{
|
|
|
|
return component;
|
|
|
|
}
|
2013-09-15 23:58:00 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ClosureType component;
|
|
|
|
float offset;
|
|
|
|
float roughness_u;
|
|
|
|
float roughness_v;
|
|
|
|
float3 tangent;
|
2013-09-15 23:58:00 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class GeometryNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GeometryNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
int get_group();
|
|
|
|
|
|
|
|
float3 normal_osl;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TextureCoordinateNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TextureCoordinateNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
float3 normal_osl;
|
|
|
|
bool from_dupli;
|
|
|
|
bool use_transform;
|
|
|
|
Transform ob_tfm;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2014-04-02 11:40:29 +02:00
|
|
|
class UVMapNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(UVMapNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ustring attribute;
|
|
|
|
bool from_dupli;
|
2014-04-02 11:40:29 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class LightPathNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(LightPathNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2012-05-07 20:24:38 +00:00
|
|
|
class LightFalloffNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(LightFalloffNode)
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float strength;
|
|
|
|
float smooth;
|
2012-05-07 20:24:38 +00:00
|
|
|
};
|
|
|
|
|
2012-05-21 12:52:28 +00:00
|
|
|
class ObjectInfoNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ObjectInfoNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2012-05-21 12:52:28 +00:00
|
|
|
};
|
|
|
|
|
2012-06-08 16:17:57 +00:00
|
|
|
class ParticleInfoNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ParticleInfoNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2012-06-08 16:17:57 +00:00
|
|
|
};
|
|
|
|
|
2012-12-28 14:21:30 +00:00
|
|
|
class HairInfoNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HairInfoNode)
|
|
|
|
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
return ShaderNode::get_feature() | NODE_FEATURE_HAIR;
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
ustring layer_name;
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class ValueNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ValueNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2015-12-06 23:47:38 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float value;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ColorNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ColorNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2015-12-06 23:47:38 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 value;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class AddClosureNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AddClosureNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MixClosureNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MixClosureNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float fac;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2012-11-26 21:59:41 +00:00
|
|
|
class MixClosureWeightNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MixClosureWeightNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float weight;
|
|
|
|
float fac;
|
2012-11-26 21:59:41 +00:00
|
|
|
};
|
|
|
|
|
2011-12-03 23:05:35 +00:00
|
|
|
class InvertNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(InvertNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float fac;
|
|
|
|
float3 color;
|
2011-12-03 23:05:35 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class MixNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MixNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeMix type;
|
|
|
|
bool use_clamp;
|
|
|
|
float3 color1;
|
|
|
|
float3 color2;
|
|
|
|
float fac;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-12-01 21:46:10 +00:00
|
|
|
class CombineRGBNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CombineRGBNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float r, g, b;
|
2011-12-01 21:46:10 +00:00
|
|
|
};
|
|
|
|
|
2013-07-03 23:46:56 +00:00
|
|
|
class CombineHSVNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CombineHSVNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float h, s, v;
|
2013-07-03 23:46:56 +00:00
|
|
|
};
|
|
|
|
|
2014-06-13 21:44:48 +02:00
|
|
|
class CombineXYZNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CombineXYZNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float x, y, z;
|
2014-06-13 21:44:48 +02:00
|
|
|
};
|
|
|
|
|
2011-12-16 20:35:06 +00:00
|
|
|
class GammaNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GammaNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color;
|
|
|
|
float gamma;
|
2011-12-16 20:35:06 +00:00
|
|
|
};
|
|
|
|
|
2012-01-24 16:32:31 +00:00
|
|
|
class BrightContrastNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BrightContrastNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color;
|
|
|
|
float bright;
|
|
|
|
float contrast;
|
2012-01-24 16:32:31 +00:00
|
|
|
};
|
|
|
|
|
2011-12-01 21:46:10 +00:00
|
|
|
class SeparateRGBNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SeparateRGBNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color;
|
2011-12-01 21:46:10 +00:00
|
|
|
};
|
|
|
|
|
2013-07-03 23:46:56 +00:00
|
|
|
class SeparateHSVNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SeparateHSVNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 color;
|
2013-07-03 23:46:56 +00:00
|
|
|
};
|
|
|
|
|
2014-06-13 21:44:48 +02:00
|
|
|
class SeparateXYZNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SeparateXYZNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 vector;
|
2014-06-13 21:44:48 +02:00
|
|
|
};
|
|
|
|
|
2011-12-02 16:57:37 +00:00
|
|
|
class HSVNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HSVNode)
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float hue;
|
|
|
|
float saturation;
|
|
|
|
float value;
|
|
|
|
float fac;
|
|
|
|
float3 color;
|
2011-12-02 16:57:37 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class AttributeNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AttributeNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ustring attribute;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-12-02 20:36:13 +00:00
|
|
|
class CameraNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CameraNode)
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2011-12-02 20:36:13 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class FresnelNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(FresnelNode)
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 normal;
|
|
|
|
float IOR;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class LayerWeightNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(LayerWeightNode)
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 normal;
|
|
|
|
float blend;
|
2011-09-16 13:14:02 +00:00
|
|
|
};
|
|
|
|
|
2013-05-20 15:58:37 +00:00
|
|
|
class WireframeNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(WireframeNode)
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2015-12-15 21:56:27 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float size;
|
|
|
|
bool use_pixel_size;
|
2013-05-20 15:58:37 +00:00
|
|
|
};
|
|
|
|
|
2013-06-09 20:46:22 +00:00
|
|
|
class WavelengthNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(WavelengthNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float wavelength;
|
2013-06-09 20:46:22 +00:00
|
|
|
};
|
|
|
|
|
2013-07-31 20:56:32 +00:00
|
|
|
class BlackbodyNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BlackbodyNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float temperature;
|
2013-07-31 20:56:32 +00:00
|
|
|
};
|
|
|
|
|
2019-08-13 16:29:32 +02:00
|
|
|
class MapRangeNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MapRangeNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2019-08-14 10:53:19 +02:00
|
|
|
void expand(ShaderGraph *graph);
|
|
|
|
|
2019-12-07 12:35:07 +00:00
|
|
|
float value, from_min, from_max, to_min, to_max, steps;
|
|
|
|
NodeMapRangeType type;
|
2019-08-14 10:53:19 +02:00
|
|
|
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);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
|
|
|
float value, min, max;
|
2019-12-07 12:35:07 +00:00
|
|
|
NodeClampType type;
|
2019-08-13 22:22:15 +02:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class MathNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MathNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2019-08-18 11:16:04 +02:00
|
|
|
void expand(ShaderGraph *graph);
|
2019-04-17 06:17:24 +02:00
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float value1;
|
|
|
|
float value2;
|
Maths Node: Additional functions
When creating shaders and using maths functions it is expected that Blender should match functions in other DCC applications, game engines and shading languages such as GLSL and OSL.
This patch adds missing functions to the Blender maths node.
Ideally, it would be nice to have these functions available to vectors too but that is not part of this patch.
This patch adds the following functions trunc, snap, wrap, compare, pingpong, sign, radians, degrees, cosh, sinh, tanh, exp, smoothmin and inversesqrt.
Sign function is based on GLSL and OSL functions and returns zero when x == 0.
Differential Revision: https://developer.blender.org/D5957
2019-12-05 23:02:05 +00:00
|
|
|
float value3;
|
2019-08-18 11:16:04 +02:00
|
|
|
NodeMathType type;
|
2019-04-17 06:17:24 +02:00
|
|
|
bool use_clamp;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-12-16 18:15:07 +00:00
|
|
|
class NormalNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(NormalNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_2;
|
|
|
|
}
|
2011-12-16 18:15:07 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 direction;
|
|
|
|
float3 normal;
|
2011-12-16 18:15:07 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class VectorMathNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorMathNode)
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float3 vector1;
|
|
|
|
float3 vector2;
|
2020-02-14 21:46:10 +00:00
|
|
|
float3 vector3;
|
Shading: Add more operators to Vector Math node.
Add Multiply, Divide, Project, Reflect, Distance, Length, Scale, Snap,
Floor, Ceil, Modulo, Fraction, Absolute, Minimum, and Maximum operators
to the Vector Math node. The Value output has been removed from operators
whose output is a vector, and the other way around. All of those removals
has been handled properly in versioning code.
The patch doesn't include tests for the new operators. Tests will be added
in a later patch.
Reviewers: brecht, JacquesLucke
Differential Revision: https://developer.blender.org/D5523
2019-08-21 19:36:33 +02:00
|
|
|
float scale;
|
|
|
|
NodeVectorMathType 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)
|
|
|
|
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
|
|
|
NodeVectorRotateType type;
|
2020-02-25 14:52:01 +00:00
|
|
|
bool invert;
|
2020-02-17 15:15:46 +00:00
|
|
|
float3 vector;
|
|
|
|
float3 center;
|
|
|
|
float3 axis;
|
|
|
|
float angle;
|
|
|
|
float3 rotation;
|
|
|
|
};
|
|
|
|
|
2013-07-31 21:18:23 +00:00
|
|
|
class VectorTransformNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorTransformNode)
|
2013-07-31 21:18:23 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeVectorTransformType type;
|
|
|
|
NodeVectorTransformConvertSpace convert_from;
|
|
|
|
NodeVectorTransformConvertSpace convert_to;
|
|
|
|
float3 vector;
|
2013-07-31 21:18:23 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class BumpNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BumpNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
return NODE_FEATURE_BUMP;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool invert;
|
|
|
|
bool use_object_space;
|
|
|
|
float height;
|
|
|
|
float sample_center;
|
|
|
|
float sample_x;
|
|
|
|
float sample_y;
|
|
|
|
float3 normal;
|
|
|
|
float strength;
|
|
|
|
float distance;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2016-06-21 00:19:51 +02:00
|
|
|
class CurvesNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
explicit CurvesNode(const NodeType *node_type);
|
|
|
|
SHADER_NODE_BASE_CLASS(CurvesNode)
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
2015-06-01 17:48:45 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
array<float3> curves;
|
|
|
|
float min_x, max_x, fac;
|
|
|
|
float3 value;
|
2016-07-30 23:30:36 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
protected:
|
|
|
|
using ShaderNode::constant_fold;
|
|
|
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(RGBCurvesNode)
|
|
|
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorCurvesNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
2012-12-11 14:39:37 +00:00
|
|
|
};
|
|
|
|
|
2012-03-26 12:45:14 +00:00
|
|
|
class RGBRampNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(RGBRampNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_1;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
array<float3> ramp;
|
|
|
|
array<float> ramp_alpha;
|
|
|
|
float fac;
|
|
|
|
bool interpolate;
|
2012-03-26 12:45:14 +00:00
|
|
|
};
|
|
|
|
|
2012-10-10 15:56:43 +00:00
|
|
|
class SetNormalNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SetNormalNode)
|
|
|
|
float3 direction;
|
2012-10-10 15:56:43 +00:00
|
|
|
};
|
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
class OSLNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
static OSLNode *create(size_t num_inputs, const OSLNode *from = NULL);
|
|
|
|
~OSLNode();
|
2016-05-29 15:10:34 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ShaderNode *clone() const;
|
2016-06-18 12:30:59 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
char *input_default_value();
|
|
|
|
void add_input(ustring name, SocketType::Type type);
|
|
|
|
void add_output(ustring name, SocketType::Type type);
|
2016-05-07 19:48:28 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
SHADER_NODE_NO_CLONE_CLASS(OSLNode)
|
2014-04-03 22:04:39 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* ideally we could beter detect this, but we can't query this now */
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_volume_support()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2017-10-11 15:21:26 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
virtual bool equals(const ShaderNode & /*other*/)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-03 22:04:39 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
string filepath;
|
|
|
|
string bytecode_hash;
|
2012-11-03 14:32:35 +00:00
|
|
|
};
|
|
|
|
|
2012-11-06 19:59:02 +00:00
|
|
|
class NormalMapNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(NormalMapNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
|
|
|
|
|
|
|
NodeNormalMapSpace space;
|
|
|
|
ustring attribute;
|
|
|
|
float strength;
|
|
|
|
float3 color;
|
|
|
|
float3 normal_osl;
|
2012-11-06 19:59:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TangentNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TangentNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
|
|
|
|
|
|
|
NodeTangentDirectionType direction_type;
|
|
|
|
NodeTangentAxis axis;
|
|
|
|
ustring attribute;
|
|
|
|
float3 normal_osl;
|
2012-11-06 19:59:02 +00:00
|
|
|
};
|
|
|
|
|
2017-08-18 18:37:05 +02:00
|
|
|
class BevelNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BevelNode)
|
|
|
|
bool has_spatial_varying()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual int get_group()
|
|
|
|
{
|
|
|
|
return NODE_GROUP_LEVEL_3;
|
|
|
|
}
|
|
|
|
virtual bool has_raytrace()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
float radius;
|
|
|
|
float3 normal;
|
|
|
|
int samples;
|
2017-08-18 18:37:05 +02:00
|
|
|
};
|
|
|
|
|
2018-01-13 13:11:03 +01:00
|
|
|
class DisplacementNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(DisplacementNode)
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
return NODE_FEATURE_BUMP;
|
|
|
|
}
|
2018-01-13 13:11:03 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
NodeNormalMapSpace space;
|
|
|
|
float height;
|
|
|
|
float midlevel;
|
|
|
|
float scale;
|
|
|
|
float3 normal;
|
2018-01-13 13:11:03 +01:00
|
|
|
};
|
|
|
|
|
2018-01-21 00:40:42 +01:00
|
|
|
class VectorDisplacementNode : public ShaderNode {
|
2019-04-17 06:17:24 +02:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorDisplacementNode)
|
|
|
|
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
|
|
|
bool has_attribute_dependency()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
void constant_fold(const ConstantFolder &folder);
|
|
|
|
virtual int get_feature()
|
|
|
|
{
|
|
|
|
return NODE_FEATURE_BUMP;
|
|
|
|
}
|
|
|
|
|
|
|
|
NodeNormalMapSpace space;
|
|
|
|
ustring attribute;
|
|
|
|
float3 vector;
|
|
|
|
float midlevel;
|
|
|
|
float scale;
|
2018-01-21 00:40:42 +01:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
#endif /* __NODES_H__ */
|