XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Problem with SurfaceFormat.Single and Texture Content Processor

Last post 04-23-2008 8:13 PM by scriventhorpe. 4 replies.
  • 04-22-2008 11:57 AM

    Problem with SurfaceFormat.Single and Texture Content Processor

    I'm trying to load a floating-point format texture (.dds file with a Single surface format) using the content pipeline, to use as a heightmap.  I changed the Texture Format parameter in the content processor to NoChange but when I get the pixel data the values are slightly off from what was passed in to SetData. This only happens when using the content pipeline. If I load the texture with Texture2D.FromFile() there's no problem, so I assume the content pipeline is compressing the texture. Is there a way to disable this? Thanks.

  • 04-23-2008 1:47 PM In reply to

    Re: Problem with SurfaceFormat.Single and Texture Content Processor

    I'm not aware of any reason this would be happening.

    More details, please. How do you get the data into your texture? What exactly do you do with this at runtime? How are you testing to see that the values are coming out different? Exactly how different are they? etc.
    XNA Framework Developer - blog - homepage
  • 04-23-2008 5:37 PM In reply to

    Re: Problem with SurfaceFormat.Single and Texture Content Processor

    To get the data in I'm basically mapping the height values of a terrain made in a level editor to a 0.0 - 1.0 range, storing them in an array of floats, and passing the array in to Texture2D.SetData.  I'm saving the texture using the Dds file format.  When I load the texture in my engine using Texture2D.FromFile and pass a float array into GetData, the values are the same as in the array I used to set the data, but if I load the texture through the content pipeline, the values are off by a maximum of around .02.  Values close to 1.0 are lowered and values close to 0.0 are raised, and the amount of the error decreases as the values approach 0.5.  Also, values that are exactly 1 or 0 are not changed. 

    One other thing that might be relevant is that when I load the texture using the content pipeline in XNA 1.1 using the Texture (mipmapped) processor, it works just fine. 

  • 04-23-2008 6:21 PM In reply to

    Re: Problem with SurfaceFormat.Single and Texture Content Processor

    Interesting... I can't think of any reason this would be happening.

    Are you applying any other processing to your texture, for instance resizing to power of two in the processor, or color keying?


    XNA Framework Developer - blog - homepage
  • 04-23-2008 8:13 PM In reply to

    Re: Problem with SurfaceFormat.Single and Texture Content Processor

    Yup, it was the color keying.  I set it to false and it works.  Thanks!
Page 1 of 1 (5 items) Previous Next