Version: Unity 6 (6000.0)
Language : English
Cookies
Apply a cookie

Introduction to cookies

An example of baked fake caustics achieved using baked light cookies.
An example of baked fake caustics achieved using baked light cookies.

A cookie is a mask that you place on a light to create a shadow with a specific shape or color, which changes the appearance and intensity of the light.

Cookies are an efficient way of simulating complex lighting effects with minimal runtime performance impact. Effects you can simulate with cookies include caustics, soft shadows, and light shapes.

For example, the following illustration shows how you can simulate a real-time point light shadow with a light cookie. If there are no dynamic objects that can enter the area with a light cookie shadow, a user is unlikely to notice a difference between the cookie and a real-time shadow.

Point light with a light cookie emulating shadows (left), and a point light without shadows (right)
Point light with a light cookie emulating shadows (left), and a point light without shadows (right)

Spot lights with cookies can create the effect of light coming in from a window.

If you create a Texture that contains an alpha channel and assign it to the Cookie variable of the light, the cookie is projected from the light. The cookie’s alpha mask modulates the light’s brightness, creating light and dark spots on surfaces. This is a great way to add complexity or atmosphere to a sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
.

Render pipeline compatibility

See render pipeline feature comparison for more information about support for cookies across render pipelinesA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary
.

Additional resources

Cookies
Apply a cookie