DefFX - A collection of useful shader effects


This tool is really useful.

You can make HTML5 builds, and then be able to see every step of rendering.


I don’t think I can fix it the right way because things are missing.

Sprites are not currently sent normals? I tried to add the normal values to the shader program anyway but it’s not working.

Until this is fixed you can’t rotate sprites nor flip them otherwise it breaks the lights. You’ll have to make animations for each direction with their own normal texture pairs.

There is probably still a workaround related to sending more information to the shader from the object being lit but that’s kind of lame because it can require a script for every single thing being lit or a manager which knows about everything.


I think if you changed the tilesource, the offset in shader should be changed, though we can pass it to shader, but all the changes have to be handled manually. I have the save idea these days, but give it up after some test :joy:.


Hopefully we’ll be able to set _DIFFUSE, _NORMALS etc. textures for sprite frames in a user friendly and low busy work way. I made an issue on github to hopefully get the feature eventually.


Yes, or allow us to pick another image from same atlas/tilesource, and the engine pass the offset to us, so we can avoid a second texture file.


Here is way I suggested to do it so that all image version could still be in the same texture atlas.


Any thoughts on CRT style shaders for retro games?


You can adapt most any CRT style shader you can find in the wild to work with Defold if you can find a version you like. If it’s already GLSL it’s easier to adapt.


If you follow Pkeod’s suggestion, please share, as I haven’t delved deep enough into the subject myself but I want it for my game as well.

Not all shaders will work on all platforms, be aware of that. I tried a scanline one on android and it was a no go. Think it’s GLSL version related.


Can I ask which render script from your DefFX repo did you use for this example with normal sprite illumination? Could you please explain how can this effect be achieved? Even with your example sprite, normal map, pixel_sprite_normal_hstrip.material , fp and vp I’ve got something like this:



No idea what’s wrong, no time to check it out right now.


Hi @Pkeod thanks for the scanline shader, it was really helpful - However it failed to compile on my graphics card after a driver update so here’s a fix:


Its fixed in my pull request - there was a problem with changing uniform values