I’m doing volumetric light scattering for deferred lighting (GLSL). Taking from this tutorial: blog.mmacklin.com/2010/05/29/in-scattering-demo/
I’ve got everything sort of working for point lights and almost for spotlights with default rotation and fov. Thing is, for spotlights I need transformation matrix(position and rotation) and aperture (spot FOV), to draw a proper volumetric cone.
I tried to use cLightMatricesPS[0], but as I understand it is not a proper transform matrix, but some special one, that also has fov transformation in it. I also tried inversed iModelMatrix, but also with no luck.
While poking randomly, I was able to create a matrix that works with Miles Macklin’s code, but only for spotlights with default rotation. Here it is:
mat4 mymat = mat4(vec4( 1. , 0. , 0. , 0. ),
vec4( 0. , 1. , 0. , 0. ),
vec4( 0. , 0. , -1. , 0. ),
vec4( -cLightPosPS.x ,-cLightPosPS.y , cLightPosPS.z , 1. ));
I will appreciate any hints and suggestions on how to get proper transform matrix. Should iModelMatrix work? Or does it also have additional information (like scale as range) in it?
As for fov, I have no idea where to get it. I thought, there should be an uniform for it, but there is not.