Facepunch / sbox-issues

181 stars 12 forks source link

[Shadergraph] Unintended behaviour with multiple 2d texture nodes and blend/lerp node #7473

Closed eEight-dev closed 1 week ago

eEight-dev commented 1 week ago

Describe the bug

If you have 2 texture nodes hooked up to a blend/lerp node and set the Fraction of the blend to 1, then in material editor you can only set the texture of the 2nd node, however if you change the fraction to 0.99 then you can set the textures to both of the nodes.

To Reproduce

  1. Create a node setup like this

Image

  1. Set the blend fraction to value of 1
  2. Open material editor and select the generated shader

Image

  1. Notice how only the image hooked up to the B input is available
  2. Change the fraction to 0.99 and notice that both are now available

Expected behavior

Both should be available at all times.

Media/Files

No response

Additional context

No response

CarsonKompon commented 1 week ago

This is because that is compiled as a number value instead of an attribute, and since it compiles to 1.0 the A branch is never called and thus never compiled. Basically an optimization.

If you were to make a "Constant > Float" node and set it's value to 1.0 and hooked it up that should display both since it's referencing a variable that can actually change.