Version: 2020.2
Cookies (filename: Cookies.md)
Emissive materials

Creating cookies for the Built-in Render Pipeline

The most convenient way to create a cookie for use with the Built-in Render Pipeline is to create a grayscale texture, import that texture to Unity, and then let Unity convert the texture’s brightness to alpha.

Note that in the Built-in Render Pipeline, cookies only use data from the alpha channel. This means that you can define a shape for a cookie, but not a color.

A simple grayscale cookie for a window light
A simple grayscale cookie for a window light
The same cookie simulating light from a window
The same cookie simulating light from a window

To do this:

  1. Create a grayscale texture in the image editor of your choice. If you are creating a cookie to use with a Spot Light, lay your texture out as a cubemapA collection of six square textures that can represent the reflections in an environment or the skybox drawn behind your geometry. The six squares form the faces of an imaginary cube that surrounds an object; each face represents the view along the directions of the world axes (up, down, left, right, forward and back). More info
    See in Glossary
    . If you are creating a cookie to use with a Point Light or Directional Light, lay your texture out as a regular 2D texture.
  2. Place the texture in your Project’s Asset folder to import the texture into Unity.
  3. In your Project view, select the Texture Asset that represents the texture. Unity displays the Texture import settings in the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary
    .
  4. In the Inspector, set the following values:
    • Set Texture Type to Cookie
    • Set Light Type to match the Type of the Light that you are creating the cookie for
    • Set Alpha Source to From Gray Scale
  5. At the bottom of the Inspector, click Apply. Unity applies the updated import settings to the Texture Asset.

Note that the pixelsThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
See in Glossary
of a cookie does not need to be completely transparent or opaque, but can also incorporate any values in between. You can use in-between values to simulate dust or dirt in the path of the light, or to simulate caustic effects such as those produced by the ridges in a car’s headlight.

For more information on configuring the import settings for cookies in the Built-in Render Pipeline, see Texture Type: Cookie.

Cookies (filename: Cookies.md)
Emissive materials
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961