44
$\begingroup$

In my scene it is required to position the lights close to the main object like this:

enter image description here

How I can make the light source invisible to the camera?

$\endgroup$

3 Answers 3

62
$\begingroup$

You can turn off Ray Visibility of the 'emission object'. In Blender 3.0+ go to Object Properties > Visibility, open up the Ray Visibility panel and disable the Camera property:

enter image description here


As of Blender 2.8x, Ray Visibility panel is now part of the new Visibility Panel:

enter image description here


As of Blender 2.76 the Ray Visibility panel was renamed to Cycles Settings:

enter image description here


Blender 2.7x

enter image description here


You can also run the following script to toggle the Camera Ray Visibility for all selected objects:

Blender 3.1+

import bpy

for obj in bpy.context.selected_objects:

    # toggle mesh lights
    if obj.type == 'MESH':
        for slot in obj.material_slots:
            if slot.material:
                for node in slot.material.node_tree.nodes:
                    if node.type == "EMISSION":
                        obj.visible_camera = not obj.visible_camera

    # toggle light types
    if obj.type == 'LIGHT':
        obj.visible_camera = not obj.visible_camera

Blender 2.8+

import bpy

for obj in bpy.context.selected_objects:

    # toggle mesh lights
    if obj.type == 'MESH':
        for slot in obj.material_slots:
            if slot.material:
                for node in slot.material.node_tree.nodes:
                    if node.type == "EMISSION":
                        obj.cycles_visibility.camera = not obj.cycles_visibility.camera

    # toggle light types
    if obj.type == 'LIGHT':
        obj.cycles_visibility.camera = not obj.cycles_visibility.camera
$\endgroup$
5
  • 3
    $\begingroup$ Both of the answers produce the same result, but just to add that in the node setup you have much more control over things. $\endgroup$
    – Vladimir
    Commented Oct 18, 2014 at 13:10
  • 4
    $\begingroup$ @Vladimir Note that disabling visibility in the object settings is slightly more efficient performance wise than a node setup. $\endgroup$
    – gandalf3
    Commented Oct 18, 2014 at 18:49
  • $\begingroup$ @gandalf3 I didn't know that. But, maybe the node setup can be more useful if the performance is here there the same. Thanks for the tip. $\endgroup$
    – Vladimir
    Commented Oct 19, 2014 at 11:32
  • 1
    $\begingroup$ Does not work correctly, it still appears in the bake $\endgroup$
    – Black
    Commented Nov 29, 2017 at 20:01
  • $\begingroup$ Can I also exclude it from compositing layers like depth or normals? $\endgroup$ Commented Mar 18, 2020 at 11:16
22
$\begingroup$

You can set up a custom emission material by adding another Transparent BSDF and determine the (camera) visibility of each shader at render time by using the Is Camera Ray output of the Light Path node that serves as the Factor for the Mix Shader node:

enter image description here

Note: @gandalf3 mentioned that disabling the Ray Visibility is slightly more efficient performance-wise than this node setup.

$\endgroup$
0
$\begingroup$

enter image description here

Well, in Blender 2.79 just turning the camera ray off did not work as I expected. So I did a new trick. It Works fine for me.

$\endgroup$
1
  • 8
    $\begingroup$ Answers should be more in depth than a simple screenshot. What did you do differently? Why was the accepted answer insufficient? FWIW, the accepted answer still works fine in 2.79, something else must be different in your scene. Is your light behind glass, for example? That would cause rays hitting it to be transmissions rays rather than camera rays. $\endgroup$
    – JtheNinja
    Commented Jun 27, 2018 at 5:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .