Hi all,
I come to this forum bearing a big problem in a fragment shader
that I’m working on - I’ve cornered it into this little piece
of code that gives me pixels that are neither a value, nor #inf
nor #nan, ( are they discarded ? ). my main function looks like:
1.vec4 flow = texture2D( VelDenMap, uv );
2.float p = flow.z;
3.float ad = smoothstep( 0.0, advection, clamp(p, 0.0, 1.0) )
4.gl_FragData[0] = vec4( ad );
advection is 0.8, VelDenMap is a 32-bit float texture
which is initialised to 0.0 ( im sure of that )
now, when I render the resulting float32-texture with a shader
that displays each pixel as
p = ( p - lower ) / ( higher - lower )
where lower and higher are the upper-and lower bounds for the range of values i want to display, everything outside of the
range [0,1] will be shown as a noise-texture, the image
remains black, even setting lower = higher = -10.0, or
lower = higher = 10.0.
however, when I change line 4 into
4.gl_FragData[0] = vec4( p );
all is fine, proving that p is a legal value. the same goes
for
4.gl_FragData[0] = vec4( advection );
also checking against NAN with
float inf1 = 1.0 / 0.0;
float inf2 = 1.0 / 0.0;
float nAn = inf1 * inf2;
if( ad == nAn )…
if( ad == inf1 )…
doesn’t detect ‘ad’ as being infinite or nan. ( thats why i
think the pixels may be discarded )
similar problems arise as soon as I use f.i. the ‘dot’ function.
does anyone have an idea what’s going on ?
Thanks,
jonathan