My topdown 2d game has an FOV / Rogue Vision system (objects cannot be seen around corners)
Desired effect, no lighting:
.
The problem comes when I made the texture a radial gradient and lowered the energy value so the player can see a short distance with no lighting, so is encouraged to illuminate the environment by turning on lights and such. The mask light MUST be rendered last and MUST have an energy value less than one, however both the lights color alpha value and energy value are making my player transparent. This is a neat trick for when my player plays as a ghost, but I need a solid character. Why is this happening, and how can I fix it?
Image showing desired lighting and transparency problem:
Things I've tried:
Changing the texture to completely white:
Changing the texture to completely black - results in no peripheral lighting with the same transparency problem
Changing the texture to completely transparent - no peripheral lighting, with the same transparency problem, however the energy no longer makes a difference in transparency
Changing the energy value to 1 and other lights to greater than 1 - effect breaks
Changing the energy value to .99 - no other lighting possible
Changing the energy value to .99 and changing the texture to a white to transparent gradient - Close to desired effect, but texture makes a noticeable and ugly bubble around player
Github repository of project if you want to fiddle for yourself
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…