Sign in to follow this  

FFP and Gamma Control, which is better?

This topic is 4204 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

I want to implement a fading effect that can run on old graphic cards. So pixel shader here is out of my consideration. Now there are 2 ways: - Set a new curve of Gamma Control in every frame when fading. - Use FFP to multiply the texture color and diffuse color, and update diffuse color in every frame. Which one is supported wider? There seems to be another way of putting a transparent square in front with changing color, but I prefer the 2. And, is there a list of d3dcaps of different cards?

Share this post


Link to post
Share on other sites
This is usually done by alpha-blending a screen-sized quad over your scene. You can vary the alpha through D3DRS_TEXTUREFACTOR rather than having to touch the vertices.


Here's a website with a caps database: http://www.netsphere.jp/dxinfo/

Share this post


Link to post
Share on other sites
Such a great website! Thanks!

How could I do that alpha-blending?
Create another quad, put it in front of the existing objects, draw it using D3DTOP_BLENDFACTORALPHA ?
What should the Arg1 and Arg2 for this operation be?

Share this post


Link to post
Share on other sites
Create a full-screen sized quad using this FVF:

D3DFVF_XYZRHW

Initialize the vertex data:

{
{0.0f, ScreenHeight, 0.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 1.0f},
{ScreenWidth, ScreenHeight, 0.0f, 1.0f},
{ScreenWidth, 0.0f, 0.0f, 1.0f}
}

Enable alpha blending:

D3DRS_ALPHABLENDENABLE = TRUE
D3DRS_SRCBLEND = D3DBLEND_SRCALPHA
D3DRS_DESTBLEND = D3DBLEND_INVSRCALPHA

Set the texture stages:

D3DTSS_COLORARG1 = D3DTA_FACTOR
D3DTSS_ALPHAARG1 = D3DTA_FACTOR
D3DTSS_COLOROP = D3DTOP_SELECTARG1
D3DTSS_ALPHAOP = D3DTOP_SELECTARG1


Set D3DRS_TEXTUREFACTOR with the desired color and alpha of the quad. If you're doing a fade-to-black effect, then start with 0x00000000 and incrementally increase the alpha value each frame until it reaches 100% opacity (0xff000000).

Draw your scene, then draw the quad as a triangle strip. You should disable Z buffering for this quad.

Share this post


Link to post
Share on other sites

This topic is 4204 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this