2023-09-01 20:46:12 +02:00
|
|
|
# SPDX-FileCopyrightText: 2022-2023 Blender Authors
|
|
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
from bpy.types import Menu
|
|
|
|
|
from bl_ui import node_add_menu
|
|
|
|
|
from bpy.app.translations import (
|
2024-06-13 12:15:55 +02:00
|
|
|
contexts as i18n_contexts,
|
2023-09-01 20:46:12 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:07:34 -04:00
|
|
|
# only show input/output nodes when editing line style node trees
|
|
|
|
|
def line_style_shader_nodes_poll(context):
|
|
|
|
|
snode = context.space_data
|
|
|
|
|
return (snode.tree_type == 'ShaderNodeTree' and
|
|
|
|
|
snode.shader_type == 'LINESTYLE')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# only show nodes working in world node trees
|
|
|
|
|
def world_shader_nodes_poll(context):
|
|
|
|
|
snode = context.space_data
|
|
|
|
|
return (snode.tree_type == 'ShaderNodeTree' and
|
|
|
|
|
snode.shader_type == 'WORLD')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# only show nodes working in object node trees
|
|
|
|
|
def object_shader_nodes_poll(context):
|
|
|
|
|
snode = context.space_data
|
|
|
|
|
return (snode.tree_type == 'ShaderNodeTree' and
|
|
|
|
|
snode.shader_type == 'OBJECT')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def cycles_shader_nodes_poll(context):
|
|
|
|
|
return context.engine == 'CYCLES'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def eevee_shader_nodes_poll(context):
|
2024-10-30 13:20:00 +11:00
|
|
|
return context.engine == 'BLENDER_EEVEE_NEXT'
|
2023-09-01 23:07:34 -04:00
|
|
|
|
|
|
|
|
|
2023-09-21 16:38:01 +02:00
|
|
|
def object_not_eevee_shader_nodes_poll(context):
|
2023-09-01 23:07:34 -04:00
|
|
|
return (object_shader_nodes_poll(context) and
|
2023-09-21 16:38:01 +02:00
|
|
|
not eevee_shader_nodes_poll(context))
|
2023-09-01 23:07:34 -04:00
|
|
|
|
|
|
|
|
|
2023-09-21 16:38:01 +02:00
|
|
|
def object_eevee_shader_nodes_poll(context):
|
2023-09-01 23:07:34 -04:00
|
|
|
return (object_shader_nodes_poll(context) and
|
2023-09-21 16:38:01 +02:00
|
|
|
eevee_shader_nodes_poll(context))
|
2023-09-01 23:07:34 -04:00
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_input(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_input"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Input"
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeAmbientOcclusion")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeAttribute")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeBevel")
|
Nodes: support searching for outputs of various input nodes directly
Previously, one had to search for the name of an input node (Geometry, Light
Path, etc.) instead of for the actual desired values.
This patch makes it possible to search for the output names of various input
nodes directly. All other outputs of the input node are hidden automatically.
This was partially support for the Scene Time before.
Supported nodes:
* Compositor: Scene Time
* Geometry Nodes: Camera Info, Mouse Position, Scene Time, Viewport Transform
* Shader Nodes: Camera Data, Curves Info, Geometry, Volume Info, Light Path,
Object Info, Particle Info
Right now, the output names are hardcoded in the menu. We don't have a great way
to access those without an actual node instance currently. For that we'll need
to make the node declarations available in Python, which is a good project but
out of scope for this this feature. It also does not seem too bad to have more
explicit control over what's shown in the search.
Pull Request: https://projects.blender.org/blender/blender/pulls/139477
2025-05-28 05:41:37 +02:00
|
|
|
node_add_menu.add_node_type_with_outputs(
|
|
|
|
|
context, layout, "ShaderNodeCameraData", [
|
|
|
|
|
"View Vector", "View Z Depth", "View Distance"])
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeVertexColor")
|
Nodes: support searching for outputs of various input nodes directly
Previously, one had to search for the name of an input node (Geometry, Light
Path, etc.) instead of for the actual desired values.
This patch makes it possible to search for the output names of various input
nodes directly. All other outputs of the input node are hidden automatically.
This was partially support for the Scene Time before.
Supported nodes:
* Compositor: Scene Time
* Geometry Nodes: Camera Info, Mouse Position, Scene Time, Viewport Transform
* Shader Nodes: Camera Data, Curves Info, Geometry, Volume Info, Light Path,
Object Info, Particle Info
Right now, the output names are hardcoded in the menu. We don't have a great way
to access those without an actual node instance currently. For that we'll need
to make the node declarations available in Python, which is a good project but
out of scope for this this feature. It also does not seem too bad to have more
explicit control over what's shown in the search.
Pull Request: https://projects.blender.org/blender/blender/pulls/139477
2025-05-28 05:41:37 +02:00
|
|
|
node_add_menu.add_node_type_with_outputs(
|
|
|
|
|
context, layout, "ShaderNodeHairInfo", [
|
|
|
|
|
"Is Strand", "Intercept", "Length", "Thickness", "Tangent Normal", "Random"])
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeFresnel")
|
Nodes: support searching for outputs of various input nodes directly
Previously, one had to search for the name of an input node (Geometry, Light
Path, etc.) instead of for the actual desired values.
This patch makes it possible to search for the output names of various input
nodes directly. All other outputs of the input node are hidden automatically.
This was partially support for the Scene Time before.
Supported nodes:
* Compositor: Scene Time
* Geometry Nodes: Camera Info, Mouse Position, Scene Time, Viewport Transform
* Shader Nodes: Camera Data, Curves Info, Geometry, Volume Info, Light Path,
Object Info, Particle Info
Right now, the output names are hardcoded in the menu. We don't have a great way
to access those without an actual node instance currently. For that we'll need
to make the node declarations available in Python, which is a good project but
out of scope for this this feature. It also does not seem too bad to have more
explicit control over what's shown in the search.
Pull Request: https://projects.blender.org/blender/blender/pulls/139477
2025-05-28 05:41:37 +02:00
|
|
|
node_add_menu.add_node_type_with_outputs(context,
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeNewGeometry",
|
|
|
|
|
["Position",
|
|
|
|
|
"Normal",
|
|
|
|
|
"Tangent",
|
|
|
|
|
"True Normal",
|
|
|
|
|
"Incoming",
|
|
|
|
|
"Parametric",
|
|
|
|
|
"Backfacing",
|
|
|
|
|
"Pointiness",
|
|
|
|
|
"Random Per Island"])
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeLayerWeight")
|
Nodes: support searching for outputs of various input nodes directly
Previously, one had to search for the name of an input node (Geometry, Light
Path, etc.) instead of for the actual desired values.
This patch makes it possible to search for the output names of various input
nodes directly. All other outputs of the input node are hidden automatically.
This was partially support for the Scene Time before.
Supported nodes:
* Compositor: Scene Time
* Geometry Nodes: Camera Info, Mouse Position, Scene Time, Viewport Transform
* Shader Nodes: Camera Data, Curves Info, Geometry, Volume Info, Light Path,
Object Info, Particle Info
Right now, the output names are hardcoded in the menu. We don't have a great way
to access those without an actual node instance currently. For that we'll need
to make the node declarations available in Python, which is a good project but
out of scope for this this feature. It also does not seem too bad to have more
explicit control over what's shown in the search.
Pull Request: https://projects.blender.org/blender/blender/pulls/139477
2025-05-28 05:41:37 +02:00
|
|
|
node_add_menu.add_node_type_with_outputs(context,
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeLightPath",
|
|
|
|
|
["Is Camera Ray",
|
|
|
|
|
"Is Shadow Ray",
|
|
|
|
|
"Is Diffuse Ray",
|
|
|
|
|
"Is Glossy Ray",
|
|
|
|
|
"Is Singular Ray",
|
|
|
|
|
"Is Reflection Ray",
|
|
|
|
|
"Is Transmission Ray",
|
|
|
|
|
"Is Volume Scatter Ray",
|
|
|
|
|
"Ray Length",
|
|
|
|
|
"Ray Depth",
|
|
|
|
|
"Diffuse Depth",
|
|
|
|
|
"Glossy Depth",
|
|
|
|
|
"Transparent Depth",
|
|
|
|
|
"Transmission Depth"])
|
|
|
|
|
node_add_menu.add_node_type_with_outputs(
|
|
|
|
|
context, layout, "ShaderNodeObjectInfo", [
|
|
|
|
|
"Location", "Color", "Alpha", "Object Index", "Material Index", "Random"])
|
|
|
|
|
node_add_menu.add_node_type_with_outputs(
|
|
|
|
|
context, layout, "ShaderNodeParticleInfo", [
|
|
|
|
|
"Index", "Random", "Age", "Lifetime", "Location", "Size", "Velocity", "Angular Velocity"])
|
2025-05-28 08:34:04 +02:00
|
|
|
node_add_menu.add_node_type_with_outputs(context, layout, "ShaderNodePointInfo",
|
|
|
|
|
["Position", "Radius", "Random"])
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeRGB")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTangent")
|
2025-05-28 08:34:04 +02:00
|
|
|
node_add_menu.add_node_type_with_outputs(context, layout, "ShaderNodeTexCoord",
|
|
|
|
|
["Normal", "UV", "Object", "Camera", "Window", "Reflection"])
|
2023-09-03 15:48:30 +10:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeUVAlongStroke", poll=line_style_shader_nodes_poll(context))
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeUVMap")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeValue")
|
Nodes: support searching for outputs of various input nodes directly
Previously, one had to search for the name of an input node (Geometry, Light
Path, etc.) instead of for the actual desired values.
This patch makes it possible to search for the output names of various input
nodes directly. All other outputs of the input node are hidden automatically.
This was partially support for the Scene Time before.
Supported nodes:
* Compositor: Scene Time
* Geometry Nodes: Camera Info, Mouse Position, Scene Time, Viewport Transform
* Shader Nodes: Camera Data, Curves Info, Geometry, Volume Info, Light Path,
Object Info, Particle Info
Right now, the output names are hardcoded in the menu. We don't have a great way
to access those without an actual node instance currently. For that we'll need
to make the node declarations available in Python, which is a good project but
out of scope for this this feature. It also does not seem too bad to have more
explicit control over what's shown in the search.
Pull Request: https://projects.blender.org/blender/blender/pulls/139477
2025-05-28 05:41:37 +02:00
|
|
|
node_add_menu.add_node_type_with_outputs(context, layout, "ShaderNodeVolumeInfo",
|
|
|
|
|
["Color", "Density", "Flame", "Temperature"])
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeWireframe")
|
|
|
|
|
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_output(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_output"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Output"
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
2023-09-03 15:48:30 +10:00
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeOutputMaterial",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeOutputLight",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_not_eevee_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeOutputAOV",
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeOutputWorld",
|
|
|
|
|
poll=world_shader_nodes_poll(context),
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeOutputLineStyle",
|
|
|
|
|
poll=line_style_shader_nodes_poll(context),
|
|
|
|
|
)
|
2023-09-01 20:46:12 +02:00
|
|
|
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_shader(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_shader"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Shader"
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
2023-09-03 15:48:30 +10:00
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeAddShader",
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBackground",
|
|
|
|
|
poll=world_shader_nodes_poll(context),
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
2024-08-27 17:20:46 +02:00
|
|
|
"ShaderNodeBsdfMetallic",
|
|
|
|
|
poll=object_shader_nodes_poll(context),
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
2023-09-03 15:48:30 +10:00
|
|
|
"ShaderNodeBsdfDiffuse",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeEmission",
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfGlass",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfGlossy",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfHair",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_not_eevee_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeHoldout",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeMixShader",
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfPrincipled",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfHairPrincipled",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_not_eevee_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeVolumePrincipled"
|
|
|
|
|
)
|
2024-04-29 12:37:51 +02:00
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfRayPortal",
|
|
|
|
|
poll=object_not_eevee_shader_nodes_poll(context),
|
|
|
|
|
)
|
2023-09-03 15:48:30 +10:00
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfRefraction",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfSheen",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_not_eevee_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeEeveeSpecular",
|
|
|
|
|
poll=object_eevee_shader_nodes_poll(context),
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeSubsurfaceScattering",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfToon",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_not_eevee_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfTranslucent",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeBsdfTransparent",
|
2023-09-21 16:38:01 +02:00
|
|
|
poll=object_shader_nodes_poll(context),
|
2023-09-03 15:48:30 +10:00
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeVolumeAbsorption",
|
|
|
|
|
)
|
|
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeVolumeScatter",
|
|
|
|
|
)
|
2025-05-08 19:19:35 +02:00
|
|
|
node_add_menu.add_node_type(
|
|
|
|
|
layout,
|
|
|
|
|
"ShaderNodeVolumeCoefficients",
|
|
|
|
|
)
|
2023-09-01 20:46:12 +02:00
|
|
|
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_color(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_color"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Color"
|
|
|
|
|
|
2025-05-09 04:02:50 +02:00
|
|
|
def draw(self, context):
|
2023-09-01 20:46:12 +02:00
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeBrightContrast")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeGamma")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeHueSaturation")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeInvert")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeLightFalloff")
|
2025-05-09 04:02:50 +02:00
|
|
|
node_add_menu.add_color_mix_node(context, layout)
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeRGBCurve")
|
|
|
|
|
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_converter(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_converter"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Converter"
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeBlackbody")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeClamp")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeValToRGB")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeCombineColor")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeCombineXYZ")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeFloatCurve")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeMapRange")
|
2025-05-08 04:28:22 +02:00
|
|
|
node_add_menu.add_node_type_with_searchable_enum(context, layout, "ShaderNodeMath", "operation")
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeMix")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeRGBToBW")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeSeparateColor")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeSeparateXYZ")
|
2023-09-03 15:48:30 +10:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeShaderToRGB", poll=object_eevee_shader_nodes_poll(context))
|
2025-05-08 04:28:22 +02:00
|
|
|
node_add_menu.add_node_type_with_searchable_enum(context, layout, "ShaderNodeVectorMath", "operation")
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeWavelength")
|
|
|
|
|
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_texture(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_texture"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Texture"
|
|
|
|
|
|
|
|
|
|
def draw(self, _context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexBrick")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexChecker")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexEnvironment")
|
Nodes: Implement Gabor noise
This patch implements a new Gabor noise node based on [1] but with the
improvements from [2] and the phasor formulation from [3].
We compare with the most popular existing implementation, that of OSL,
from the user's point of view:
- This implementation produces C1 continuous noise as opposed to the
non continuous OSL implementation, so it can be used for bump
mapping and is generally smother. This is achieved by windowing the
Gabor kernel using a Hann window.
- The Bandwidth input of OSL was hard-coded to 1 and was replaced with
a frequency input, which OSL hard codes to 2, since frequency is
more natural to control. This is even more true now that that Gabor
kernel is windowed as opposed to truncated, which means increasing
the bandwidth will just turn the Gaussian component of the Gabor
into a Hann window. While decreasing the bandwidth will eliminate
the harmonic from the Gabor kernel, which is the point of Gabor
noise.
- OSL had three discrete modes of operation for orienting the kernel.
Anisotropic, Isotropic, and a hybrid mode. While this implementation
provides a continuous Anisotropy parameter which users are already
familiar with from the Glossy BSDF node.
- This implementation provides not just the Gabor noise value, but
also its phase and intensity components. The Gabor noise value is
basically sin(phase) * intensity, but the phase is arguably more
useful since it does not suffer from the low contrast issues that
Gabor suffers from. While the intensity is useful to hide the
singularities in the phase.
- This implementation converges faster that OSL's relative to the
impulse count, so we fix the impulses count to 8 for simplicitly.
- This implementation does not implement anisotropic filtering.
Future improvements to the node includes implementing surface noise and
filtering. As well as extending the spectral control of the noise,
either by providing specialized kernels as was done in #110802, or by
providing some more procedural control over the frequencies of the
Gabor.
References:
[1]: Lagae, Ares, et al. "Procedural noise using sparse Gabor
convolution." ACM Transactions on Graphics (TOG) 28.3 (2009): 1-10.
[2]: Tavernier, Vincent, et al. "Making gabor noise fast and
normalized." Eurographics 2019-40th Annual Conference of the European
Association for Computer Graphics. 2019.
[3]: Tricard, Thibault, et al. "Procedural phasor noise." ACM
Transactions on Graphics (TOG) 38.4 (2019): 1-13.
Pull Request: https://projects.blender.org/blender/blender/pulls/121820
2024-06-19 09:33:32 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexGabor")
|
2023-09-01 20:46:12 +02:00
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexGradient")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexIES")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexImage")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexMagic")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexNoise")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexPointDensity")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexSky")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexVoronoi")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexWave")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeTexWhiteNoise")
|
|
|
|
|
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_vector(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_vector"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Vector"
|
|
|
|
|
|
|
|
|
|
def draw(self, _context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeBump")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeDisplacement")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeMapping")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeNormal")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeNormalMap")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeVectorCurve")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeVectorDisplacement")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeVectorRotate")
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeVectorTransform")
|
|
|
|
|
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_script(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_script"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Script"
|
|
|
|
|
|
|
|
|
|
def draw(self, _context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
node_add_menu.add_node_type(layout, "ShaderNodeScript")
|
|
|
|
|
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_category_shader_group(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_category_shader_group"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Group"
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
node_add_menu.draw_node_group_add_menu(context, layout)
|
|
|
|
|
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-01 23:36:34 +02:00
|
|
|
class NODE_MT_shader_node_add_all(Menu):
|
|
|
|
|
bl_idname = "NODE_MT_shader_node_add_all"
|
2023-09-01 20:46:12 +02:00
|
|
|
bl_label = "Add"
|
2024-06-13 12:15:55 +02:00
|
|
|
bl_translation_context = i18n_contexts.operator_default
|
2023-09-01 20:46:12 +02:00
|
|
|
|
|
|
|
|
def draw(self, _context):
|
|
|
|
|
layout = self.layout
|
2023-09-01 23:36:34 +02:00
|
|
|
layout.menu("NODE_MT_category_shader_input")
|
|
|
|
|
layout.menu("NODE_MT_category_shader_output")
|
2023-09-01 20:46:12 +02:00
|
|
|
layout.separator()
|
2023-09-01 23:36:34 +02:00
|
|
|
layout.menu("NODE_MT_category_shader_color")
|
|
|
|
|
layout.menu("NODE_MT_category_shader_converter")
|
|
|
|
|
layout.menu("NODE_MT_category_shader_shader")
|
|
|
|
|
layout.menu("NODE_MT_category_shader_texture")
|
|
|
|
|
layout.menu("NODE_MT_category_shader_vector")
|
2023-09-01 20:46:12 +02:00
|
|
|
layout.separator()
|
2023-09-01 23:36:34 +02:00
|
|
|
layout.menu("NODE_MT_category_shader_script")
|
2023-09-01 20:46:12 +02:00
|
|
|
layout.separator()
|
2023-09-01 23:36:34 +02:00
|
|
|
layout.menu("NODE_MT_category_shader_group")
|
2023-09-01 20:46:12 +02:00
|
|
|
layout.menu("NODE_MT_category_layout")
|
|
|
|
|
|
|
|
|
|
node_add_menu.draw_root_assets(layout)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes = (
|
2023-09-01 23:36:34 +02:00
|
|
|
NODE_MT_shader_node_add_all,
|
|
|
|
|
NODE_MT_category_shader_input,
|
|
|
|
|
NODE_MT_category_shader_output,
|
|
|
|
|
NODE_MT_category_shader_color,
|
|
|
|
|
NODE_MT_category_shader_converter,
|
|
|
|
|
NODE_MT_category_shader_shader,
|
|
|
|
|
NODE_MT_category_shader_texture,
|
|
|
|
|
NODE_MT_category_shader_vector,
|
|
|
|
|
NODE_MT_category_shader_script,
|
|
|
|
|
NODE_MT_category_shader_group,
|
2023-09-01 20:46:12 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
|
from bpy.utils import register_class
|
|
|
|
|
for cls in classes:
|
|
|
|
|
register_class(cls)
|