0
Not a bug

Plugging a lerp with a texture connected to it into another texture's UV input causes an incompatible types error

K Perry 9 years ago updated 9 years ago 2
Plugging a lerp with a texture connected to it into another texture's UV input causes an incompatible types error. I'll post an image of the shader I'm using this for at the bottom. I tried getting the effect I wanted in different ways but I could never reproduce it to my satisfaction.


Repro Steps:
1. Start Shader Forge and create two texture 2d nodes, a UV coordinate node, a slider, and a lerp.
2. Name the two texture 2d nodes something (Noise and MainTex in my case)
3. Plug the UV coordinates, noise texture, and the slider into the lerp in descending order.
4. Try plugging the lerp into the UV input on MainTex. (the UV input on MainTex is greyed out)
5. Unplug the Noise from the lerp and plug the lerp into MainTex.
6. Plug Noise back into the lerp.
7. Plug MainTex into emission.
8. Compile the shader.

Result:
You will receive the following error in the console:

Incompatible types: Type A: VTv2 Type B: VTv3
UnityEngine.Debug:LogError(Object)
ShaderForge.SF_NodeConnector:LinkTo(SF_NodeConnector, LinkingMethod, Boolean)
ShaderForge.SF_EditorNodeView:ReconnectConnectedPending()
ShaderForge.SF_Parser:LoadFromNodeData(String, Single, String&)
ShaderForge.SF_Parser:ParseNodeDataFromShader(SF_Editor, Shader)
ShaderForge.SF_Editor:InitializeInstance(Shader)
ShaderForge.SF_Editor:Init(Shader)
ShaderForge.SF_Editor:OpenLoadDialog()
ShaderForge.SF_Editor:<DrawPrimaryMainMenuGUI>b__32()
ShaderForge.SF_Editor:FlexHorizontal(Action)
ShaderForge.SF_Editor:DrawPrimaryMainMenuGUI()
ShaderForge.SF_Editor:DrawMainMenu()
ShaderForge.SF_Editor:OnGUI()
UnityEditor.DockArea:OnGUI()

Just want to say thanks for making such an amazing tool. I'm not a programmer or an artist but it has enabled me to make some great looking effects.

Here's the shader I'm using this with for reference:
Image 437


Answer

Answer
Not a bug
The error in this case is actually correct. I guess the issue is rather that it allows you to make the connection in the first place.

UVs are two-component values, for U and V, not three components. Right before the texture UV input, make a component mask node, and mask out R and G from the lerp output, and use that as UVs instead
Answer
Not a bug
The error in this case is actually correct. I guess the issue is rather that it allows you to make the connection in the first place.

UVs are two-component values, for U and V, not three components. Right before the texture UV input, make a component mask node, and mask out R and G from the lerp output, and use that as UVs instead
That works. Thank you!