Sign in to follow this  
g0nzo

HLSL question

Recommended Posts

Hi, I'm converting an image from RGB to Yxy color space in pixel shader. I need to store Yxy values in one texture (so I can later convert back to RGB) and Y value only in another texture. Is it possible to do it in a single pass or do I have to convert to Yxy first and then just copy Y value in another pass? One more thing: does pixel shader always have to return float4? Even if I'm rendering to single channel texture? [Edited by - g0nzo on October 3, 2006 4:57:36 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by g0nzo
Hi,

I'm converting an image from RGB to Yxy color space in pixel shader. I need to store Yxy values in one texture (so I can later convert back to RGB) and Y value only in another texture. Is it possible to do it in a single pass or do I have to convert to Yxy first and then just copy Y value in another pass?

One more thing: does pixel shader always have to return float4? Even if I'm rendering to single channel texture?


u can render to multiple textures at the same time (see MRT in the dx doc), this way u can store Yxy at the same time as just Y. But the most GPUs have the restriction to use the same size per pixel on each of the set textures, so if u use R8G8B8A8, u have to use R8G8B8A8, R16G16 or R32 as the second texture.

u can return whatever u want to, the compile will handle it the correct way, but the hardware uses float4 only.

Share this post


Link to post
Share on other sites

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