@warrenm Hey! - mind a quick q ? I am encoding depth 16 images (half float) as 2 8 bit unsigned chars (high/low for encoding), & want use in a metal shader. Is this doable? Can I make a half float from 2 8 bit values?
Sorry if obvious / dumb but hey thats where Im @ :D
-
-
Replying to @_vade
If you have the depth image data in that format, you can copy it to a texture of r16Float format and sample it in a shader by binding it as a texture2d<half, access::sample>. Feel free to DM for further detail, or if I'm misunderstanding.
1 reply 0 retweets 0 likes -
Replying to @warrenm
My depth texture is encoded as two channels of a BGRA unorm HEVC stream - I take the half float high and low bits to 8 bit r & g channels. Was curious how to re mix the two 8 but values in a shader post sample of the texture.
1 reply 0 retweets 0 likes -
Replying to @_vade
Maybe something like this? ushort d = (depthSample.r << 8) | depthSample.g; half depth = *reinterpret_cast<thread half *>(&d);
2 replies 0 retweets 1 like -
Replying to @warrenm
Oh interesting. Had no idea you could reinterpret cast in a shader. Shit. Ha. Thanks!
1 reply 0 retweets 1 like -
-
Replying to @warrenm
I suppose I thought it was a subset like CILK > GLSL but fool me once :P
1 reply 0 retweets 0 likes
It’s a “static” subset of C++14 (no RTTI, dynamic_cast, virtual, etc.), but it’s got a surprising amount of the rest (no lambdas, though
).
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
