• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Gamma Control

## Recommended Posts

Hi all. I''ve been trying to use the Gamma Control in DDRAW. The first time I read the documentation it said that if QueryInterface did not return it as a supported feature then the HEL would be able to emulate it. Than I go to another part of the DX SDK documentation and it said that the HEL would not emulate it. Well, I implemented the code and it didn''t work. I was wondering if anyone else got it to work? And if you did, did it use the HEL or HAL? If it used the HAL than what is your video card? If you haven''t gotten it to work than I was wondering about some pretty fast ideas on how to handle lighting in Direct Draw. (Namely ambient lighting not spot) Thanks.

##### Share on other sites
Sorry about that, when I origionaly read the documentation I miss-read the information in it. Gamma will not work unless it''s supported on the video card. I''m extremly sorry about that, a little miss-communication between the MS Docs and my brain I suppose.

##### Share on other sites
So what are some good methods for adding ambient lighting? For example... I''m using the same tileset for bright-in-the-sun situations as I am for dark-out-from-under-the-sun situations.

Instead of adjusting all of the tile''s pics to compensate for the difference of lighting... how can I do that with just one tileset...

Now I''ve been thinking about the fog-of-war type deal but I don''t know how to implement that either. So if anyone could give me some advice I''d be grateful.

##### Share on other sites
Wait a minute... how did StarCraft do it? (using DirectX 2.0 and back in the days when nothing really was supported on video cards).

If I recall correctly, there was a menu option in the game that you could adjust the gamma correction...

##### Share on other sites
Enoch: gamma control will affect the entire screen. So you can use it for day-time vs. night-time. But you will not be able to use it for a fog of war effect where you only hide part of the screen.

Of course, if you go 3D then you can control the gamma on every single vertex...

Edited by - Buster on October 4, 2000 3:37:01 PM

##### Share on other sites
Buster,

Ok, so how do I get the Gamma Control to work in DDraw? I QueryInterface but it doesn''t work.

##### Share on other sites
quote:
Original post by EnochDagor

Wait a minute... how did StarCraft do it? (using DirectX 2.0 and back in the days when nothing really was supported on video cards).

If I recall correctly, there was a menu option in the game that you could adjust the gamma correction...

Hmmm... Maybe Assembly?

EDIT: Oops, forgot the gamma stuff
Here:

  LPDIRECTDRAW7 lpdds; // your directdraw 7 objectLPDIRECTDRAWGAMMACONTROL lpdgc; // gamma control// ... initaliaze ddraw herelpdds->QueryInterface(IID_IDirectDrawGammaControl,(LPVOID*)lpdgc);

This should make DirectDrawGammaControl initaliaze
Now you can use SetGammaRamp() to change the gamma values.

- Goblineye Entertainment
The road to success is always under construction

Edited by - Tornado on October 4, 2000 4:08:53 PM

##### Share on other sites
Alright. So I tried that but it appears that QueryInterface return unsupported. So DirectX would emulate this right? Or no?

If it is not, what other ways can I control that type of thing?

##### Share on other sites
No, DX doesn''t emulate
You can check for sure if your video card can support gamma ramp with DDCAPS2_CANCALIBRATEGAMMA.
Look it up it in the SDK.
You can try using Alpha Blending instead.
It''s pretty fast, and not so hard to setup.
You can use software alpha blending (With MMX acceleration or w/o) or with D3D (Much faster).
There''s articles about it right here at Gamedev.net and at Mr-GameMaker.

##### Share on other sites
quote:

No, DX doesn''t emulate
You can check for sure if your video card can support gamma ramp with DDCAPS2_CANCALIBRATEGAMMA.
Look it up it in the SDK.
You can try using Alpha Blending instead.
It''s pretty fast, and not so hard to setup.
You can use software alpha blending (With MMX acceleration or w/o) or with D3D (Much faster).
There''s articles about it right here at Gamedev.net and at Mr-GameMaker.

Well, you really need a 3D accelerator for D3D alpha blending. I tried turning acceleration off on mine, and it ran at about 4 fps on my P3 450. That was with a textured and blended polygon though, it was more like 6 or 7 without the texture, but it''d probably be a lot slower with an actual game running behind it, so you might wanna try checking if the user has a 3D card before using it, and if not, write an asm routine to darken and lighten each pixel of the surface one at a time.

-Deku-chan

DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)

"I'm dropping like flies!" - me, playing Super Smash Bros. (and losing)
"What fun!" - me, playing Super Smash Bros. (and beating the crap out of somebody)

##### Share on other sites
quote:

Well, you really need a 3D accelerator for D3D alpha blending. I tried turning acceleration off on mine, and it ran at about 4 fps on my P3 450. That was with a textured and blended polygon though, it was more like 6 or 7 without the texture, but it''d probably be a lot slower with an actual game running behind it, so you might wanna try checking if the user has a 3D card before using it, and if not, write an asm routine to darken and lighten each pixel of the surface one at a time.

I think I had this discussion before (Was it you Deku? )
Of course you can always make replacement code in asm...

##### Share on other sites
Starcraft was in 256 color if I remember correctly, so it could do gamma correction, fades, fog etc. just by adjusting the palette.

------------------------------
#pragma twice

##### Share on other sites
theres a great article here @ gamedev that might be what you''re interested in. *digs up the adress*..

(http://www.gamedev.net/reference/programming/features/mmxblend/)

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627665
• Total Posts
2978530

• 10
• 10
• 12
• 22
• 13