Jump to content

  • Log In with Google      Sign In   
  • Create Account

How does one use Color Key in D3D 11?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 noatom   Members   -  Reputation: 782

Like
0Likes
Like

Posted 13 October 2012 - 09:52 AM

Ok,in D3D 9 you had this function:

HRESULT D3DXCreateTextureFromFileEx(LPDIRECT3DDEVICE9 pDevice,
LPCTSTR pSrcFile,
UINT Width,
UINT Height,
UINT MipLevels,
DWORD Usage,
D3DFORMAT Format,
D3DPOOL Pool,
DWORD Filter,
DWORD MipFilter,
D3DCOLOR ColorKey,
D3DXIMAGE_INFO* pSrcInfo,
PALETTEENTRY* pPalette,
LPDIRECT3DTEXTURE9* ppTexture);

Notice the D3DCOLOR ColorKey argument,so all you had to do is just pass in a color when you created a texture,and that color would be used for coloy keying! Simple right?

But notice that the function wants a D3D9 device!


Is there a function or something like this,to use color keying as easy as here? Because in the D3D11 equivalant there is no color key in any function...

Sponsor:

#2 jbb   Members   -  Reputation: 328

Like
0Likes
Like

Posted 13 October 2012 - 11:28 AM

I imagine you could do it in your pixel shader quite easily. If the pixel you sample is your color key then simply don't output it.

#3 mhagain   Crossbones+   -  Reputation: 7979

Like
0Likes
Like

Posted 13 October 2012 - 11:39 AM

Color keying, IIRC, was removed from D3D10/11. If you need to use a palette then encode it as a 1D texture, then look it up using the result of a previous texture lookup to get the palette index.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#4 noatom   Members   -  Reputation: 782

Like
0Likes
Like

Posted 13 October 2012 - 11:49 AM

I did this:

[source lang="cpp"]float4 TexColor = float4(1,1,1,1); TexColor = gDiffuseMap.Sample( simple, pin.Tex ); clip( (TexColor.r == 1.0f) && (TexColor.g == 1.0f) && (TexColor.b == 1.0f) ); return TexColor;[/source]

But there is still white in the background...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS