opgjoh / VisualShaderImportToGodot4Bug

Minimal Project showcasing a bug in the import of Visual Shaders

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VisualShaderImportToGodot4Bug

Minimal Project showcasing a bug in the import of Visual Shaders

Bug Description

It appears that under certain conditions, the import of a Visual Shader attached to a node in a Godot 3.5.1 project causes an error in the conversion.

It appears that the issue lies with the fact that in Godot 3, Texture offered both a "Color" and "Alpha" output, whereas in Godot 4, the latter is considered a component of the former (which makes perfect sense). Because of this, any connection from the "Alpha" output is now lost and, worse, there seems to be an error (see below). The error message seems to suggest that it tries to connect the second (index=1) port, which was "Alpha" beforehand, which no longer exists.

  scene/resources/visual_shader.cpp:723 - Condition "g->nodes.has(p_id)" is true.
  scene/resources/visual_shader.cpp:723 - Condition "g->nodes.has(p_id)" is true.
  scene/resources/visual_shader.cpp:723 - Condition "g->nodes.has(p_id)" is true.
  scene/resources/visual_shader.cpp:723 - Condition "g->nodes.has(p_id)" is true.
  scene/resources/visual_shader.cpp:970 - Index p_from_port = 1 is out of bounds (g->nodes[p_from_node].node->get_expanded_output_port_count() = 1).

Here are screenshots of the Visual Shaders as they appear. In the Godot 4-screenshot, I have moved the Nodes slightly to ensure they fit the screenshot, their positions were as imported (just their size is now different)

Godot 3.5.1: VS_G3

Godot 4, RC2: VS_G4

About the Repository

This Repository contains a tiny project to see this bug. The Folder "Godot3_to_4_vsBug" contains the Godot 3.5.1 project, and the folder "Godot3_to_4_vsBug - InGodot4" contains the project after importing and converting to Godot 4. Open Scene "Demo.tscn", which holds a simple "TextureRect" (as a child of one control node) with a Visual Shader that showcases this problem.

About

Minimal Project showcasing a bug in the import of Visual Shaders