In this case, I should get lightrange from the vecLightPos.w. As for the position of the light in screen coordinates, vecLightViewPos doesn't help, I guess I need to convert vecLightPos.xyz to screen pos? Already tried oPos = mul(iPos,matWorldViewProj); but that didn't help either.

Edit: I found this algorithm to convert from cartesian to screen:
Code
screenX = cartX + screen_width/2
screenY = screen_height/2 - cartY

// converted it into 
float pos_x = vecLightViewPos[i].x + vecViewPort.x / 2;
float pos_y = vecViewPort.y / 2 - vecLightViewPos[i].y;


It already looks a bit more closer to what I want to archive, but it looks like positions aren't correct when close to the light sources...
[Linked Image]
But on distance it's almost what I want to archive.
[Linked Image]

Last edited by 3run; 05/13/20 10:54.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung