Hello.
I want to subtract the pixel color by a constant value.
But, PVR alpha blending only has add and multiply.
Is there subtract techniques with PVR alpha blending?
Thanks!
How do I subtract with alpha blending?
-
- DC Developer
- Posts: 42
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Wed Jan 20, 2016 4:55 am
- Has thanked: 18 times
- Been thanked: 53 times
- Protofall
- DCEmu Freak
- Posts: 78
- Joined: Sun Jan 14, 2018 8:03 pm
- Location: Emu land
- Has thanked: 21 times
- Been thanked: 18 times
- Contact:
Re: How do I subtract with alpha blending?
I'm a bit rusty on my computer graphics terminology so I don't really know what "subtract" pixel colour means, but this post with a demo to download might be what you're looking for or point you in the right direction https://dcemulation.org/phpBB/viewtopic ... p#p1055918
Moving Day: A clone of Dr Mario with 8-player support <https://dcemulation.org/phpBB/viewtopic ... 4&t=105389>
A recreation of Minesweeper for the Dreamcast <viewtopic.php?f=34&t=104820>
Twitter <https://twitter.com/ProfessorToffal>
YouTube (Not much there, but there are a few things) <https://www.youtube.com/user/TrueMenfa>
A recreation of Minesweeper for the Dreamcast <viewtopic.php?f=34&t=104820>
Twitter <https://twitter.com/ProfessorToffal>
YouTube (Not much there, but there are a few things) <https://www.youtube.com/user/TrueMenfa>
-
- DC Developer
- Posts: 42
- Joined: Wed Jan 20, 2016 4:55 am
- Has thanked: 18 times
- Been thanked: 53 times
Re: How do I subtract with alpha blending?
This is not what I want. But very interesting.
I wanted to know how to darken the pixel color.
I need to study PVR blend mode.
Thank you for your reply!
I wanted to know how to darken the pixel color.
I need to study PVR blend mode.
Thank you for your reply!
-
- DC Developer
- Posts: 105
- Joined: Sun Oct 04, 2009 11:13 am
- Has thanked: 2 times
- Been thanked: 90 times
Re: How do I subtract with alpha blending?
I think the closest you can get to subtractive blending is to send the source blend func to zero and the dest blend func to 1-src. (So in OpenGL, this would be glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR))
This gives you a blend equation of Source_color * 0.0 + Dest_color * (1 - Source_color), which simplifies to Dest_color - Dest_color * Source_color.
Not exactly Dest_color - Source_color, but it causes bright colors in the source texture to darken the pixels underneath. Pure white in the texture will draw pure black, and pure black will leave the pixel unchanged, just like true subtraction would. It might look close enough.
This gives you a blend equation of Source_color * 0.0 + Dest_color * (1 - Source_color), which simplifies to Dest_color - Dest_color * Source_color.
Not exactly Dest_color - Source_color, but it causes bright colors in the source texture to darken the pixels underneath. Pure white in the texture will draw pure black, and pure black will leave the pixel unchanged, just like true subtraction would. It might look close enough.
-
- DC Developer
- Posts: 42
- Joined: Wed Jan 20, 2016 4:55 am
- Has thanked: 18 times
- Been thanked: 53 times
Re: How do I subtract with alpha blending?
I got the answer with your tips and some sleep. Thank you!
pass 1 : dst = src_color
pass 2 : dst = 1 - dst_color
pass 3 : dst = dst_color + src_color * src_alpha
pass 4 : dst = 1 - dst_color
But, It's so heavy on PVR. PVR is not good on Translucent...
pass 1 : dst = src_color
pass 2 : dst = 1 - dst_color
pass 3 : dst = dst_color + src_color * src_alpha
pass 4 : dst = 1 - dst_color
But, It's so heavy on PVR. PVR is not good on Translucent...
- These users thanked the author Twada for the post (total 2):
- Protofall • Ian Robinson