Jump to content
  • Advertisement
Sign in to follow this  
Alundra

Signed floating point texture

This topic is 1417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I have a heightmap data for a terrain I need to create a texture of it but if I send the floating point data I don't have the sign, all values are positive.

What is the good way to handle the creation of floating point texture in Direct3D11 ?

If texture 16 bits floating point is used, what is the good way to convert to unsigned short ?

Thanks for the help

 

EDIT:

The problem of float texture was because I used a linear sampling state and not a point sampling state.

Still the question about float to unsigned short, 0.5f * (value / 32767.0f) + 0.5f sounds the best option ?

Edited by Alundra

Share this post


Link to post
Share on other sites
Advertisement

If you need the texture data to be 16-bit unsigned short, there is no reason not to make the conversion on the CPU and just make a texture that just holds 16-bit unsigned short data.

How to handle the negative values is up to you.  Whether you want to simply clamp them or if you want to shift the whole range of values from [-1,1] to [0,1] is your choice based on your needs.  The hardware can perform normalization for you at no cost.

 

 

L. Spiro

Edited by L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!