Shadow length

Post your example zscripts/ACS scripts/etc here.

Shadow length

Postby Hey Doomer » Fri Oct 08, 2021 3:44 pm

In reviewing Nash's Sprite Shadow code I started to wonder if shadows could be lengthened in darker sectors. The idea is that in very bright light coming from all sides the shadow would be smaller; darkness generates longer shadows. This only works against sector lighting.

I added an incremental tid to monsters on spawn starting at 22000. Then I wrote an ACS script to return the value of GetActorLightLevel based on that tid. Finally I added this to Nash's code:

Code: Select allExpand view
            // lengthen shadows when it is darker
            int tid = caster.tid;
            float length = 0.1;
            if (tid > 21999)
               int light = ACS_NamedExecuteWithResult("GetSectorLight",tid,0,0,0);

               if (light > 200) length = 0.1;
               if (light > 150 && light <= 200) length = 0.2;
               if (light > 100 && light <= 150) length = 0.3;
               if (light > 50 && light <= 100) length = 0.4;
               if (light < 50) length = 0.5;

That all seems correct to me. The length factor affects the Scale.Y number, which defaults to 0.1 (a small shadow).

In these example screenshots I tried to capture zombies in lighter and darker sectors.
Hey Doomer
Joined: 25 Sep 2021
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests