Jump to content
  • Advertisement
Sign in to follow this  
vireshmj

Luminance rendering

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

HI there HOw do i get a black and white rendering of my frame buffer. I want to display my normal 3D RGBA colour output to Gray scale colours. Do i have to just set buffers or do something complicated. Thanks Viresh

Share this post


Link to post
Share on other sites
Advertisement
You need to render to a texture and then use a fragment shader on that texture to do the conversion as you place the texture on the screen.

Share this post


Link to post
Share on other sites
Instead of doing it in a separate pass, you could also just tack it on at the end of your final renderpass. Compile two different versions of your final shader, one with the grayscale and one without the grayscale, and switch between the two depending on when you want to render in grayscale.

A common luminance formula is Y = 0.2126*R + 0.7152*G + 0.0722*B, however I've also seen a shorter Y = 0.3*R + 0.59*G + 0.11*B. You can probably Google for a bunch of variations.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!