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


Color Inverting in D3D

Recommended Posts

ms291052    223
Does anyone know if/how to invert colors in D3D? I would tend to think there''s some obscure renderstate somewhere to set, but I''m not quite sure. By "invert" I mean changing black to white, red to teal, green to purple, and so forth.

Share this post

Link to post
Share on other sites
S1CA    1418
You can use the D3DTA_COMPLEMENT modifier in your SetTextureStageState() setup to invert what''s being rendered during multitexture blending.

You could alternatively use frame buffer (alpha) blending with the INV***COLOR blending factors to achieve a number of inverse effects. For example if you wanted to invert the contents of what was already in the frame buffer you could render a white quad to those portions with a blend like INVDESTCOLOR:ZERO or INVDESTCOLOR:INVSRCCOLOR to achieve the inversion *.

It can of course also be achieved with pixel shaders instead of the texture stage state setup.

[* off the top of my head - don''t have the DXSDK installed on this machine]

Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP

Share this post

Link to post
Share on other sites