Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How does light fading work?

Recommended Posts

Hi, I'm wondering if anyone knows the equation/system to the software light system? Does it just "fade-off" faster for low lit sectors, so that bright sectors don't fade-off at all?

I have basic sector lighting implemented with the colormap, but it's just not Doom without the fading.

Share this post

Link to post

The equation is roughly this:

final_level = (sector_level-128)*2 + 255*80/dist

Doom creates two tables to do it, one for walls/floors and another one for sprites, and they work somewhat differently. Using the above equation directly doesn't quite match the original EXE, due to the precision of the tables and how they are setup for close distances.

Share this post

Link to post

Thanks, but what exactly is the range of final_level? I'm assuming it's 0-255 with 0 being dark and 255 being light. Also is it (255*80)/dist or 255*(80/dist)?

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now