Skip to content

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.

Download for macOSDownload for WindowsDownload for Linux

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.

GDScript
extends Node

func _ready():
	var node = VisualShaderNodeVectorScalarSmoothStep.new()
	print(node)

What Godot 4.7.2 prints

Output
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.

GDScript
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

Output
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);

Run this fix with your agent

Flockbay is the Godot editor with an AI agent built in. Paste this into Flockbay's chat, or into Claude Code or Codex connected to Flockbay over MCP: the agent finds the cause in your project, applies the fix, runs the game headless and reads Godot's output to check it.

More on this: BitmapFont in Godot 4: it is FontFile now

Prompt
My Godot project was written for Godot 3 and Godot 4 stops on this: "Parse Error: Identifier "VisualShaderNodeVectorScalarSmoothStep" not declared in the current scope. Did you mean to use "VisualShaderNodeSmoothStep"?". Port every use to Godot 4. 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"? Then run the game headless and check Godot's output for errors.

Verified on Godot 4.7.2

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.

Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.

Download Flockbay free