When I check the log values of both the original floats and the converted uints at the point of assignment, the values are correct for their position.
I then use this Texture2D as a sample in a material (shader), in that material if I test the values, they have shifted. Let me illustrate what I mean by showing a threshold operation for values >0.5
As you can see the place where the values should be 0.5/0.5 is no longer in the center (as it was assigned at creation) but now shifted much closer to the end of the ranges.
I sampled the color values with the tone mapper disabled and this shift appears to have a quadratic fit
Is this image compression at work? If so how do I stop this from happening. I need the full 8bit values to be unaffected in order to be correctly used as UVs further down the material chain.
I’m guessing this is the default behavior for 8bit channel textures? What about float textures(e.g. 32bit float per channel textures)? These should have enough precision to not use gamma correction or is this a default behavior for all textures?
As an aside I’ve been trying to get float channel textures to work, but they always seem to give me an access error despite being formulated in the exact same way as the example above (without the uint8 conversion).
What data structure does PF_FloatRGBA expect? when you get the MipData from
I’m guessing this is the default
behavior for 8bit channel textures?
What about float textures(e.g. 32bit
float per channel textures)? These
should have enough precision to not
use gamma correction or is this a
default behavior for all textures?
No, as I know gamma correction is enabled by default (but exist some exceptions) and it is not depend from texture format. My opinion that PF_R8G8B8A8 format is more than enough (256^3 colors can be represented). However, if you want to hold some other type of information in the texture that require more precision (like depth, etc.) it cannot be enough.
You can use PF_A32B32G32R32F to store floats (4 floats per pixel). In addition, SRGB option has no effect on the texture sampling in this case.
PF_FloatRGBA = corresponds to DXGI_FORMAT_R16G16B16A16_FLOAT (structure FFloat16Color).