Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Color blending
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

sdw
Warrior

USA
160 Posts

Posted - May 02 2004 :  5:07:55 PM  Show Profile  Visit sdw's Homepage  Click to see sdw's MSN Messenger address  Reply with Quote
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  Show Profile  Reply with Quote
I really don't know, but I think you could ask masterbooda, it seems his 2D engine uses blending and DX7...


Whatever. Who knows...
Go to Top of Page

Spodi
Warrior

USA
142 Posts

Posted - May 02 2004 :  5:32:42 PM  Show Profile  Visit Spodi's Homepage  Send Spodi an AOL message  Click to see Spodi's MSN Messenger address  Send Spodi a Yahoo! Message  Reply with Quote
You can check out how the DDraw/D3D hybrid engine works that's on Lucky's site (http://rookscape.com/vbgaming).

vbGORE
Go to Top of Page

sdw
Warrior

USA
160 Posts

Posted - May 02 2004 :  5:50:42 PM  Show Profile  Visit sdw's Homepage  Click to see sdw's MSN Messenger address  Reply with Quote
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?
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 02 2004 :  6:44:24 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.
Go to Top of Page

sdw
Warrior

USA
160 Posts

Posted - May 02 2004 :  8:25:01 PM  Show Profile  Visit sdw's Homepage  Click to see sdw's MSN Messenger address  Reply with Quote
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?
Go to Top of Page

EACam
Warrior

154 Posts

Posted - May 02 2004 :  8:26:03 PM  Show Profile  Reply with Quote
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.

Go to Top of Page

sdw
Warrior

USA
160 Posts

Posted - May 02 2004 :  8:35:00 PM  Show Profile  Visit sdw's Homepage  Click to see sdw's MSN Messenger address  Reply with Quote
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?
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - May 02 2004 :  11:22:30 PM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
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/
Go to Top of Page

EACam
Warrior

154 Posts

Posted - May 03 2004 :  09:11:49 AM  Show Profile  Reply with Quote
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?
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 03 2004 :  10:40:14 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.

Go to Top of Page

EACam
Warrior

154 Posts

Posted - May 03 2004 :  12:41:53 PM  Show Profile  Reply with Quote
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?
Go to Top of Page

Almar
Moderator

Netherlands
192 Posts

Posted - May 04 2004 :  12:19:23 PM  Show Profile  Visit Almar's Homepage  Send Almar an ICQ Message  Reply with Quote
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 :)
Go to Top of Page

EACam
Warrior

154 Posts

Posted - May 04 2004 :  1:41:52 PM  Show Profile  Reply with Quote
I'm not sure what you mean about ColorOp modulate ????

What's teh difference between ARGB and RGBA? Wich should I use?
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 04 2004 :  7:49:22 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.
Go to Top of Page

EACam
Warrior

154 Posts

Posted - May 05 2004 :  08:38:54 AM  Show Profile  Reply with Quote
Cool...I try it.

So what's the difference between RGBA and ARGB?
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.13 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.