Jump to content

R16 Texture Sampling


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

This constant corresponds to VK_FORMAT_R16_SFLOAT, so the values are just a 16-bit floating point number with any value. I think the limits of half-floats is somewhere around +/- 65000.0.

I use this format for terrain heightmaps. It's nice because you don't have to worry about scaling an integer value between a min and max.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Solution

Every value except the red channel will be 0, so you might as well do this:

float h = texture(texture2DSampler[textureID], texcoords.xy).r;

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

17 hours ago, SpiderPig said:

Oh cool, thanks.  And that'll still between 0 and 1 yeah?

No, why would it be? It's just a floating point number.

17 hours ago, SpiderPig said:

Also I couldn't save a pixmap with R16 format as DDS.  I saw you had it working here though, is this no longer supported?

It should work. If not this is a bug. I am pretty sure DDS supports this format.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...