Color of all lights

Node-based Shader Editor
Post Reply
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Color of all lights

Post by mossman »

Hello,

I want to get the color of all the lights in the scene. The Light Color node only get the color of first light in the scene.

How I get this?

Thanks
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Color of all lights

Post by Ricardo Teixeira »

mossman wrote:Hello,

I want to get the color of all the lights in the scene. The Light Color node only get the color of first light in the scene.

How I get this?

Thanks
Hey there,

Can you elaborate on your specific use case, or perhaps share a sample shader? The Light Color node should be picking up more than just the first light.

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!
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Color of all lights

Post by mossman »

Hello Ricardo,

Thanks for your reply.

I investigated the node and I prepared a simple scene with a shader. (I attached the package)

The shader is a Surface shader with a Custom lightning model. With the Light color node and the Light attenuation node I get the color of all lights as you explained. but the result in the example is very ugly. How I smooth the colors in the surface of the mesh?

And I want to apply the colors of different lights with the attenuation value in a emission input of a Surface shader and in a Frag color input of a Unlit shader.

Thanks
Attachments
multiplelights1.unitypackage
(9.82 KiB) Downloaded 297 times
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Color of all lights

Post by Amplify_Borba »

Hello, you'll need to provide the shader with the necessary data in order for it to be able to perform the lighting calculations that you require, which will depend on the effect you want to create and the type of light sources in your scene and might involve specific Light nodes.

Please refer to the simple example below:

Image
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!
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Color of all lights

Post by mossman »

Hello,

Your solution is awesome. The color of the light that collide to the mesh is smooth now.

I want to apply the colors of different lights with the attenuation value in a emission input of a Surface shader and in a Frag color input of a Unlit shader. How I get this?


Thanks
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Color of all lights

Post by Amplify_Borba »

Most of the lighting nodes we provide are built specifically for our Custom Lighting model, meaning that they can't be used in other contexts. Also, the Standard Surface shader has its own lighting calculations, while the Unlit shader template has none.

Ideally, you should use the Custom Lighting model to create unique node-based lighting for your Surface shader, but you may also use the Unlit template as a base to build your own custom template in order to suit a specific pipeline or purpose, although you'll need some shader knowledge in order to edit or create templates.

If you could further elaborate on what type of shader / effect you're trying to build, we might be able to provide additional insight.
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!
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Color of all lights

Post by mossman »

Hello,

Thanks for your reply. I will test some things now.

Thanks
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Color of all lights

Post by Amplify_Borba »

No problem, please let us know if you have any further questions!
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