Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blending mode for this effect
#1
Hello everybody, I've seen the lights in this game in development (TimeSpinner) and thought maybe this effect can be achieved in Tilengine with some updates to the project (alpha transparnecy to pngs).

[Image: 37738919_1410691865740877_32448410318494...e=5C353DF5]

I think he just overlays a light sprite like this (a radial gradient):

[Image: iQ2QQ.png]

But instead of white tinted with yellow. Notice the sprite needs pure alpha transparency, not just all or nothing transparency like it is now.

Then he maybe uses a blending mode, which one in Tilengine do you think fits best for this?

Or maybe he just adjust the total opacity of the image to 50% and that's it, instead using blending mode.

What do you think?
Reply
#2
Hi,

I would do this effect in tilengine using the BLEND_ADD mode. A dark palette on the gradient overlay sprite would simulate faint light, brighter palette would simulate a more intense light. Playing with the palette you could get variable lighting and tinting. Without using an alpha channel at all.
Reply
#3
Thank you Marc, I will try that.
Reply
#4
I think that game is using an alpha channel for that - but having an alpha channel would be outside the scope of 16 bit hardware, and Tilengine, I would think... the SNES just used blending effects per sprite.

Every time I think of the additive blending effect for the SNES, I think of the giant skull in Super Castlevania. https://youtu.be/P0D_H3iX7wQ?t=1133 But I know they must have used it for light sources like in your screenshot.
Reply
#5
Hi guys,
I've done a quick prototype using the light effect in tilengine with BLEND_ADD mode. Here I use a shameless TimeSpinner screenshot rip-off for background, where I overlay a sprite with the halo. You can move the halo across the scren with the arrow keys (or the d-pad in the gamepad).

Here I attach the source code, the zipped assets folder and a preview. Enjoy!

Code:
#include "Tilengine.h"

static TLN_Bitmap background;
static TLN_Spriteset spriteset;

int main (int argc, char* argv[])
{
    int c, x = 176, y = 96;

    TLN_Init(400, 240, 1, 8, 0);
    TLN_SetLogLevel(TLN_LOG_ERRORS);  /* intoduced in release 2.1 */
    TLN_SetLoadPath("assets");

    background = TLN_LoadBitmap("TimeSpinner.png");
    TLN_SetBGBitmap(background);

    spriteset = TLN_LoadSpriteset("halo");
    TLN_ConfigSprite(0, spriteset, 0);
    TLN_SetSpriteBlendMode(0, BLEND_ADD, 0);

    TLN_CreateWindow(NULL, 0);
    while(TLN_ProcessWindow())
    {
        if (TLN_GetInput(INPUT_UP))
            y -= 1;
        else if (TLN_GetInput(INPUT_DOWN))
            y += 1;
        if (TLN_GetInput(INPUT_LEFT))
            x -= 1;
        else if (TLN_GetInput(INPUT_RIGHT))
            x += 1;
        TLN_SetSpritePosition(0, x, y);
        TLN_DrawFrame(0);
    }
    TLN_Deinit();

    return 0;
}


Attached Files Thumbnail(s)
   

.zip   assets.zip (Size: 17.41 KB / Downloads: 4)
Reply
#6
Arguably prettier than the TimeSpinner screenshot - because that is actual additive blending, while the original TimeSpinner one is just a transparency!
Reply
#7
Thanks Marc, altough it looks too color burned, as you said that can be modulated altering the palette.

I may try that for my dungeon crawler around the candelabra and other light sources, I don't know yet.
Reply
#8
Yes, my effect is too much intense compared to the original screenshot. But it's just a demonstration about how to use palettes and add/sub blending modes to get lighting and shadow effects without alpha channels.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)