Spade-Editor / Spade

Cross-platform raster graphics editor inspired by Paint.NET
GNU General Public License v3.0
41 stars 10 forks source link

"Poor man's fragment shader" #66

Open HeroesGrave opened 10 years ago

HeroesGrave commented 10 years ago

Suggested by BurntPizza. I apologise if this isn't what you meant in the first place, but this seems like a cool idea regardless.

Basically we take something like GLSL fragment shaders, and implement them as custom effects.

Simple:

Input: Pixel coordinates and optionally the old pixel colour Output: New pixel colour.

Then when the effect is applied, just iterate over all the pixels (or selected pixels if there is a selection), and send them to the 'fragment shader', which does operations and stuff and returns a new pixel colour.

More advanced:

Allow sampling from other pixels and multiple stages.

HeroesGrave commented 10 years ago

Maybe this could also be implemented as a tool.

Longor1996 commented 10 years ago

Some notes on this: Make it an Image-Effect. It should only modify the selected layer (+selection).

I think a good name for this would be 'Pixel-Shader Effect'.

As for Scripting-Languages, have a list:

Also, the User has to be able to easely add in new scripts. Probably a small 'PixelShader Effect Manager' dialog that allows to add/remove/modify scripts?

Decisions, Decisions...

HeroesGrave commented 10 years ago

GLSL, or at least a simplified reimplementation of it.

BurntPizza commented 10 years ago

I was thinking probably just a custom DSL similar to GLSL, just the relevant bits. Real nice series of articles about DSLs and Java

So you guys think this should be a feature? I'll get started on it if so.

HeroesGrave commented 10 years ago

For 2.0, yes.

Probably time to make another milestone.

I also really need to get around to pushing out 1.0

BurntPizza commented 10 years ago

Cool, I'll probably make an 'experimental' branch or something on my fork, so it doesn't get mixed in with the regular dev

HeroesGrave commented 10 years ago

Sounds good to me.

sylvia43 commented 10 years ago

We should make a basic version of this a top l and allow more complicated scrpts to be written.

HeroesGrave commented 10 years ago

The purpose of this is to allow 'scripted' effects, so someone with a small amount of programming knowledge could create custom effects without having to make a plugin.

sylvia43 commented 10 years ago

Sorry about the previous comments... My idea is to do something like Photoshop... Have a relatively simple customizable shader with a ui, and allow for advanced shaders using a scripting language.

HeroesGrave commented 10 years ago

The point was to allow for powerful and customisable effects. I'm not sure if ease-of-use goes well with that.

Most simple effects will be eventually achieved through 'official' plugins.

BurntPizza commented 10 years ago

I agree with @HeroesGrave , I intended the shaders for custom stuff, applicable to the advanced users. That being said, if we eventually include a set of standard shaders with the program to augment the effects/plugins, so be it.

sylvia43 commented 10 years ago

Ok I get it... So shader plugins are just going to be written in the shader language that we come up with then; and the core program doesn't need any.

HeroesGrave commented 10 years ago

They can but they don't have to be. Effects will still be able to be added through plugins.

sylvia43 commented 10 years ago

Yeah but the plugins will basically be shader code snippets right?

BurntPizza commented 10 years ago

No. The plugins are more than just scripts. Take a look at the auto-updater plugin the @HeroesGrave has.

sylvia43 commented 10 years ago

The plugins that add effects would be, in essence, shader code snippets right? Or do they just ignore the shader code and write their own?

BurntPizza commented 10 years ago

They could be, or they could be like the current built-in effects. Refer to heroesgrave/paint/effects