Using Cookies to Create Realistic Lighting!
Objective: Take your spotlights and point lights to the next level!
A Cookie is a tool you can use to make your lights look amazing. It generates a light mask on your spotlights or point lights.
Create a spotlight.
For this tutorial and to better show off the cookies effect, I am setting the intensity to 10,000.
This doesn’t look like a real spotlight. There is no refraction on the glass. Let’s head over to good ol’ google and see what we can do to fix this. I searched for a “Cookie Texture Unity” and found a good texture I’m going to use on this tutorial.
Now we need to pull this new asset into our project. In Unity select Asset > Import New Asset > select the cookie texture you just downloaded.
Select the cookie asset, we are going to need to decide if this if for a spotlight or a point light. On the inspector set the texture type to cookie.
Set the light type to spotlight, the alpha source to ‘From Gray Scale’.
Enable ‘Alpha is transparency, then select apply.
Go back to the spotlight and drop the cookie texture onto the cookie setting in the inspector.
A warning will appear below it and it says, “HDRP does not support the cookie texture type, only Default is supported.” Select the fix button next to it and it will apply the texture.
That looks great, let’s try a different one.
That’s better! Now the spotlight looks realistic.
Now let’s use this cookie to upgrade your point lights. Select the cookie texture and set the light type to point light and enable ‘Fixup Edge Seams’. Select Apply.
Now drop the texture onto the point light.
You’ll notice that the point light is now a spotlight.
This is perfect for a lamp, or streetlight, or many other light sources. Using these cookies gives your light a level of realism that will completely transform your scenes.