#2421 closed enhancement (fixed)
[PATCH] Add alternative mode to add_color effect which only applies to non-transparent pixels
Reported by: | Michael | Owned by: | Michael |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 20 |
Component: | Core engine | Keywords: | effect shader |
Cc: | wraitii | Patch: |
Description
Currently the add_color effect is applied on the complete image. This is convenient when it's used on images without transparency but might not be intended for partly transparent images.
It would be good, if there would be a second mode in which the effect is not applied on transparent pixels.
Attachments (6)
Change History (20)
comment:1 by , 10 years ago
by , 10 years ago
Attachment: | colorAdd_TextureMaskMode_v1.patch added |
---|
by , 10 years ago
Attachment: | testGfx.zip added |
---|
Images to test. Put in "binaries\data\mods\public\art\textures\ui\test"
by , 10 years ago
Attachment: | test_textureMask_v1.patch added |
---|
Patch to see what the real patch does.
comment:2 by , 10 years ago
To test the patch, add the two images in testGfx.zip to "binaries\data\mods\public\art\textures\ui\test" and apply also test_textureMask_v1.patch.
What does the test patch:
- creates an (very nice and obvious ;)) color gradient in all buttons
- starts two simple color fades when a game is started
comment:3 by , 10 years ago
Keywords: | patch review added |
---|---|
Summary: | Add alternative mode to add_color effect which only applies to non-transparent pixels → [PATCH] Add alternative mode to add_color effect which only applies to non-transparent pixels |
by , 10 years ago
Attachment: | colorAdd_TextureMaskMode_v2.patch added |
---|
Replaced seperator, changed shader (use texture only as mask in maskMode)
follow-up: 5 comment:4 by , 10 years ago
Some comments: line 144 of CGUIRenderer.h should be a size_t, not an int.
I don't think you need the texture mask mode if you replace the shader with "gl_FragColor = t + color * min(t.a,color.a);" and use a proper color. So I would remove that.
I also don't really like the "addColourMask" element since it only seems useful for the ticking functions, so I'd rather add this as a parameter of the ticking functions.
However I like the add of a mask to the "colour:" effect.
comment:5 by , 10 years ago
Replying to wraitii:
Some comments: line 144 of CGUIRenderer.h should be a size_t, not an int.
I changed that.
I don't think you need the texture mask mode if you replace the shader with "gl_FragColor = t + color * min(t.a,color.a);" and use a proper color. So I would remove that.
What do you mean with "use a proper color"? If I change the shader like you suggested its function is broken (test with #2357).
I also don't really like the "addColourMask" element since it only seems useful for the ticking functions, so I'd rather add this as a parameter of the ticking functions.
I agree that it's a bit dirty because its only working for the color fades. Because of that I removed it.
However I like the add of a mask to the "colour:" effect.
:)
comment:6 by , 10 years ago
My bad, that line should read " gl_FragColor = color*min(t.a,1.0);". If you just put that, according to my tests, it works nicely, and you don't need this fancy mode.
comment:7 by , 10 years ago
Milestone: | Backlog → Alpha 17 |
---|
comment:8 by , 10 years ago
Milestone: | Alpha 17 → Alpha 18 |
---|
by , 9 years ago
Attachment: | 2421.1.patch added |
---|
Hopefully Fix what wraitii wanted so it can be commited. Can someone review this ?
comment:10 by , 9 years ago
Milestone: | Alpha 18 → Alpha 19 |
---|
comment:11 by , 9 years ago
I don't think this removes the "textureMaskMode" which I still think is useless.
comment:12 by , 9 years ago
Keywords: | add_color transparent removed |
---|---|
Milestone: | Alpha 19 → Alpha 20 |
comment:14 by , 8 years ago
Keywords: | patch review removed |
---|
The patch adds two attributes which can be used in XML files: