# How can I use an attribute value from a mesh's material in another material?

I want a lamp to emit as much light as a fire. I have a property in my fire material that says "flame". It seems like a good value to copy to my point light's material strength value.
I've considered drivers but I'm too new to the concept and I'm not sure how I can pull it off. If anyone has an idea...

I understand that this question has already been answered in the case of constant input values, but the Attribute node I want to use is linked to a mesh, making it trickier to use for another object.

Here is a blend file with what I want to do: . Light and fire on separate layers so it is possible to see the effect on the plane behind.

It's quite easy, and technically this is a duplicate question...but since you framed it within the context of lighting I will go ahead and answer.

Say you have two or more lights, and you want them to share a value for emission.

For any property you want to share between multiple materials, you need to Group it. CtrlG

In this case the Value we want to share is to be used for Emission, so create a lamp with a Value input node for emission strength and then group that node.

You should end up with a Group like this:

Hit Tab to go inside of the Group node and you will see your Value node that globally controls the emission strength for all lights with a material controlled by that Group node.

You can start by examining and playing with the example .blend provided.

The subject is lit with a proportionately controlled amount of light.

In this example render Suzanne is lit by multiple lamps. The distance, color, and even type of the lamps is different, but the global brightness is controlled by the same group-linked value.

Just keep in mind that if you're matching to an emitter mesh, the brightness will vary according to the surface area of the mesh. So you'll want to create a mesh light of matching size.

## Update

to this modified one I made:

Since the flame attribute is local to the mesh, as you observed, the best we can do is to multiply the emission intensity by some value. And if we do that using a Group node then that value gets shared so we only need to change it once.

I put the color value in there so it can be shared too. But the nature of how the flame color is generated is different, and uses the ColorRamp, so while their intensity can be increased or decreased simultaneously, the color won't be exactly the same.

I added an emitter mesh because it emits more light than a Point Lamp. I left the Point Lamp though, so you can see how the Group node is applied to both.

I'm not sure what your final goal is with all of this, but I hope this can be a solution for you.

## Taking it Further

You can keyframe the Value node and then add a Noise Modifier to the animation so the brightness will flicker in sync (although such animation will not be visible in Viewport Render).

• Thank you for your reply. In this instance I'm trying to use an Attribute node (namely a flame attribute), which is, in my understanding, linked to a particular mesh. I can pack it into a group and try to use the value as an input for the light's strength but it doesn't work. Not surprising, since, for the light, it has no mesh to read the flame value from. The example you kindly provided works fine, but for attribute values, I'm still stuck trying to figure out how to do it. – Kiskit Feb 6 '18 at 6:08
• Can you post your .blend using Blend Exchange? If so I'll take a look. – Mentalist Feb 6 '18 at 6:23
• Sure, thanks. Made the fire sim low resource so you don't have to bake it for an hour like me (not sure how to share cache) – Kiskit Feb 6 '18 at 6:47
• If I understand your solution correctly, the flame value will only affect the material for the fire domain and we're implementing another variation on the multiplication factor so that it can be spread along several materials. I guess no one would be too shocked at a flickering that is not completely equal to the quantity of flame anyway. As to my goal: combining two Andrew Price tutorials and trying to solve a problem: if the fire emits too much, it loses contrast. I'll try two fires sharing the same cache, one for light only and the other for render. Thanks a million, I learned a lot today. – Kiskit Feb 6 '18 at 19:13
• The Group node is a single data block, shared by multiple materials. It transforms the input it receives and outputs a value accordingly. The process taking place inside the Group node is the same, but if the input is different the output will be different. Let's say you have a Group node with a Math node inside that multiplies whatever the input is by 2. And Material A and Material B both use that Group node, but A sends a value of 3 into it while B sends a value of 4... A will get 6 from its Group node output and B will get 8 from its. – Mentalist Feb 7 '18 at 0:58