0
votes

When using HalfSingle/Single format for my Texture2D, XNA complains that sampling must be set to PointClamp, and this makes my texture look jagged. I am actually using this to pass depth data to the shader, so I am trying to get a better dynamic range than simply using RGBA grayscale values.

If I use Color or Bgra, then I basically only have 255 levels. If I encode the depth values as color pixels, then I can enable antialiasing, but then it doesn't work correcly because the sampler treats each byte/nibble separately when lerping.

Question:

Is there a way to tell HLSL to sample my floating point texture using anti-aliasing filters, or do I need to write the shader myself?

1

1 Answers

0
votes

It turns out there are two ways to solve this:

  1. Pack .NET 32-bit floats into a RGBA using my own conversion methods, or

  2. Use SurfaceFormat.Rg32 to pack two 16-bit floats into RGBA (this format supports texture filtering).

I went for the first method.