I’m in Unity 2018.4.20f1 I have a CRT configured as a 128x64 ARGB texture. It has as fragment shader which only uses floats and outputs a float of 100000.0.
I then read that texel in on a surface, and it reads back 65504, but only when in-game, or “playing.” In editor mode, it returns a nice solid 100000.0.
I’ve tried several methods of reading the pixel’s data, including Texture2D with .Load, regular tex2D and .Sample.
All three methods behave the same.
…
Texture2D<float4> _AudioLinkTexture;
#define GetAudioPixelData( pxcoord ) _AudioLinkTexture.Load( int3( pxcoord, 0 ) )
…
sampler2D_float _AudioLinkTexture;
#define GetAudioPixelData( pxcoord ) return tex2Dlod( _AudioLinkTexture, float4( pxcoord*_AudioLinkTexture_TexelSize.xy, 0 ,0) );
…
UNITY_DECLARE_TEX2D_NOSAMPLER(_AudioLinkTexture);
SamplerState sampler_AudioLinkTexture;
#define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex.SampleLevel(sampler##samplertex,(coord).xy,(coord).w)
#define GetAudioPixelData( pxcoord ) UNITY_SAMPLE_TEX2D_LOD_SAMPLER( _AudioLinkTexture, _AudioLinkTexture , float4( pxcoord*_AudioLinkTexture_TexelSize.xy, 0 ,0) )
…
What else can I try?
EDIT: This is on Windows, with an RTX 2070 GPU. So I have NO IDEA why it’s truncating to half.