Page 1 of 1

Light Color Node

PostPosted: Fri Apr 13, 2018 8:19 pm
by thefallenone
Hey,

I'm having some issues using the Light Color node in Amplify Shader. On one machine, it works fine, and on another, it returns a value of 0 (in exactly the same build) for all outputs.

The machine that it works on is using a GTX 1070, and the one it's not working on is a GTX 970.

Is this a hardware support issue for that particular node? The shader isn't failing to compile, it still runs fine, but returns 0 for the values. If so, is there a way to check for node compatibility beyond a fallback shader (as it's not failing to compile, and so not falling back) at runtime? If not, what else could be causing this?

The code is using the \ASESampleShaders\CustomLightingToon shader, but everything beyond that node works. It is also a VR project, though it works fine in VR on the first machine.

Thanks for any help you guys can provide. :)

Re: Light Color Node

PostPosted: Mon Apr 16, 2018 3:54 pm
by Ricardo Teixeira
thefallenone wrote:Hey,

I'm having some issues using the Light Color node in Amplify Shader. On one machine, it works fine, and on another, it returns a value of 0 (in exactly the same build) for all outputs.

The machine that it works on is using a GTX 1070, and the one it's not working on is a GTX 970.

Is this a hardware support issue for that particular node? The shader isn't failing to compile, it still runs fine, but returns 0 for the values. If so, is there a way to check for node compatibility beyond a fallback shader (as it's not failing to compile, and so not falling back) at runtime? If not, what else could be causing this?

The code is using the \ASESampleShaders\CustomLightingToon shader, but everything beyond that node works. It is also a VR project, though it works fine in VR on the first machine.

Thanks for any help you guys can provide. :)


Hello,

That's an interesting issue, not sure we came across it before.

Can you share the shader for further examination and testing on our side?

Thanks!

Re: Light Color Node

PostPosted: Mon Apr 16, 2018 5:09 pm
by thefallenone
Certainly, I've attached the .shader file here (in zip format) - if you need it in a different format, or need more information, feel free to ask.

I'm using Unity 2018.1.0b13 at the moment, and haven't yet tested it in other versions of Unity, but can do so if it may be relevant.

Re: Light Color Node

PostPosted: Tue Apr 17, 2018 9:54 am
by Amplify_Borba
Thank you for sharing the sample!

We're going to investigate this issue and will get back to you as soon as we have any developments.

Re: Light Color Node

PostPosted: Tue Apr 17, 2018 1:23 pm
by Amplify_Borba
Unfortunately, we haven't been able to replicate the issue on any of our test machines.

Are you able to replicate the issue in a new project with a simple scene?
If so, could you please provide us with that same sample scene with the issue present so that we can further debug it on our side?

Re: Light Color Node

PostPosted: Tue Apr 17, 2018 5:08 pm
by thefallenone
I've made as simple a project as possible - you'll need to open the TestScene scene (in the \Scenes folder) once the project comes up.

Interestingly, now the node is returning 0 on both computers, not just one, and I'm not certain what caused it to change. Hopefully that makes it easier to debug and not more difficult. It works perfectly in the editor, but once you do a "Build" and run it outside of the editor, it stops working.

I removed the Unity Amplify Shader plugin before compressing (didn't want to share the plugin publiclly), so if you want to edit the shader you may need to re-add it manually. It looks like I was on 1.5.2 dev 01.

I couldn't upload the zip here, as it was too large, but I've shared it on DropBox:

https://www.dropbox.com/s/gbffqoj3n1cd2 ... t.zip?dl=0

Re: Light Color Node

PostPosted: Wed Apr 18, 2018 1:45 pm
by Amplify_Borba
Thank you for taking the time to set up a simple project!

Upon investigating the issue it seems that it is caused by a low dynamic light amount set for the used quality setting, which was Fastest by default. By enabling the Display Resolution Dialogue in order to select a higher quality level you can see how Quality Levels other than Fast and Fastest, which had the Pixel Light Count values set to 0, work as intended.

In short, this issue can be solved by increasing the Pixel Light Count in the desired quality levels, by going to Project Settings > Quality, then setting the value to something other than 0.

Please let me know if this helps, thanks!

Re: Light Color Node

PostPosted: Wed Apr 18, 2018 2:01 pm
by thefallenone
Thanks, that does help - though I wonder then if there's a way to modify/branch/switch shaders based on selected graphic quality settings?

At the moment, aside from doing an "if" to check if the output from the light color node is 0 (which feels really hacky), I can't see any easy way to use a different shader path or shader altogether, as the fallback isn't being triggered by this case (it still compiles fine, just doesn't have a light to sample, by the looks of it).

It's always possible I'm missing something obvious, as I'm still very new to Amplify Shader Editor, so hopefully I'm not wasting your time any further. :)

Re: Light Color Node

PostPosted: Wed Apr 18, 2018 2:31 pm
by Amplify_Borba
No problem, happy to help!

You may use Shader LODs and Fallback Shaders that will be used when a certain pass is either missing or unsupported by the main shader, both of which may be set in the Output Node's parameters, or Multi-Compile via Static Switch, however, if you intend to use real time lights you need to set the Pixel Light Count to any value other than 0 in the lowest graphics presets through your project's Quality Settings.

Let me know if you have any further questions!