Archived

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

Gamma Control

This topic is 6281 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 object

LPDIRECTDRAWGAMMACONTROL lpdgc; // gamma control


// ... initaliaze ddraw here


lpdds->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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
quote:
Original post by Tornado

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 this post


Link to post
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? )
The more features you add to your game -> The more specs your computers needs -> Your target audience decreases.
Of course you can always make replacement code in asm...

Share this post


Link to post
Share on other sites