Open ozkriff opened 5 years ago
You are right, custom shaders are currently not supported.
Are there any plans for it?
This is a complicated question. Custom shaders are not really a goal, they are a tool used to obtain a specific effect in your game. I think Coffee needs to offer support to achieve these effects.
However, that does not mean Coffee will let you provide your own custom shader in GLSL or SPIR-V freely and talk directly to the GPU. This seems like a hard thing to do well without leaking internal implementation details.
I am by no means an expert in computer graphics, but I think that before deciding on a tool, we should learn about the goals first:
Batch
, Image
, etc.?Some random ideas:
Mesh
)?I think we should focus on a couple of common use cases and try to imagine how they could fit with the current graphics module. That could give us more details about the problem.
Anyway, sorry for the rant! :sweat_smile: Does this answer your question, @ozkriff ? Or would you like to know something in particular?
In any case, it may be a bit until I hit this point with my games, so feel free to share your use cases and start a discussion here!
While it is most certainly possible to make a good implementation of custom shaders (read GLSL), without leaking internal implementation details I agree that it is a very hard task whose benefits can mostly be achieved by just putting together and implementing common use cases. As an enthusiast I surely enjoy messing around and creating my own shaders but it is a really niche thing imo.
If you want to get an idea of how the 3D world handles shader modularization, check out what Blender does. On the ground floor, it has a list of shaders whose parameters will allow you to get several common materials. For shaders that lie outside of their set, it has something called a "node editor," which is a visual boxes-and-lines editor for dataflow programming. Virtually everything you would want to do with a shader can be represented as an acyclic directed flowchart depicting what happens to colors as they're read from textures and pushed to the output.
SFML, a fairly opinionated 2D drawing library, has shaders. 0 They don't totally reinvent the concept like node systems do, but they do show how you could put them in to a 2D game engine.
Shaders themselves are an art-form, and I would disagree that totally abstracting them away is a goal. In fact, supporting GLSL might actually be considered a goal in and of itself, because a lot of cool stuff has been written in it, and I want to cut and paste! To get an idea of the existing "shader community," check out Shadertoy 1, which is full of examples of 100% 2D shaders that do amazing things with nothing more than a single quad to draw on.
I found this issue because I wanted shaders, and I am an example of someone who won't be able to use coffee because it doesn't have them. To help you make your plans, here are some use cases I am considering:
Custom shaders aren't supported atm, right? Are there any plans for it?