Flashlight effect

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
calima
Posts: 1238
Joined: Tue Oct 06, 2015 10:16 am

Flashlight effect

Post by calima » Fri Oct 23, 2020 10:12 am

I'm playing with a flashlight effect, but can't seem to get it looking as nice as desired. One brightness for the unlit bg, one for the beam edges and one for the beam center. On a multiply-capable system it'd be easy.

Currently I'm using color math, sub+halve. The other three variants just look bad, sub+halve looks otherwise decent but the beam isn't bright enough.

Add, add+halve: the beam would change colors under it too much.
Sub: to get the unlit parts dark enough you have to use large color values, which then removes darker bg colors entirely; not wanted.

The brightness register would allow multiplying, but I don't think it can be toggled at arbitrary pixel positions on a line. The cpu use would likely be far too much too, unless IRQ could be made to work.

HDMA-manipulating the window registers would allow dark bg and one beam color, instead of the two desired, but that's rather PITA to implement.

Are there other ways?

93143
Posts: 1261
Joined: Fri Jul 04, 2014 9:31 pm

Re: Flashlight effect

Post by 93143 » Sat Oct 24, 2020 1:19 am

Doesn't the halving not happen for fully transparent subscreen pixels (ie: constant colour)?

User avatar
dougeff
Posts: 2771
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Flashlight effect

Post by dougeff » Sat Oct 24, 2020 6:56 am

If you are doing like Bowser's Castle (or the Donkey Kong caves), where the screen is darker everywhere except where the light shines.

I would subtract a fixed color, and use the windows to punch a hole for the light, and use HDMA to shape the window.
nesdoug.com -- blog/tutorial on programming for the NES

Pokun
Posts: 1564
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Flashlight effect

Post by Pokun » Sat Oct 24, 2020 2:59 pm

Just don't do the Squawks effect where he shines the flashlight towards the camera whenever you turn, blinding you. When doing a lot of turning or speed adjustments with the d-pad, the screen flashes like crazy due to this. I always hated the Squawks level for that reason.

Oziphantom
Posts: 973
Joined: Tue Feb 07, 2017 2:03 am

Re: Flashlight effect

Post by Oziphantom » Sun Oct 25, 2020 12:37 am

you can also hatch the other edges to create different light levels, with maths on a CRT it will blur and give a gradient effect.

calima
Posts: 1238
Joined: Tue Oct 06, 2015 10:16 am

Re: Flashlight effect

Post by calima » Sun Oct 25, 2020 1:55 am

Transparent subscreen could work indeed, will try. Thanks.

calima
Posts: 1238
Joined: Tue Oct 06, 2015 10:16 am

Re: Flashlight effect

Post by calima » Mon Oct 26, 2020 11:53 am

Yes, that works.

93143
Posts: 1261
Joined: Fri Jul 04, 2014 9:31 pm

Re: Flashlight effect

Post by 93143 » Mon Oct 26, 2020 7:50 pm

Excellent.

Post Reply