DaFluffyPotato • on 1st Kajam

I just finished shaders. They look a bit ugly, but I'll change a few things to make it look better. :P
The player will be the main light source in the actual game. The spores(being shot) will also light the way. The in-level lights will be pretty rare, but I think I'll adjust their light range to be larger.

Comments

Wan
a month ago

I've never done a such lighting shader. They're great to help the games look like more than a lump of blitted sprites.

How does yours work? I'd assume it, like, checks the distance from the source, then if affected picks the next color from a palette?

EDIT: Just saw this tweet of yours, so you're using drawing tricks instead of GLSL right?

DaFluffyPotato
(@CMLSC) • a month ago

@wan yep, just putting a bunch of colored circles on a background and setting a color on the front layer to transparent. It's the only way I could think of doing it. It works fine though. :P Also, I've been wondering, is what I made technically shaders? It has a similar effect.

Wan
a month ago

Technically it's not shaders then, but it's a clever trick anyway which, in that case, yields similar results :)

Actual shaders are more complicated because the idea is to write code in a specific language (like GLSL) to delegate some work to the graphics card. That means you can send it code to apply on each pixel of the screen (to decide, pixel by pixel, what is its final color depending on whatever input data), and it will do so super fast, unlike what you would have obtained with normal CPU code.

For instance if you wanted to have various Photoshop-like blending modes, rather than just "normal" blending with alpha, pixel shaders would have been mandatory. Another straightforward use is for tinting parts of sprites dynamically (e.g. character clothes).

DaFluffyPotato
(@CMLSC) • a month ago

@wan wikipedia's page for shaders says "computer program that is used to do shading" but later it says that "pixel shaders, also known as fragment shaders, compute color and other attributes of each 'fragment.'" The page claims that pixel shaders are the only 2D shaders, but under the general terms described at the beginning of the page, what I do is kind of a shader. It's a script that shades things, so it's probably okay to refer to it as a shader when talking about it(since it'd be a pain to always explain how it works).

Wan
a month ago

You're right!

Most shaders are coded for a graphics processing unit (GPU), though this is not a strict requirement.

Good to know.

Login to comment