7

Is it possible to produce a spot light with a different shape than a circle? In particular, I would like to produce a spotlight that casts a squared image into a wall, and the spotlight can be occluded by certain elements in the scene.

Edited: Using Cycles blender

Manel B
  • 81
  • 1
  • 5
  • 1
    Please specify what render engine you are using. –  May 22 '17 at 01:03
  • What render engine, are you talking about Cycles? See https://blender.stackexchange.com/questions/47756/ies-like-lights-in-cycles and https://blender.stackexchange.com/questions/57013/correct-vector-input-to-map-texture-light-in-cycles . If you simply want a rectangular shape it might be best to simply use an actual object in the 3D scene like a "stencil" to actually occlude the light in a rectangle shape – Duarte Farrajota Ramos May 22 '17 at 01:04
  • 2
    For blender internal just set the spot shape to square. –  May 22 '17 at 01:04

1 Answers1

12

The Geometry node Normal can be used to control the profile of the light emitted by a lamp and this can be used with an image texture to give full control of the lamp output.

Consider the following nodes :

material

Here the Geometry Normal is passed through a Mapping node to rotate it into the desired direction before being split into its X,Y,Z components. The X and Y components are adjusted to remove the 'bending' caused by the spherical Normal coordinates (otherwise you get distortion of the image at the corners) before being passed through a second Mapping node (to adjust the aspect ratio of the image) before being passed to the Image node for the texture - simply apply your own image in the Image node.

This can produce the following result :

rendered

Replace the Image with an image of a plain square - or any other shape - for your desired result.

This method will work with the Point and Spot lamp types - but the Spot will also be limited to a circular spot (in the direction of the lamp) so the Point lamp gives more control since you can simply provide whatever image you desire. Note also that the Lamp includes a 'Size' setting - setting to affect the blurriness of the lamp - setting this to zero will produce a very sharp image (as in the above example). Setting it to larger values will produce progressively blurier projections.

Rich Sedman
  • 44,721
  • 2
  • 105
  • 222