Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to create a render target that is 32-bit, with 16 bits each for alpha and luminance. The closest surface formats I can find in the DirectX SDK are:

D3DFMT_A8L8   // 16-bit using 8 bits each for alpha and luminance.
D3DFMT_G16R16F   // 32-bit float format using 16 bits for the red channel and 16 bits for the green channel.

But I don't think either of these will work, since D3DFMT_A8L8 doesn't have the precision and D3DFMT_G16R16F doesn't have an alpha channel (I need a separate blend state for alpha).

How can I create a render target that allows a separate blend state for luminance and alpha, with 16 bit precision on each channel, that doesn't exceed 32 bits per pixel?

share|improve this question
1  
I think your only choice is to use multiple render targets for this approach. – r2d2rigo Jun 21 '11 at 18:35
That's a good suggestion, worth looking into. What about encoding a float into 2 channels? Like, putting luminance in RG and alpha in BA in a R8G8B8A8 render target. Are there good examples of this anywhere? – J Junker Jun 21 '11 at 22:52
@Junker If that were possible (and Id swear at the end of the day it should be but my knowledge of DirectX is dated) why wouldnt you use the G16R16F format? – James Jun 21 '11 at 23:31
I'm also looking at getting this working on another target platform, and it turns out it doesn't support G16R16F, so I'm hoping to find a way to encode 2 8bit channels into a 16 bit channel and still support the blend modes for downsampled translucency – J Junker Jun 22 '11 at 16:53
HLSL shaders are ignorant of the implementation of the datatype they are stored in, so you couldn't really bit twiddle it into two floats. And trying to jam it in there otherwise will be error prone and won't likely match up to the same 16 bits that you'd expect. You could use MRT's nad two R32F textures however. – Arelius Jun 23 '11 at 0:19

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.