Open opgjoh opened 1 year ago
Hi, I have similar problem and I found that for some reason, the curves which connect nodes are duplicated several times and the tres file of the shader bloats from 250KB to 120MB in my case.
I have this problem in 3.5.1
Sadly I was not able to figure out conditions to replicate. Btw here is the shader, if somebody wants to try it out. waterDepth_visualShader.zip
Godot version
4.0rc2
System information
Windows 10
Issue 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 when opening the converted scene in Godot 4. The scene loads, but the resulting shader looks off:
It seems 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 suggests that it tries to connect the second (index=1) port, which was "Alpha" beforehand, which no longer exists.
Here are screenshots of the Visual Shaders as they appear in my Demo-project. 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)
Look in Godot 3.5.1:
VS in Godot 4.0 RC 2:
![VS_G4](https://user-images.githubusercontent.com/58372501/219153332-90862528-bd9b-4907-9495-1084f9a16ff8.PNG)
Note that the whole Vector composing/Decomposing is not necessary for the bug to appear. I just forgot to remove that part before uploading my projects. I have tested it without them, and I still see the error.
Steps to reproduce
In Godot 3.5
In Godot 4.0
Minimal reproduction project
Here is the Godot 3.5.1 Project. When importing it in Godot 4, and then opening the scene "Demo.tscn", the error can be observed. VisualShaderImportToG4Bug.zip
In case the above link does not work for some reason, I have created a small public repository with the Godot 3.5 and Godot 4.0 Project ready :)