Sign in to follow this  
Alundra

Signed floating point texture

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this