Point Light and Custom Lighting trouble

Node-based Shader Editor
Post Reply
thursdaysrain
Posts: 5
Joined: Fri Sep 07, 2018 9:30 am

Point Light and Custom Lighting trouble

Post by thursdaysrain »

Hello, I'm really enjoying the product so far but I've run into a problem I don't know the source of. My scene consists of a sphere with a material/shader attached to it and a point light. The attached shader is a surface shader with custom lighting, with a texture hooked up to the custom lighting output. Image

What I expect to happen is that only the texture, unmodified by lighting, is displayed on the object. With a directional light this is the case. However, with a point light, the object is strongly tinted white regardless of the color, strength of the light (as long as it is over 0), or range (as long as it is within it). It appears like this both in the editor and the game player windows. Image I haven't been able to find any settings to fix this so far and I was wondering if anyone had any insight.
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Point Light and Custom Lighting trouble

Post by Ricardo Teixeira »

Hello

You'll have to filter any light information required, simply plugging a color or texture node will not prevent it from being affected by the lights. Alternatively, you can plug your texture node directly into the Emission channel. If you intend to use the Custom Lighting port you'll have to create your own unique node-based lighting model through our specific lighting nodes.

Image

Hope it helps!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
thursdaysrain
Posts: 5
Joined: Fri Sep 07, 2018 9:30 am

Re: Point Light and Custom Lighting trouble

Post by thursdaysrain »

Okay! I think I was expecting it to behave differently and I understand what's going on a little better. Thank you very much.
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Point Light and Custom Lighting trouble

Post by Ricardo Teixeira »

thursdaysrain wrote:Okay! I think I was expecting it to behave differently and I understand what's going on a little better. Thank you very much.
No problem, happy to help!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
thursdaysrain
Posts: 5
Joined: Fri Sep 07, 2018 9:30 am

Re: Point Light and Custom Lighting trouble

Post by thursdaysrain »

Hello - Having more trouble in this vein, not sure if I should reply here but I don't want to make excess threads. I apologize if this has more to do with unity lighting knowledge in general and less specifically with Amplify Shader editor, but I've spent about 3 days banging my head against this problem without being able to solve it.

My ultimate goal is to make a shader where point lights "paint" a light color onto the object, which is flatly lit, and the blending between this light color and the object's texture is controlled by the intensity determined by a ramp gradient (pushed through the dither node).

I accomplished the first part,

Image

however - it only works properly with one light. Each additional light runs the shader an additional time, adding the colors together, making them progressively brighter.

Image

I suspect the answer lies in separating the "Base texture" part of the shader from the "lighting" part shader (since they are both piped in through custom lighting). I am unsure how to accomplish this while also maintaining an object with 1:1 colors on the texture, and unblended colors on the light spot.

Is there a way to calculate all of the point lights in one go? Or, a way to have a flat-lit object like in an unlit shader that is still able to be affected by custom lighting?

If this is beyond the scope of Amplify Shader Editor and I should figure it out elsewhere I apologize, thanks for your time.

My shader so far:
Image
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Point Light and Custom Lighting trouble

Post by Ricardo Teixeira »

thursdaysrain wrote:Hello - Having more trouble in this vein, not sure if I should reply here but I don't want to make excess threads. I apologize if this has more to do with unity lighting knowledge in general and less specifically with Amplify Shader editor, but I've spent about 3 days banging my head against this problem without being able to solve it.

My ultimate goal is to make a shader where point lights "paint" a light color onto the object, which is flatly lit, and the blending between this light color and the object's texture is controlled by the intensity determined by a ramp gradient (pushed through the dither node).

I accomplished the first part,

Image

however - it only works properly with one light. Each additional light runs the shader an additional time, adding the colors together, making them progressively brighter.

Image

I suspect the answer lies in separating the "Base texture" part of the shader from the "lighting" part shader (since they are both piped in through custom lighting). I am unsure how to accomplish this while also maintaining an object with 1:1 colors on the texture, and unblended colors on the light spot.

Is there a way to calculate all of the point lights in one go? Or, a way to have a flat-lit object like in an unlit shader that is still able to be affected by custom lighting?

If this is beyond the scope of Amplify Shader Editor and I should figure it out elsewhere I apologize, thanks for your time.

My shader so far:
Image
For added control it might be a good idea to decouple it.

I'm not entirely sure what to recommend in this particular case, is that shader editor screenshot the same as the one used on the ball? I can't seem to replicate it on my side.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
thursdaysrain
Posts: 5
Joined: Fri Sep 07, 2018 9:30 am

Re: Point Light and Custom Lighting trouble

Post by thursdaysrain »

It is the same shader but I've uploaded the pieces here. The scene is just the camera, the ball, and a few point lights of different colors. The directional light is turned off.

Shader - https://mega.nz/#!CtIgxIYD!KW0oxJZdZfv5 ... C-r_ya9vtk
Material - https://mega.nz/#!T8Zy0ISL!MxKXVhtsygVG ... UVZlxiDhDc
Ramp - https://mega.nz/#!CkZyQICb!MmnNAsCB9qZ5 ... 1ORhZL9JIw
Mesh - https://mega.nz/#!jgQwjahQ!6jHL85miaLO2 ... W0M60BcPLc
Texture - https://mega.nz/#!ytJ0hAqL!YYCaOmOu6siT ... Ii43NEA6zg
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Point Light and Custom Lighting trouble

Post by Ricardo Teixeira »

thursdaysrain wrote:It is the same shader but I've uploaded the pieces here. The scene is just the camera, the ball, and a few point lights of different colors. The directional light is turned off.

Shader - https://mega.nz/#!CtIgxIYD!KW0oxJZdZfv5 ... C-r_ya9vtk
Material - https://mega.nz/#!T8Zy0ISL!MxKXVhtsygVG ... UVZlxiDhDc
Ramp - https://mega.nz/#!CkZyQICb!MmnNAsCB9qZ5 ... 1ORhZL9JIw
Mesh - https://mega.nz/#!jgQwjahQ!6jHL85miaLO2 ... W0M60BcPLc
Texture - https://mega.nz/#!ytJ0hAqL!YYCaOmOu6siT ... Ii43NEA6zg
Not sure what to recommend, I would probably try to decouple it.

The only possible issue i noticed was the lack of a Light Attenuation node(which includes the actual light and shadow information), multiplying it before the Dither might help.

Image
Image

Hope it helps!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
thursdaysrain
Posts: 5
Joined: Fri Sep 07, 2018 9:30 am

Re: Point Light and Custom Lighting trouble

Post by thursdaysrain »

I've got a lot of tinkering to do but it does give me some more ideas to work with. I should be able to figure it out at some point. Thank you again for the advice.
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Point Light and Custom Lighting trouble

Post by Ricardo Teixeira »

No problem, be sure to let us know if you have any additional questions.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Post Reply