- Home /
How to I implement a spotlight cone in vertex/fragment shader?
Hello, I'm trying to implement lighting in my shader but I can't find any way to determine the spotlight angle. Lights in my shader seem to be working fine except that the spotlights are not affected by the cone radius.
How do I get the spotlight angle in my shader? Do I need to use a cookie or something?
Answer by FuzzyLogic · Aug 02, 2013 at 03:31 PM
To answer my own question, yes unity uses a default cookie for the spotlight radius.
It also requires forward rendering lightmode not vertex lit. Vertex lightmode is limited to the 4 nearest point lights and 1 directional light.
Hi @FuzzyLogic !
I'm facing a similar problem ... I want to deter$$anonymous$$e on my shader whether or not the actual fragment it's inside the cone or not ... I've tried to read some default shaders to find it out, but i can't really find it ...
Could you be more precise on you own answer ?
How could you workout the spotlight angle and if a fragment is or not inside the cone (with it's attenuation) ?
Your answer
Follow this Question
Related Questions
[CG vertex shader] Surface normal to screen angle 1 Answer
Particles behind Glass BumpDistort dependent on viewing angle 1 Answer
Spotlights turning off and on for no reason, 0 Answers
Spotlight Does Not Show Up on iPhone5c (works on iPhone 4s/6 iPad mini/air and Galaxy S4) 0 Answers
How can I change the SpotAngle's range in a SpotLight? 0 Answers