I’m trying to model a specular highlight from a spotlight/pointlight in UE4 using the material network only, but my calculations seem to be off: the specular highlight does not follow the direction of my “light” object at all. Instead, it treats the light as a directional source (like a sun) where the rotation is all that matters: not the location. How can I model a proper point light NoH (Blinn) term for UE4’s GGX, or a point light Phong specular model?
Light vector for point light would be pixel position minus light source position(or the other way around). That is it. Everything else is similar to directional light.
So, Absolute World Position - Light Location? Not the direction? Perhaps I should’ve mentioned this is a Spotlight.
Surprisingly, that would be the same for spotlight.
This worked surprisingly well! Managed to get a very high quality version of a UV light making decals glow and disappear. Thanks!
EDIT: It should be said, you need to normalize the result. Otherwise you’ll have ridiculously large values skewing your shaders.