Sprite tinting and rim lighting. How to?

Hey there, I’m trying to understand the technique behind the lighting of this lovely game, in particular the sprite tinting and the rim lighting.

For the tinting I’ve found some information on the forum, using separate images with a render target. Never done anything like it but I’m going to give it a try.

What about the rim lighting? I suppose that’s a shader. Anyone has done something similar?

He pretty much explains it in the comments:

In the character shader, anything with a transparent pixel next to it (in the direction from the light) gets lit. And direction comes from data set in the region

Yeah, I just set a world pos for the light for each region, and then the direction is just from that to the character pos.

It’s a shader with a noise map thingy to make it bubble away. Regions are just polygon areas the player walks on in PowerQuest, so for each region I set the colours, direction, etc

(Not sure what he means by “noise map thingy to make it bubble away” though.)

It’s been a while since I did shader stuff with Defold so I’m not sure about the details, but you’ll need to send the relative light direction to the fragment shader on your character, and then fuss around with UV coordinates so you can read the texture twice—once at the current pixel and once one pixel in the light direction (might make it easier to send in another parameter with the pixel size of your sprite image?).

5 Likes

Yeah I’ve read that. There’s a lot that I need to figure out, shaders in primis.
That’s what Christmas holidays in the Covid era are for, right?

3 Likes

Oooh! This looks great! Almost makes me want to drop everyhting and see if I can make it work.

1 Like