How can I link all lights visibility in the scene? removing glossiness/reflections of the light

Hello,

I have a massive model with a lot of lights but they are all linked by object data. I was wondering if there is any way that I can remove the reflections or glossiness from all them fast without adjusting 200-300 light individually.

Thanks a lot in advance! :slight_smile:

First off, welcome to the community, @Adham.badr! The short answer is that there isn’t an easy way to change the Specular value of all the lights within the scene using the GUI (that I know of). There are some things that can be edited at the same time, but light properties aren’t one of them.

The quickest way to do what you are trying to do is with two quick lines of Python. Go to your Scripting workspace at the top of Blender, and in the Python Console window (the one with the blue “Python Interactive Console” text and the “>>>” prompt, type:

for light in bpy.data.lights:

and press enter. You’ll get a new ... prompt where you’ll type:

light.specular_factor = 0.0

and press enter. You’ll get one more ... prompt, and press Enter one more time.

What this does is that you are telling Blender that you want to start a for each loop that will do the same action on all members of a collection. So, you would read the top line of the script as “for each light in the collection bpy.data.lights…” The colon tells Python that you want the action of your loop to start on the next line. The next line grabs the next light item the loop refers to and changes the specular value to 0.0. You would read that line as “set the specular_factor of the light to 0.0.” You can change the value to any positive floating point value (decimal values) here (Blender allows setting it to values above 1.0, but 1.0 is the default maximum value). Pressing Enter one more time tells Python that your loop is over and it should execute it.

As a disclaimer, I tested this on Blender 3.0.0, and I’m not sure if Python behaves differently in other versions. As another heads up and at least as late as Blender 3.0, Eevee only supports 128 active lights in a scene. I’ve linked to the Blender manual page that mentions this limitation below:

Eevee Limitations https://docs.blender.org/manual/en/latest/render/eevee/limitations.html#lights:

  • Only 128 active lights can be supported by Eevee in a scene.

And…if you are not using Eevee, you shouldn’t have to worry about the number of lights or the Specular value of lights.

Hope this helps and saves you time! Let me know if you have any questions.

Edit:
I made a video to show you how it looks just in case a visual aid helps:

1 Like

Did this help solve your issue, @Adham.badr ?

Hello @Hunkadoodle,
First of all I want to thank you for all of the work you put in this! Simply amazing and I really appreciate this a lot :slight_smile:

Second, I want to apologize for my late reply as I lost track with this topic because I was tied with little time to finish the project so please accept my apology for that.

Regarding the topic, I guess I didn’t formulate my question properly and I didn’t mention the engine I’m using. But my question was more about the visibility of point lights in Cycles not in Eevee.
My scene is basically a big block of houses in a suburban area and I’m making renders for this area with evening light so I’m using interior light to give the scene extra life and a more realistic feeling. The problem I’m facing is that the point light is reflecting to the glass windows as a light ball and it’s very distracting and gives an unnatural feeling to the scene. I know I can turn off glossiness from the visibility panel but sadly I can’t turn off this option for all of them at once even though it is only 1 light duplicated and linked in the whole model.

I hope what I said made sense a bit or made my question more clear?

1 Like

No worries, Brother! I’m here for you! So, I think I have the info I need, and it is really almost as simple as before. I will say that my understanding of Blender and Python gets me only so far, but a job like this seems too easy to mess up (famous last words, I know). So…

Since glossy ray visibility is an object-level property, we need to iterate over all the objects, test which ones are lights, and if we find a light, change the glossy ray visibility to False. There will be three lines of Python code this time instead of two. These are the steps:
Enter your first line:

for object in D.objects:

and press enter. Youll get a new ... prompt where you’ll type:

if object.type == 'LIGHT':

and press enter. You’ll get another new ... prompt indented another 4 spaces where you’ll type:

object.visible_glossy = False

and press enter. Remember to press Enter one more time to execute your code block.

This code reads as, “for each object in the collection of objects bpy.data (D is just a convenience variable so I don’t have to type bpy.data a whole bunch)…” Remember we have to work on the object-level, so we are using a different collection D.objects instead of D.lights. The next line reads, “if this object’s type is equal to ‘LIGHT’…” We want Python to do something only to certain objects, and that is why we use the == test to test if the type of the object is, in fact, equal to ‘LIGHT’. It won’t change ray visibility on things that aren’t lights. Maybe there could be an issue if you have other lights in your scene you don’t want to change their glossy visibility, but I haven’t confirmed that yet. The final line reads, “Change the object’s glossy ray visibility property to False.” Then we let the loop run until it has gone through all the objects in your scene.

This is how it looks small scale in the scene from before:

If you get it working and would be able to share a render, I’d like to see it! Let us know if you need any further assistance!