Using Cookies to Create Realistic Lighting in Unity

It’s not the kind of cookies you are thinking of!


It's a texture that is a mask projected from a light source. It can imitate real-world lighting like a lamp or a light fixture would depending on how the cookie texture is designed.

This is a cookie texture. If you can’t see it yet, it kind of looks like what a real flashlight would project on a surface. This is why cookies are so powerful! You can create different textures to imitate other types of light masks.

The image above has a spotlight casting light on the sphere with a cookie texture. Very powerful.


Let’s create a spotlight and place it in our scene.

You can grab the cookie texture above or search on Google for one. Once you have one, import it to your project folder. Select the texture to configure it.

Make sure Alpha Source is set to “From Gray Scale” and “Alpha is Transparency” is checked. Next, make sure “Wrap Mode” is on “Clamp.” Save and drag the texture to the cookie property in your spotlight. A message will appear underneath the property stating to Fix the texture. Click on the button to fix it.

I already fixed my cookie texture which is why I didn’t receive the message.

We can now see the beauty of using cookies!

I managed to play around with the settings by adjusting the inner and outer angles of the spotlight.




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