Archived

This topic is now archived and is closed to further replies.

deks

DX9 floating point textures clamping?

Recommended Posts

Hi, I just discovered that I can''t have a R32G32B32A32F floating point texture containing less than zero values in it (if I offset my texture data by +128.0f and when I fetch the texel in the shader I offset it again by -128.0f, everything works fine)... is it normal behavior? DX9 docs doesn''t talk about it. I need to have signed texture data, so the offset trick works, but it eats precious pixel shader instructions. Thanks for any help, Jean-Francois

Share this post


Link to post
Share on other sites
I don''t believe this is normal behavior. Try running your app with the reference rasterizer and see if you get the same results.

Floating point textures should be able to handle any floating point value. If your numbers are getting clamped to 0, it could be because of the type of pixel shader used. I think that shaders before 1.4 clamped pixel shader output to the range [0..1]. If you have floating point textures, then you will also have at least pixel shader version 2.0. Try using pixel shader 2.0 and see if you get the same results.

neneboricua

Share this post


Link to post
Share on other sites
Texture values should be clamped from -PixelShader1xMaxValue to +PixelShader1xMaxValue, where PixelShader1xMaxValue is in the caps. Looks like 9700+ are the only ones to support a value over 8.0.

So that''s a little strange. What does your shader look like?

I like pie.

Share this post


Link to post
Share on other sites
neneboricua19: I''m using ps_2_0.

RenderTarget: Good point. I only have a FX5200 at home, but on monday I''ll confirm what you say at work. To answer your question, my shader is procedurally outputting clamped, exponentiated and lit 16 octaves perlin noise, for ultra-realistic clouds simulation for our next title. I can post screenshots on monday if you want.

Thanks all,
Jean-Francois

Share this post


Link to post
Share on other sites