Shader Nodes Reference / Blender
To some extent, Verge3D supports almost all nodes provided by Blender's Shader Editor. However, for most tasks of web-based real-time graphics it is sufficient to use just a limited set of them. Below we only list the nodes that are used in stock Verge3D demos.
Inputs and outputs that are supported by Verge3D are marked with green check mark, while unsupported ones are marked with red one.
Contents
- Shader Nodes
- Output Nodes
- Input Nodes
- Texture Nodes
- Color Nodes
- Vector Nodes
- Converter Nodes
- Script Node
- World-Specific Nodes
- Performance Considerations
Shader Nodes
These nodes are in the core of any material, performing shading calculations for the object surface. Among them, the following nodes are used the most in Verge3D workflow:
Principled BSDF
This universal node implements the physically-based rendering model (aka PBR). Suitable for creating most materials for Verge3D.
By tweaking just a few options in the Principled BSDF node, you can quickly setup various good-looking materials. For best results, you might use an environment texture which provides reflections and image-based lighting, or just use the default cube template where the environment is set up for you.
See more information on the Principled BSDF node in Blender Manual: link.
Diffuse BSDF
This node implements the diffuse component of PBR. It is used for adding baked ambient occlusion to materials, or sometimes combined with Glossy BSDF node for more flexibility compared to Principled BSDF node.
In the following example, Diffuse BSDF is used to add baked ambient occlusion to chrome material:
See more information on the Diffuse BSDF node in Blender Manual: link.
Glossy BSDF
This node implements the specular component of PBR. It is used for purely metallic surfaces, or sometimes combined with Diffuse BSDF node for more flexibility.
See more information on the Glossy BSDF node in Blender Manual: link.
Emission
This node is used to represent unlit (shadeless) objects. It is also used to represent glowing objects when combined with the bloom post-effect in Verge3D.
In the following simplified example, Emission is used for shadeless UI icons:
See more information on the Emission node in Blender Manual: link.
Transparent BSDF
This node implements transparent materials by mixing with other Shader nodes such as Glossy BSDF.
This node is supported partially. It resembles Blender's viewport better if
you follow these restrictions:
- the Color input should be strictly white (R = 1, G = 1, B = 1)
- the node should be used at the very end of a node tree, i.e. just
before the Material Output through a Mix Shader or an Add Shader
node (see the example below), or directly plugged into the Surface socket
of Material Output
In the following simplified example, Transparent BSDF is used for the material of front glass:
See more information on the Transparent BSDF node in Blender Manual: link.
Refraction BSDF
This node implements refractive materials by using the environment map for refraction.
Below is a simple usage example:
See more information on the Refraction BSDF node in Blender Manual: link.
Glass BSDF
This node implements the specular and the refraction components of PBR.
See more information on the Glass BSDF node in Blender Manual: link.
Translucent BSDF
This node implements the translucency effect.
See more information on the Translucent BSDF node in Blender Manual: link.
Add Shader
This node sums up two shaders together.
See more information on the Add Shader node in Blender Manual: link.
Mix Shader
This node mixes two shaders together.
See more information on the Mix Shader node in Blender Manual: link.
Output Nodes
These nodes are the end point in a shader. For Object materials, only the following node is available (there is also a special output node for World materials):
Material Output
This node provide shading results for the surface point.
See more information on the Material Output node in Blender Manual: link.
Input Nodes
These nodes provide various input information to the shader. Among them, the following nodes are used the most in Verge3D workflow:
Geometry
This node provides geometrical information (in world space) for the shaded point. At the moment, Verge3D supports only Position, Normal, Tangent, Incoming and Backfacing sockets.
See more information on the Geometry node in Blender Manual: link.
Attribute
This node retrieves mesh attributes. Only vertex colors are supported by Verge3D at the moment.
See more information on the Attribute node in Blender Manual: link.
Texture Coordinate
This node provides UV-mapped or procedurely assigned coordinates for texturing. Verge3D takes the first UV layer from the list of UV layers available on the mesh.
See more information on the Texture Coordinate node in Blender Manual: link.
UV Map
This node retrieves the specified UV layer from mesh. Unlike the Texture Coordinate node, this node works with any UV layer available on the mesh.
See more information on the UV Map node in Blender Manual: link.
Fresnel
This node computes the proportion of light reflected vs refracted.
See more information on the Fresnel node in Blender Manual: link.
Layer Weight
This node provides a mix factor thats depends on the direction upon which the object surface is observed.
See more information on the Layer Weight node in Blender Manual: link.
RGB
This node provides a color value to the shader.
See more information on the RGB node in Blender Manual: link.
Value
This node provides a numeric value to the shader.
See more information on the Value node in Blender Manual: link.
Camera Data
This node provides information about objects position relative to the camera.
See more information on the Camera Data node in Blender Manual: link.
Tangent
This node provides tangent directions. If Direction Type is set to "UV Map" then the tangents will be calculated from the mesh's active UV layer rather than from the UV layer specified in the node itself (this parameter is not supported).
See more information on the Tangent node in Blender Manual: link.
Vertex Color (Color Attribute)
This node provides vertex color values.
See more information on the Vertex Color node in Blender Manual: link.
Object Info
This node passes various object parameters to the shader.
See more information on the Object Info node in Blender Manual: link.
Texture Nodes
These nodes provide bitmaps to the shader. Among them, the following nodes are used the most in Verge3D workflow:
Checker Texture
This node provides a bitmap with checker patterns.
See more information on the Checker Texture node in Blender Manual: link.
Image Texture
This node provides an image file to be used as texture in the shader.
Some options are supported partially
- interpolation modes: Linear, Closest are only supported
- image source: Single Image, Generated are only supported
- color space: Linear, sRGB are only supported
See more information on the Image Texture node in Blender Manual: link.
Verge3D Settings
There are custom Verge3D settings that you can assign on image textures:
- Anisotropic Filtering
- Ratio of anisotropic filtering applied to the texture. Anisotropic filtering is a technique for improving quality of textured surfaces that are at oblique viewing angles, like ground, walls, furniture, packaging boxes, etc. Higher values provide better quality at the expense of slightly reduced rendering performance.
- Texture Compression
- Texture compression method. Check out the texture compression section for more info.
Gradient Texture
This node provides a smoothly changing range of colors and intensities.
See more information on the Gradient Texture node in Blender Manual: link.
Voronoi Texture
This node provides a bitmap with Voronoi patterns.
Only 3D dimension is supported, which also means no support for the W input
See more information on the Voronoi Texture node in Blender Manual: link.
Noise Texture
This node provides a bitmap with noise patterns.
Only 3D dimension is supported, which also means no support for the W input
See more information on the Noise Texture node in Blender Manual: link.
Verge3D Settings
There are custom Verge3D settings that you can assign on noise textures:
- Falloff Factor
- How much the noise falls off with distance and for acute angles. Specify some value >0 to mitigate noise aliasing artifacts.
- Strength Factor
- Noise strength factor. Specify value <1 to decrease the noise intensity.
Wave Texture
This node provides a bitmap with wave patterns.
See more information on the Wave Texture node in Blender Manual: link.
Color Nodes
These nodes provides various operations on colors. Among them, the following nodes are used the most in Verge3D workflow:
Bright/Contrast
This node is used to change birghtness and contrast of the color input.
See more information on the Bright/Contrast node in Blender Manual: link.
Hue Saturation Value
This node is used to transform the color input in the HSV space.
See more information on the Hue Saturation Value node in Blender Manual: link.
Mix
This node mixes two color inputs together using various blending modes.
See more information on the Mix node in Blender Manual: link.
RGB Curves
This node is used for color correction and level adjustment.
See more information on the RGB Curves node in Blender Manual: link.
Invert
This node inverts the color input producing a negative.
See more information on the Invert node in Blender Manual: link.
Gamma
This node applies gamma correction to the color input.
See more information on the Gamma node in Blender Manual: link.
Vector Nodes
These nodes provides various operations on vectors. Among them, the following nodes are used the most in Verge3D workflow:
Bump
This node generates a bump map.
See more information on the Bump node in Blender Manual: link.
Mapping
This node is used to transform a bitmap, including shifting, rotation and scale.
See more information on the Mapping node in Blender Manual: link.
Normal
This node is used to define a normal vector and to generate a dot product.
See more information on the Normal node in Blender Manual: link.
Normal Map
This node provides the normal vector from a bitmap interpreted as normal map.
Only Tangent Space is supported
See more information on the Normal Map node in Blender Manual: link.
Vector Curves
This node is used to map the input vector to a curve.
See more information on the Vector Curves node in Blender Manual: link.
Vector Rotate
This node is used for rotating the input vector around a pivot point.
See more information on the Vector Rotate node in Blender Manual: link.
Vector Transform
This node is used to convert an input vector between world, camera or object coordinate spaces.
See more information on the Vector Transform node in Blender Manual: link.
Converter Nodes
These nodes provides means for converting between data of various types. Among them, the following nodes are used the most in Verge3D workflow:
Clamp
This node clamps the input value to be in the specified range.
Only Min Max clamp type is supported
See more information on the Clamp node in Blender Manual: link.
Color Ramp
This node converts values to colors by using a gradient.
Some options are supported partially
- color mode: only RGB is supported
- interpolation: Linear, Constant
See more information on the Color Ramp node in Blender Manual: link.
Map Range
This node is used to transform a value from one range to another.
See more information on the Map Range node in Blender Manual: link.
Shader to RGB
This node replaces shading calculation results with plain color. Typically used for non-photorealistic rendering.
See more information on the Shader to RGB node in Blender Manual: link.
RGB to BW
This node converts color to black and white imagery by using luminance.
See more information on the RGB to BW node in Blender Manual: link.
Math
This node performs mathematical operations with numeric values:
- Add, Subtract, Multiply, Divide, Multiply and Add, Power, Logarithm, Square Root, Inverse Square Root, Absolute
- Minimum, Maximum, Less Than, Greater Than, Sign, Compare, Smooth Minimum, Smooth Maximum
- Round, Floor, Ceil, Truncate, Fraction, Modulo, Wrap, Snap, Ping-pong
- Sine, Cosine, Tangent, Arcsine, Arccosine, Arctangent, 2-Argument Arctangent, Hyperbolic Sine, Hyperbolic Cosine, Hyperbolic Tangent
- Convert to Radians, Convert to Degrees
See more information on the Math node in Blender Manual: link.
Vector Math
This node performs operations with vectors:
- Add, Subtract, Multiply, Divide
- Cross Product, Project, Reflect, Dot Product
- Distance, Length, Scale, Normalize
- Absolute, Minimum, Maximum, Floor, Ceil, Fraction, Modulo, Wrap, Snap
- Sine, Cosine, Tangent
See more information on the Vector Math node in Blender Manual: link.
Combine/Separate Nodes
These nodes compose a color/vector from, or split it to, the individual channels.
See more information on the Combine and Separate nodes in Blender Manual: link.
Script Node
This node allows custom shaders written in OSL to be used in your materials.
For example, to draw the digits material:
you can use the following node setup:
This examples illustrates the power of the OSL shaders. You can change or animate all the parameters (UVW, Number, Digits, Decimals, Scale, BGColor, OnColor, OffColor, UseOffColor) in runtime! The digits.osl shader would be:
// A shader that emulates a 7-segment numerical display
// Digits.osl by Zap Andersson
// Modified: 2019-11-25
// Copyright 2019 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt
int inBit(vector pt, point start, point end)
{
if (pt[0] > start[0] && pt[0] < end[0] &&
pt[1] > start[1] && pt[1] < end[1])
return 1;
return 0;
}
int inDigit(vector in, int digit, int dp, int ms)
{
vector pt = in;
pt -= point(0.5, 0.2, 0.0);
pt *= 2.5;
pt += point(0.5, 0.2, 0.0);
if (ms && inBit(pt, point(-0.9, 0.9, 0.0), point(-0.2, 1.1, 0.0)))
return 1;
if (pt[0] < -0.1 || pt[1] < -0.1 || pt[0] > 1.3 || pt[1] > 2.1)
return -1;
if (dp && inBit(pt, point(1.15, -0.1, 0.0), point(1.3, 0.1, 0))) {
return 1;
}
if (inBit(pt, point(0.1, -0.1, 0.0), point(0.9, 0.1, 0.0))) {
if (digit == 2 || digit == 3 || digit == 5 || digit == 6
|| digit == 8 || digit == 9 || digit == 0)
return 1;
else
return 0;
}
if (inBit(pt, point(0.1, 0.9, 0.0), point(0.9, 1.1, 0.0))) {
if (digit == 2 || digit == 3 || digit == 4 || digit == 5
|| digit == 6 || digit == 8 || digit == 9)
return 1;
else
return 0;
}
if (inBit(pt, point(0.1, 1.9, 0.0), point(0.9, 2.1, 0.0))) {
if (digit == 2 || digit == 3 || digit == 5 || digit == 6
|| digit == 7 || digit == 8 || digit == 9 || digit == 0)
return 1;
else
return 0;
}
if (inBit(pt, point(-0.1, 0.1, 0.0), point(0.1, 0.9, 0.0))) {
if (digit == 2 || digit == 6 || digit == 8 || digit == 0)
return 1;
else
return 0;
}
if (inBit(pt, point(-0.1, 1.1, 0.0), point(0.1, 1.9, 0.0))) {
if (digit == 4 || digit == 5 || digit == 6 || digit == 8
|| digit == 9 || digit == 0)
return 1;
else
return 0;
}
if (inBit(pt, point(0.9, 0.1, 0.0), point(1.1, 0.9, 0.0))) {
if (digit == 1 || digit == 3 || digit == 4 || digit == 5
|| digit == 6 || digit == 7 || digit == 8 || digit == 9
|| digit == 0)
return 1;
else
return 0;
}
if (inBit(pt, point(0.9, 1.1, 0.0), point(1.1, 1.9, 0.0))) {
if (digit == 1 || digit == 2 || digit == 3 || digit == 4
|| digit == 7 || digit == 8 || digit == 9 || digit == 0)
return 1;
else
return 0;
}
return -1;
}
shader Digits
[[string help =
"A shader that emulates a 7-Segment display of numbers.
Useful for debugging and showing numbers in SME",
string category = "Textures"]]
(vector UVW = vector(u, v, 0),
float Number = 42,
int Digits = 2[[int min = 2, int max = 8]],
int Decimals = 0[[int min = 0, int max = 6]],
float Scale = 1.0,
color BGColor = 0.0,
color OnColor = color(1, 0, 0),
color OffColor = color(0.1, 0.0, 0.0),
int UseOffColor = 1
[[string widget = "checkBox", string label = "Use OffColor"]],
output color Out = BGColor,
output float Fac = 0.0,
output float NumberOut = Number[[string label = "Number"]]
) {
int mult[9] =
{ 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
point px = UVW / Scale;
int number = int (Number * mult[Decimals]);
int minus = 0;
if (number < 0) {
number = -number;
minus = 1;
}
int digits = Digits;
// Figure out how many digits we need
int leftOfDecimalPoint = (int (floor(log(fabs(Number), 10.0)))) +1;
// ...but at least one
if (leftOfDecimalPoint <= 0)
leftOfDecimalPoint = 1;
int maxdigi = leftOfDecimalPoint + Decimals;
if (maxdigi > digits)
digits = maxdigi;
if (px[0] > 0 && px[0] < 1 && px[1] > 0 && px[1] < 1) {
px -= point(0.9, 0.5, 0.0);
px *= (digits * 0.8);
px += point(0.9, 0.5, 0.0);
for (int i = 0; i < digits; i++) {
int x = inDigit(px, int (number) % 10, Decimals == i, minus
&& i == digits - 1);
if (x == 0 && UseOffColor) {
Out = OffColor;
Fac = 1.0;
}
if (x == 1) {
Out = OnColor;
Fac = 1.0;
}
number /= 10;
px += point(0.6, 0.0, 0.0);
}
}
}
Script node is not supported by Blender Eevee, you should use Blender Cycles or Verge3D to preview it.
World-Specific Nodes
These nodes are either available only for World materials (Background, World Output), or typically used with World materials (Environment Texture, Light Path, Sky Texture):
Background
This node is used for setting up the background color, as well as for image-based lighting and reflections. It is rarely used on its own as it would produce just a solid color. You might combine with an environment texture for best results.
See more information on the Background node in Blender Manual: link.
World Output
This node is the end point of World materials. It represents shading results for the environment.
See more information on the World Output node in Blender Manual: link.
Environment Texture
This node provides an image file to be used as environment texture in the shader. The images must be in equirectangular projection, and should typically be HDR, although JPEG or PNG formats can be used as well.
The default cube template includes an HDR image which you may reuse in your projects.
Some options are supported partially
- interpolation mode: Linear, Closest
- image source: Single Image, Generated
- color space: Linear, sRGB
In the following example, a JPEG image is used to provide image-based lighting, reflections and the background, all at once.
See more information on the Environment Texture node in Blender Manual: link.
Verge3D Settings
There is a custom Verge3D setting that you can assign on environment textures:
- Texture Compression
- Texture compression method. Check out the texture compression section for more info.
Light Path
This node provides various information of Boolean type to the shader. The Is Camera Ray output is supported by Verge3D with the purpose to control whether the environment texture is visible in the background.
The following typical setup is used to provide environment lighting and reflections to the scene yet just render a white solid color in the background:
See more information on the Light Path node in Blender Manual: link.
Sky Texture
This node provides a procedurally generated skydome texture.
See more information on the Sky Texture node in Blender Manual: link.
Performance Considerations
Principled BSDF Performance
Being the most frequently used node, Principled BSDF nevertheless require more computing power from your GPU and slows down application loading. This is especially true if you have lots of such materials in your scene.
There are several ways to optimize Principled-based materials:
- Replace Principled BSDF by Diffuse BSDF for non-specular or non-metallic surfaces.
- Replace Principled BSDF by Glossy BSDF for pure metallic materials.
- Replace Principled BSDF by Emission if you render color-only materials.
- Tweak Cubemap Size or IBL Env. Mode property to improve environment lighting performance.
- Switch to glTF 2.0 model.
Keep in mind, that the last two methods will make your materials look differently compared to Blender viewport.
Slow Procedural Textures
There are procedural textures that have reduced performance:
- Noise Texture, especially with high Detail property (16 is the performance killer).
- Voronoi Texture. Use F1 as feature parameter as it works much better than any other.
You can bake these textures to bitmaps and use the Image Texture node to achieve much better results.
Got Questions?
Feel free to ask on the forums!