Log In  

Cart #28633 | 2016-09-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
19

OVERVIEW
This cart is a bit of a demo of a few shadow methods I've given some thought to. The first two techniques work best at 60fps, but the final technique I think is suitable at any speed.

UPDATE
The original cart had an issue where the "peek/poke merge" technique could not draw starting at odd numbered X coordinates. This has been fixed (but made things a bit more complicated)

METHODS

1 ON/OFF SPRITE:
This method uses a solid shadow sprite that cycles between on/off every frame

2 ALTERNATE PATTERNED SPRITE:
This method uses two sprites with an alternating pattern that is cycled every frame

3 PEEK/POKE MERGE:
This is what I really wanted to get to :) This method uses a defined palette of darker colours. Each PICO-8 colour is given a darker alternative. For some, that is full black, but for 8 (red), it is given dark purple (2).

  • The shadow sprite is read in from PICO-8's memory and every pixel that is not black is considered shadow, and black is ignored.
  • The draw coordinates for the shadow are read from memory in the graphic area, the existing colour values are determined and are replaced with their darker version wherever there is shadow pixel in the sprite
  • The new darker pixels are poked back into memory

CONTROLS

O: Cycle shadow method
X: Cycle background

Down: Toggle background scrolling

P#28517 2016-09-14 19:11 ( Edited 2016-09-17 01:21)

That's pretty cool. The first technique was pretty popular for retro game consoles like the SNES. The second one that uses two checkerboard patterns is very smooth on my end, and hard to notice the trick unless you look really close.

P#28519 2016-09-14 19:38 ( Edited 2016-09-14 23:38)

I found the first technique flickers quite a bit at a stand still at least on PICO-8 on my monitor. I've added the ability to toggle the background scrolling with the Down arrow. This will make the effect a bit more obvious, and it's also affected by which colours are being used.

P#28524 2016-09-14 20:04 ( Edited 2016-09-15 00:04)

The Peek/Poke/Merge is awesome. No flicker at all, nicely done !

P#28526 2016-09-14 20:18 ( Edited 2016-09-15 00:18)

I too, like the peek/poke/merge. Very good technique here.

P#28528 2016-09-14 21:31 ( Edited 2016-09-15 01:31)

aaaaand..... pico8 got transparent shadows in less time that the PC took for same feat :P

P#28624 2016-09-16 17:58 ( Edited 2016-09-16 21:58)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-27 23:26:20 | 0.011s | Q:23