Archived

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

EdwardKoo

Fast 16-Bit Water/Wave Effects.

Recommended Posts

TerranFury    142
Color cycling by definition deals with paletted colors, so I can understand why it wouldn''t work (it seems strange that it works at all) in 16 bit mode. I would recommend this: Perform the color cycling using an 8-bit off-screen surface, and then blit from this to a 16 bit surface. That means that, though your water will be limited to a 256 color palette, the rest of your graphics will not. And even the water will still look fine, because you will only be using 256 shades of blue!

Then again, this is all assuming you''re using DirectDraw. Otherwise, I''m not sure what you should do.

Even if you are, this might not work.

Share this post


Link to post
Share on other sites
EdwardKoo    122
I am actually using that method now. Color cycling an 8-bit image
and draw it to a 16-bit surface. It''s just too slow.

I think i better just use a sprite to simulate the effect.
Anyway, thanks for suggestion.

Share this post


Link to post
Share on other sites
Nazrix    307
Check out this engine:

Isotest

He has a really nice water animation, and I don''t think the artist minds people using it as long as he gets credit.



Need help? Well, go FAQ yourself.
What a plight we who try to make a story-based game have...writers of conventional media have words, we have but binary numbers

Share this post


Link to post
Share on other sites
ericvids    122
In 16-bit color modes and higher, you could use a gamma control to simulate the effects of palette-based color cycling without making it too slow, if you've got the hardware.

In DirectX 7 (I'm assuming this is what you're using, since I don't see a reason to use color cycling on 3-D games =)), you should get an interface to the IID_IDirectDrawGammaControl:

  
IDirectDrawSurface7 *pDDSPrimary; // your primary surface (assume we already have this)

IDirectDrawGammaControl *pDDGamma; // your gamma control

pDDSPrimary->QueryInterface(IID_IDirectDrawGammaControl, (void **) &pDDGamma);


Then use the DDGAMMARAMP structure to set the colors:

  
DDGAMMARAMP ddGammaRamp;
for (int i = 0; i <= 255; i++) {
ddGammaRamp.red[i] = red value;
ddGammaRamp.green[i] = green value;
ddGammaRamp.blue[i] = blue value;
}
pDDGamma->SetGammaRamp(0, &ddGammaRamp);


Each color value expected is a DWORD from 0 to 65535 (NOT just 0 to 255). The gamma should take effect automatically when you set it.

This thing works best in combination with a decent lookup table. I assume that you know how to deal with that already =)

Note: As I mentioned earlier, this thing only works with hardware that supports it. I'm using an NVidia Riva TNT2.


Edited by - ericvids on March 23, 2001 11:17:28 AM

Share this post


Link to post
Share on other sites