sdw
Warrior
USA
160 Posts |
Posted - May 02 2004 : 5:07:55 PM
|
How do I blend a color with a surface? I am using directdraw7/d3d7.
My idea was to make a second surface with the same dimensions, fill it with the color i want, then alphablend it over the original surface. Any quicker/easier ways to do this? |
|
VBBR
Moderator
Brazil
617 Posts |
Posted - May 02 2004 : 5:20:35 PM
|
I really don't know, but I think you could ask masterbooda, it seems his 2D engine uses blending and DX7...
|
Whatever. Who knows... |
|
|
Spodi
Warrior
USA
142 Posts |
Posted - May 02 2004 : 5:32:42 PM
|
You can check out how the DDraw/D3D hybrid engine works that's on Lucky's site (http://rookscape.com/vbgaming). |
vbGORE |
|
|
sdw
Warrior
USA
160 Posts |
Posted - May 02 2004 : 5:50:42 PM
|
Thnx for the quick replies. Yeah I turned my engine into a dd7/d3d7 hybrid thanks to the tutorial on lucky's site by matt as Spodi mentioned, but the color blending it demonstrated there isn't exactly what I want. I need the blending to get me some brighter colors. How'd you do it masterbooda? |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - May 02 2004 : 6:44:24 PM
|
There are also two different hybrids on this site you might want to look at. Check out the Files section, D3Dfor2D.zip and direct5d.zip. You might also want to look into using different materials to get different color effects. |
|
|
sdw
Warrior
USA
160 Posts |
Posted - May 02 2004 : 8:25:01 PM
|
I looked at the example by Carl Warwick and compared it with the one from Lucky's site. They both use DX.CreateD3DTLVertex for the vertices and this thing takes an argument to modify the color. However, after playing around with it for an hour, I have come to the conclusion that the color value specified there will not make the texture any brighter, it will only darken/tint the texture.
Look into different materials to get different color effects? |
|
|
EACam
Warrior
154 Posts |
Posted - May 02 2004 : 8:26:03 PM
|
So, you're talking about Additive color blending? Good luck, I've never seen it done. The closest I've seen is alpha ONE blending.
|
|
|
sdw
Warrior
USA
160 Posts |
Posted - May 02 2004 : 8:35:00 PM
|
From what I understand the vbDABL dll will colorblend things for me. I've never got it to work successfully myself but is that an option I should consider taking? |
|
|
masterbooda
Swordmaster
277 Posts |
Posted - May 02 2004 : 11:22:30 PM
|
I'm sorry, my engine was designed in directx 8, and I used the specular to brighten the colors... but I do believe if you can create a mask of the image, that is pure white, or the brighter color, then overlay it over the original, and by Changing the alpha of the overlay, you can give it the effect of brightening, but this will probably create some overhead...
Also, from what I do remember of d3d7(sorry, have had my head burried int dx8 too long)... you can change the values you pass to the device on how the texture is drawn, and by messing with that and the alpha... you can brighten it up.... just try every combonation there is and adjust the alpha to see what it does... this is what I did, and You can do some really neat effects...
DaBooda Out... |
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
EACam
Warrior
154 Posts |
Posted - May 03 2004 : 09:11:49 AM
|
You cannot brighten with alpha...sorry. It isn't additive blending...i've tried. But the specular thing might work. How did you do that DaBooda? |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - May 03 2004 : 10:40:14 AM
|
Actually, you can achieve an additive blend with alpha blending. All you need to do is set the correct blend modes, SrcAlpha for the source and One for the destination. To increase colors, you would blend a non-black color over the target surface.
This color increase only increases color saturation, not luminosity. You can achieve the latter by using a gamma ramp, but that effects the entire image.
|
|
|
EACam
Warrior
154 Posts |
Posted - May 03 2004 : 12:41:53 PM
|
Really? Cool. In my app tho, alpha one blending only works if I set alphaone to both the dest and the src. And then the alpha one is kind of constant. I can't set an amount of alpha one like i can for regular alpha. Is that normal? |
|
|
Almar
Moderator
Netherlands
192 Posts |
Posted - May 04 2004 : 12:19:23 PM
|
quote: Originally posted by EACam
Really? Cool. In my app tho, alpha one blending only works if I set alphaone to both the dest and the src. And then the alpha one is kind of constant. I can't set an amount of alpha one like i can for regular alpha. Is that normal?
Use ColorOp modulate and set the alpha component of the vertex color (D3DXColorARGB(128,255,255,255) or something)? Not sure if that's what you mean :) |
|
|
EACam
Warrior
154 Posts |
Posted - May 04 2004 : 1:41:52 PM
|
I'm not sure what you mean about ColorOp modulate ????
What's teh difference between ARGB and RGBA? Wich should I use? |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - May 04 2004 : 7:49:22 PM
|
ColorOp and AlphaOp determine how vertex color and texture colors are blended together. For example, if you set your colorOp to modulate, that effectively multiplies texture color time vertex color. If you have a grayscale texture, then you can adjust the output color by adjusting the vertex colors. If your texture is blue, RGB(0,0,1), and your vertex color is red, RGB(1,0,0), then the output would be black. 1*0, 0*0, 0*1. If the color is gray, RGB(.5, .5, .5) and a vertex color is green, (0,1,0), then the final color would be RGB( 0, .5, 0). There are also alpha operations, which allows you to use different effects for combining the alpha from a vertex color with the alpha in a texture.
Look at this screenshot, the red, green, and blue color variations are controlled by adjusting the color value of the vertices. The bottom row show variations in the Alpha component of the vertex colors. The smiley face is created from alpha values in the texture.
|
|
|
EACam
Warrior
154 Posts |
Posted - May 05 2004 : 08:38:54 AM
|
Cool...I try it.
So what's the difference between RGBA and ARGB? |
|
|