Sharing is caring => Tips, Tutorials, Examples => Topic started by: impo on February 11, 2019, 06:14:40 AM

Title: looking for shaders
Post by: impo on February 11, 2019, 06:14:40 AM
it seems all of the examples on using shaders on the forum is lost now. do shaders work in enigma currently? if so, can anybody share an example of how to actually use the shaders in enigma?
Title: Re: looking for shaders
Post by: Goombert on February 12, 2019, 12:25:48 AM
Hi impo! I can make you a simple GLSL shader example that's GMS compatible. Give me a bit to prepare one. HLSL shaders are not in yet, I attempted them before but had to remove them due to dependency on the legacy D3DX. I will be readding HLSL shaders later using the newer API so I can port my one terrain engine, based on Battlefield DICE's, as a proof of concept. I'll post back later.
Title: Re: looking for shaders
Post by: hpg678 on February 12, 2019, 06:41:31 AM
I'll be honest with you, i don't know that much about them, but based on what i have read, it seems to be really difficult to create but they do produce fantastic effects when working.

Even so, as they are associated with surfaces, which is a something I do know of and have had working, i'll have a try at it.

It may take a while so continue checking here for any progress reports.

Title: Re: looking for shaders
Post by: Goombert on February 12, 2019, 06:49:43 AM
Alright, as promised, here I am with a very simple GLSL shader example. So the first thing to mention is that shaders in ENIGMA, since they were first added, are very pure. This means we have less abstraction on top of them so you'll need to do things like declare the GLSL version at the top. I have plans and intentions of improving shader support and compatibility quite a bit soon. Since we've largely revamped our graphics systems and solved some of the more basic problems... this is the next logical step as I've been incrementally adding DX11 support.

You'll find 3 files attached to this post. simple-shader-example.zip is a GMX that contains a GLSL 110 shader which works in our OpenGL1 graphics system. Shaders will not be saved when saving your project in the GMK format because it did not support them. The shader itself, while GLSL 110 compliant, is not GMS compatible. It will therefore not work in our OpenGL3 system, which is structured more like GMS's shaders. This is one of the areas I plan on improving going into the future. You will also find toonv.glsl and toonf.glsl which is a 3D toon shader that also works in our OpenGL1 graphics system if you would like to use it.

If you have any more questions, please feel free to ask, and I will make sure that when I get to improving the shader support that I make an announcement.
Title: Re: looking for shaders
Post by: impo on February 12, 2019, 11:55:04 AM
thanks dude, the example works just fine. i'm surprised that shaders are so simple to implement actually.

in order to lure away people from game maker, we need more of demonstrative/easy-to-understand/clickbait'ish examples of enigma's advantages. powerful shaders on 3d project that game maker just can't handle would be a nice start. gonna mess with shaders later for sure. i'm currently working with a* algorithm for enigma https://enigma-dev.org/edc/games.php?game=78 and going to make a traffic simulation with 1k cars+ on top of it. something game maker won't stand
Title: Re: looking for shaders
Post by: Goombert on February 12, 2019, 06:51:10 PM
Hey, you just wait until you see what I am going to port over to ENIGMA very soon. It's one of my projects in MonoGame... very exciting. I am going to port it in an attempt to add HLSL shaders and improve the GLSL shaders. I will have it working in 4 graphics systems. Just stay tuned for that, lots of interesting things coming. Also, that sounds interesting, I had wanted to build a SimCity like game in ENIGMA for some time, but presently all I have is my 2D SimCity tile-engine working that was made by me in GM a long time ago now.
Title: Re: looking for shaders
Post by: Goombert on March 17, 2019, 09:33:45 PM
I have to update this topic because I noticed something. The "Precompile" option is apparently ENIGMA specific so it's not serialized by the GMX format I saved the project in. Please make sure you tick that box in my example before running. Sorry about this, we're going to get these kinds of issues worked out with RGM hopefully.