VisualShaderNodeVectorScalarSmoothStep in Godot 4: Identifier not declared in the current scope
By Eduardo Orellana · Updated
VisualShaderNodeVectorScalarSmoothStep does not exist in Godot 4: use VisualShaderNodeSmoothStep and set its op_type to OP_TYPE_VECTOR_3D_SCALAR. A Godot 3 script that names the old class fails to parse with Identifier "VisualShaderNodeVectorScalarSmoothStep" not declared in the current scope, and Godot 4.7.2 adds Did you mean to use "VisualShaderNodeSmoothStep"?
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
When GDScript loads a script it resolves every identifier. VisualShaderNodeVectorScalarSmoothStep is not a class in Godot 4, so the analyzer stops with Identifier not declared in the current scope and none of the script runs.
Before it reports the error, the analyzer looks the name up in the Godot 3 to 4 renames table, as long as the project setting debug/gdscript/warnings/renamed_in_godot_4_hint is on. That table maps VisualShaderNodeVectorScalarSmoothStep to VisualShaderNodeSmoothStep, which is where Did you mean to use "VisualShaderNodeSmoothStep"? comes from.
Godot 4 has one SmoothStep node whose op_type picks the port types. With OP_TYPE_VECTOR_3D_SCALAR, port 2 (x) is a 3D vector and edge0 and edge1 stay scalars: the fix printed 0.0 and 1.0 for the edges and (0.5, 0.5, 0.5) for x.
The node generates one line of shader code, a call to smoothstep(edge0, edge1, x). The fix printed it as vec3 n_out2p0 = smoothstep(n_in2p0, n_in2p1, n_in2p2); once the node was connected to the output node.
More on this: StreamCubemapArray in Godot 4: Identifier not declared in the current scope
Reproduce it
A Godot 3 script that builds a vector-scalar smoothstep node in code, in a Godot 4 project. The scene is one Node with this script.
extends Node
func _ready():
var node = VisualShaderNodeVectorScalarSmoothStep.new()
print(node)
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
SCRIPT ERROR: Parse Error: Identifier "VisualShaderNodeVectorScalarSmoothStep" not declared in the current scope. Did you mean to use "VisualShaderNodeSmoothStep"?
at: GDScript::reload (res://answers/visualshadernodevectorscalarsmoothstep-in-godot-4/repro.gd:4)
ERROR: Failed to load script "res://answers/visualshadernodevectorscalarsmoothstep-in-godot-4/repro.gd" with error "Parse error".
at: load (modules/gdscript/gdscript_resource_format.cpp:46)Fix it
Make a VisualShaderNodeSmoothStep and set op_type to OP_TYPE_VECTOR_3D_SCALAR, so x takes a 3D vector and the two edges take scalars. The script prints each input port default, connects the node to the output node, and prints the line of shader code it generates.
extends Node
func _ready() -> void:
var node := VisualShaderNodeSmoothStep.new()
node.op_type = VisualShaderNodeSmoothStep.OP_TYPE_VECTOR_3D_SCALAR
for port in 3:
print("port ", port, " default: ", node.get_input_port_default_value(port))
var shader := VisualShader.new()
shader.add_node(VisualShader.TYPE_FRAGMENT, node, Vector2.ZERO, 2)
shader.connect_nodes(VisualShader.TYPE_FRAGMENT, 2, 0, VisualShader.NODE_ID_OUTPUT, 0)
for line in shader.code.split("
"):
if line.contains("smoothstep"):
print(line.strip_edges())
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
port 0 default: 0.0
port 1 default: 1.0
port 2 default: (0.5, 0.5, 0.5)
vec3 n_out2p0 = smoothstep(n_in2p0, n_in2p1, n_in2p2);Verified on Godot 4.7.2
Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 6 October 2026, and the output above is what Godot printed, unedited.
Where the check lives in Godot's source: [gdscript_analyzer.cpp lines 4684 to 4687, the rename hint and the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_analyzer.cpp#L4684), [renames_map_3_to_4.cpp line 1642, VisualShaderNodeVectorScalarSmoothStep to VisualShaderNodeSmoothStep](https://github.com/godotengine/godot/blob/4.7.2-stable/editor/project_upgrade/renames_map_3_to_4.cpp#L1642), [visual_shader_nodes.cpp line 4403, OP_TYPE_VECTOR_3D_SCALAR makes port x a 3D vector](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/visual_shader/vs_nodes/visual_shader_nodes.cpp#L4403), [visual_shader_nodes.cpp line 4515, the generated smoothstep call](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/visual_shader/vs_nodes/visual_shader_nodes.cpp#L4515), [VisualShaderNodeSmoothStep class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/visual_shader/doc_classes/VisualShaderNodeSmoothStep.xml).
Questions
- What became of VisualShaderNodeScalarSmoothStep and VisualShaderNodeVectorSmoothStep?
- The Godot 3 to 4 renames table sends both to VisualShaderNodeSmoothStep too. Set op_type to OP_TYPE_SCALAR for the scalar node, and to OP_TYPE_VECTOR_3D for the vector one, where all three ports are 3D vectors.
- Are there 2D and 4D versions?
- Yes, on the same node. The class reference lists OP_TYPE_VECTOR_2D, OP_TYPE_VECTOR_2D_SCALAR, OP_TYPE_VECTOR_4D and OP_TYPE_VECTOR_4D_SCALAR beside the 3D ones.
- What does smoothstep return?
- The class reference says it returns 0.0 if x is smaller than edge0 and 1.0 if x is larger than edge1, and otherwise interpolates between 0.0 and 1.0 using Hermite polynomials.
Related
- StreamTexture in Godot 4: it is CompressedTexture2D now
- Spatial in Godot 4: it is Node3D now, and translation is position
- Every verified Godot 4 answer
- Identifier "…" not declared in the current scope in Godot 4
- Cannot get return value of call to "…()" because it returns "void" in Godot 4
- Sprite in Godot 4: it is Sprite2D now
- StreamCubemapArray in Godot 4: Identifier not declared in the current scope
- Trying to return a value of type "…" from a function whose return type is "…" in Godot 4
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free