Jump to content

How does light fading work?


Scet

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...