3D Level Design: Using Cookies to Create Realistic Lighting

Intro

In this article, we are going to cover what a cookie is and how to add them to spot and point lights.

Cookie

Cookies are textures that you can apply to spot, point or directional lights. It is a light mask that allows certain parts to be opaque and others to be transparent. This gives the light a more realistic look because it adds the refraction you normally get from the glass or bulb.

You can find cookie textures by just searching Google.

Point Light

Below you can see the side-by-side comparison of a point light without and with a cookie texture.

No Cookie (Left) Cookie (Right)

The cookie gives it a more light bulb look and is great to use when add it to a lamp.

In adding a cookie texture, you will need to first import the image from Google into your Unity project.

You will need to change the Texture Type to Cooke, Mapping to Mirrored Ball (since the Point Light is a spherical light), Light Type to Point, and Alpha Source From Gray Scale with Alpha is Transparency (this makes the darker areas transparent and the lighter area more opaque). Don’t forget to hit Apply to make these changes.

On the Point Light game object, add the Cookie texture and you will need to select Fix in order for it to work in HDRP.

Spot Light

Below you can see the side-by-side comparison of a spot light without and with a Cookie texture. It gives the light a flashlight look to it.

No Cookie (Left) Cookie (Right)

The import settings are slight different with a spot light cookie.

The Texture Type remains Cookie and the Alpha Source is still From Grey Scale with Alpha Is Transparency. The only difference is the Light Type, which should be Spotlight.

Drag and assign the texture to the Spot Light’s Cookie texture and select fix to make it work in HDRP.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store