Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Creating different light projection shapes

Discussion in 'General Graphics' started by Czar-Man, Mar 28, 2019.

  1. Czar-Man

    Czar-Man

    Joined:
    May 10, 2013
    Posts:
    20
    I'm working on a light-focused game and I would like more flexibility with the shapes in which lights are projected.

    For instance, I'd like a cube light that would project light, in a straight, single direction from one of the faces inward.

    How possible is this in Unity and what are the steps to do so?
     
    OfficialHermie likes this.
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,616
    A unity spotlight, for example, can optionally have something called a "light cookie", which is a grey-scale image that determines the shape of the spill that the light projects.

    https://docs.unity3d.com/Manual/Cookies.html

    Edit: For the actual square-shaped light, you could also use a cube or quad with an emissive material. If you bake a lightmap, I think that the emission property will cast light on other (static) objects in the scene. If you are using real-time lighting, use a combination of the the emissive material on the light and the spot light with a cookie (as per above) to represent the light's spill.
     
    Last edited: Mar 28, 2019
    primo_developer likes this.