Subtractive blending on darkness skills
Moderator: Moderator
Subtractive blending on darkness skills
This is nothing but a trivial visual effect but subtractive blending could work really well with some skills and show magical darkness better than current, multiplicative (for 0 0 0 it is) version. Also because I want to use it for my stuff and it's trivial to code (perhaps I could submit something myself maybe)
Re: Subtractive blending on darkness skills
I understand that it should be possible with shaders, although I've never managed to figure them out myself-- if you manage to do it, I'd love to hear about what you figure out!
Re: Subtractive blending on darkness skills
Wouldn't you just put
glBlendEquation(GL_FUNC_SUBTRACT);
?
glBlendEquation(GL_FUNC_SUBTRACT);
?
Re: Subtractive blending on darkness skills
lol, I dunno
Where would you put that? Are you figuring on doing it in C? If that functionality already exists, it would seem a shame to duplicate it; DG wouldn't implement it since it's already implemented, and few would play a forked ToME. (Not that it would be inexcusable or anything-- I'm guilty of plenty of duplication when I'm just too damned lazy to figure out how DG implemented something
)
I don't know nothing about it, just repeating what I've heard-- that this is possible with shaders-- hence my eagerness for a lesson


I don't know nothing about it, just repeating what I've heard-- that this is possible with shaders-- hence my eagerness for a lesson

Re: Subtractive blending on darkness skills
Actually it should be reverse subtract anyway. We're subtracting the src (particle) from the dst (everything). Though I'm not sure about the blend func.
So, into particles.c line 183:
else if (ps->blend_mode == BLEND_SUBTRACTIVE) {glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);}
line 44:
#define BLEND_SUBTRACTIVE 2
line 534:
lua_pushstring(L, "BLEND_SUBTRACTIVE");
lua_pushnumber(L, BLEND_SUBTRACTIVE);
lua_rawset(L, -3);
I think that's it
It doesn't already exist it only handles additive blending currently.
So, into particles.c line 183:
else if (ps->blend_mode == BLEND_SUBTRACTIVE) {glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);}
line 44:
#define BLEND_SUBTRACTIVE 2
line 534:
lua_pushstring(L, "BLEND_SUBTRACTIVE");
lua_pushnumber(L, BLEND_SUBTRACTIVE);
lua_rawset(L, -3);
I think that's it
It doesn't already exist it only handles additive blending currently.
Re: Subtractive blending on darkness skills
Can you test that ? it makes my screen go black 

[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning

Re: Subtractive blending on darkness skills
the blendEquation probably needs to be set back to the default after drawing. I don't know how easily I can test, I don't have any environment for C++ set up right now. Was worth a shot with the blind untested code.