Skip to main content
gamedev.net
🔒 Locked

Signed floating point texture

Started by Alundra Aug 29, 2014 at 9:39 PM 0 replies 1.2k views
Original Post
Alundra
Alundra

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 ?

L. Spiro
L. Spiro

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.