Hi JGO!
I have encountered some problems trying to use lightmaps for me 2d spotlights and conelights.
I’m using similar ones to this.
I’m building the lights’ geometry with meshes using a triangle fan. Since both can cast shadows they don’t always have a circular or a cone shape.
My problem is I can’t figure out how to calculate the texture coordinates for the bound textures in the shader.
Let’s say I have a window size of 1024x768 and the point light is at 5000, 4000 in world space.
How can I calculate what texture coordinates to use for sampling the light map texture in the fragment shader.
Any advice would be greatly appreciated!