Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
957 views
in Technique[技术] by (71.8m points)

godot - Mask light with low energy is linked to player sprite's alpha value

My topdown 2d game has an FOV / Rogue Vision system (objects cannot be seen around corners)

Desired effect, no lighting:

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:

Image showing desired lighting and transparency problem

Things I've tried:

Changing the texture to completely white:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...