🔒 Locked
Greyscale
Advertisement
Original Post
quote:
Original post by Ilankt
There is another way to do it?
i know (well, think) there is a way to do it in OGL, and in DirectX not??!
Whats the code to do it in OpenGL?
.lick
The SEARCH is working y''know:
http://www.gamedev.net/community/forums/topic.asp?topic_id=111422
http://www.gamedev.net/community/forums/topic.asp?topic_id=154727
http://www.gamedev.net/community/forums/topic.asp?topic_id=62579
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
http://www.gamedev.net/community/forums/topic.asp?topic_id=111422
http://www.gamedev.net/community/forums/topic.asp?topic_id=154727
http://www.gamedev.net/community/forums/topic.asp?topic_id=62579
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
The search doesn''t always work. For me the forums are really quick, but the search takes a long time or just times out on me.
I''m afraid I can''t answer your question, but there will be a way to do it without pixel shaders.
I''m afraid I can''t answer your question, but there will be a way to do it without pixel shaders.
From section C-9 of colorspace faq (www.faqs.org):
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B;
Which can also be written:
Y = dot(float3(0.212671f, 0.715160f, 0.072169f), Color.rgb);
All that is required to convert a RGB value to grayscale is one DOT3 instruction. The DOT3 instruction is available in all pixel shader models, and is also available as a fixed-function TSS operation on some cards (check caps).
The weights may vary depending on your display device, and the lighting enviornment you are viewing it in. For example, for NTSC TV signals (usually viewed in a darkish room), the values would be more like (0.299, 0.587, 0.114)
xyzzy
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B;
Which can also be written:
Y = dot(float3(0.212671f, 0.715160f, 0.072169f), Color.rgb);
All that is required to convert a RGB value to grayscale is one DOT3 instruction. The DOT3 instruction is available in all pixel shader models, and is also available as a fixed-function TSS operation on some cards (check caps).
The weights may vary depending on your display device, and the lighting enviornment you are viewing it in. For example, for NTSC TV signals (usually viewed in a darkish room), the values would be more like (0.299, 0.587, 0.114)
xyzzy
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement
