DefFX - A collection of useful shader effects

This tool is really useful. http://spector.babylonjs.com/

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

3 Likes

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.

1 Like

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.

1 Like

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.

2 Likes

Any thoughts on CRT style shaders for retro games?

1 Like

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.

3 Likes

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.

2 Likes

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:

image

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:

3 Likes

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

2 Likes

Hey, Iā€™m wanting to learn and maybe use/adapt some of the shaders here for my game. Would it be possible to add a license to the project? Iā€™m still suffering trying to figure out how to add a grayscale shader to my project since the tutorial is out of date :blush: shaders are complex to me.

1 Like

I have added a license now https://github.com/subsoap/deffx/blob/master/LICENSE It is Creative Commons Zero v1.0 Universal the one I prefer and use most of the time.

Also these are all old so user bewareā€¦ you may need to adapt them to whatever changes are in current Defold. I want to go through fixing them up and so on but I promised to only take on 3D big time again when mesh based collision was added so it will have to wait.

3 Likes

Thank you! Iā€™m looking into these now, the effects look definitely useful for a lot of games :smiley:

2 Likes

i know nothing about opengl/shaders/etc, but felt like messing with this today (i originally saw it back when it was first posted). I hacked a little multi-light example together for fun. I really like this. Itā€™s a lot of fun.

9 Likes