   Value Range in RenderTarget
  i know this is a very stupid question but i didn't find any answer!In HlSl when i write a value in a rendertarget the value is converted to 0->1.0 or it is written with is value.What happen if i write in a rendertarget a value of 128 it will be converted to 0.5 or ...?I want to write in a deferred engine the glossiness value the range is from 0 to 500, so it is correct when i resolve the specular equation multiply the value read in the taxture per 500 ?How to mantain the original value?   
  AFAIK it depends on the type of render target you are writing to.You can have an integer render target and store values like 128. If you write 128 to a normalized render target I think it will get written as 1. So you could write x / 500.f and multiply that value with 500.f again after reading it, yes.   ;  It depends on the surface format. For unsigned normalized integer formats (UNORM), your output will be clamped to the [0, 1] range (so if you output 5.5, it gets clamped to 1). For signed normalized formats (SNORM), your output is clamped to [-1, 1]. For signed and unsigned integer formats (UINT and SINT), the output is truncated and output as an integer (so 5.5 becomes 5). For floating point formats, the value is output directly (5.5 stays as 5.5).In D3D9, all integer render target formats are unsigned normalized. So your output will be clamped to [0,1]. If you want to have a range like [0,1], you would have to divide your value by 500 before outputting (and then multiply by 500 when sampling it later). Or you can just use a floating point format, and you won't have to do any conversion. In D3D10/D3D11, the DXGI formats have the suffixes I mentioned above which tell you their behavior.   ;  Hi,Quote:How to mantain the original value?If you want to store your value with high precision, I recommend you to use logarithmic conversion. I use it in my deferred renderer and it works fine.Here you're:For value "x", you can write "y = log2(x) / 10.5f + 1" to your render target. Then you can get the original value by using "x = pow (2, (y - 1) * 10.5)" equation.For your glossiness parameter (say, G);0 <= G <= 500,and, for value to be stored (say, GS);0.051f <= GS <= 1.854fIf you use 16bit RGBA, I think you can store with high precision.hth.   