LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

SPADD?

Root / Programming Questions / [.]

Javo118Created:
Maybe it's a dumb question, but... What's the use of the Attrib ADD on the SP-DEF (#SPADD)?? The manual of SB just says "Additive synthesis (0=OFF, 1=ON), #SPADD" Thanks.

Hmm, I'm not quite sure what that bit does in the sprite attributes. If I had to guess, it probably blends the drawing of the sprite with other sprites (additively). Something like the effects you see in old SNES games, like this one in Chrono Trigger https://youtu.be/Jim_WuLjhHM?t=686. Where Crono's sprite is flashing a blue pattern when he gets pulled into the time warp. There's also this program, by TheV360: https://smilebasicsource.com/page?pid=323&cid=2102, which is a SPDEF helper program. It lets you set attributes interactively to see what they do. I haven't tried it, but it's a probably a good place to start.

Thanks, i will check that program to try to guess what do this SPADD, thank you

Just tried it out, and it looks like it adds the sprite color with the background color. You can try this out using the program I linked. If you toggle additive synthesis, you'll see that the blue grid background is visible through the sprite. It seems like it is just an add operation (hence the name). EDIT: Tested this with overlapping sprites and it blends those too. To illustrate what this is doing, imagine a pixel of your sprite has this color value: RGB(255,0,0), and the bg or another sprite overlaps that pixel and has a color value of RGB(0,255,255). The resulting pixel that gets drawn to the screen is white, RGB(255,255,255), because the component channels of each overlapping pixel are added. It might be more complicated than that, but in a nutshell that's what additive synthesis does.

This is exactly what it does. To use more concise terminology, the blend mode used when drawing the sprite is add instead of over. The color channels of the pixels directly below the sprite are added to the sprite's pixels. You can get some really great blend effects from this on the cheap, perhaps most notably a good fire particle system.

wow, thank you all, i think i will use this attrib in some games