0
Not a bug

Interference between active windows

Cédric Sophie 9 years ago updated by Freya Holmér (Developer) 9 years ago 5
Hello all,
First thing, thank you Joachim for Shader Forge, it's a incredibly efficient tool.

I got a strange issue when trying to color the shadow part of a dot product. When the shader forge window is active, the result in the game tab is correct but when the unity editor window is active the result is unpredictable and it remains in that state if I close the shader forge window.

Here is the node tree:
Image 324
and the shader file
I tried many work around with lerps, ceil, etc but the issue remained.

I use unity 4.6.1f1 on a pc with windows 8.1 and the latest catalyst drivers.

Answer

Answer
Not a bug
Unreal and Unity may be passing light source data in different ways.
Like you said, you probably need to explicitly define light position and light color using code in this case, sadly.
Under review
Glad you like SF, and thanks :)

So, lerping an NdotL is not an easy task, due to the way forward rendering works. The popping/difference you're getting is most likely due to light count culling/switching. The tricky part of doing it with a point light, is that in these cases, you either do the lerp based on a single directional light, or you don't do it at all. As you can see in the first one, it goes yellow, which means it probably rendered green+red in the same location.
I don't think I had this king of issue with the unreal engine.
I still don't understand the switch of state if there is only one point light in the scene.
So there is no real solution to lerp an NdotL in unity when using a point light?
The alternative way that I see is to get rid of the lights and use only positions and vectors in the shader which needs a bit mode scripting.
Answer
Not a bug
Unreal and Unity may be passing light source data in different ways.
Like you said, you probably need to explicitly define light position and light color using code in this case, sadly.
Thank you for the answer. That confirms my intuition, that'll be even more useful on iOS and Android.
Keep up the good work on shader forge, you rock!
Hah, thanks! Keep up the good work with what you're doing as well!