This was done with reference to the paper Real-Time Polygonal-Light Shading with Linearly Transformed Cosines, which is a pretty fast way to handle lighting accurately. Also with referene to the amazing demo the authors provided.
I implemented lighting from a texture, though I did modify the processing of the texture part for shadertoy.
The shader is intensive and might crash mobile browsers. Click to see the shader at shadertoy:
Very long, refer to the shadertoy link.