Sign in to follow this  

Is it possible that pixel shader is not executed for all pixels?

This topic is 4073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm doing a "render to texture" and it looks like pixel shader is not executed for some pixels. All textures are G16R16F, however only one channel is used. I've got 8 textures, where each texture is a blur of the image stored in the 1st texture. There's another texture (luminance map) that is cleared to black (0.0f) at the beginning of the frame. In a loop I'm checking difference between adjacent blur textures and if the condition is met, luminance map is updated with pixel value from the blur texture. In the last iteration every pixel that is still black is updated using value from the last blur texture. This way there should be no black pixels in the luminance map (assuming there are no black pixels in blur textures). However I still get black pixels near pixels, which values differ greatly. Here's the shader for updating luminance map:
float4 PS_UpdateLocalLuminance( VSOutput input ) : COLOR
{  
  float localLuminance = tex2D(localLuminanceTextureSampler, input.TexCoords).r;
  
  // If there's no local luminance yet, calculate the difference
  if (localLuminance < 1.0f/65535.0f) // 1.0f/2^16 resolution of 16 bit floating point value
  {
    float prevGauss = tex2D(gaussTextureSampler, input.TexCoords).r;
    float currGauss = tex2D(currGaussTextureSampler, input.TexCoords).r;
    
    float difference = abs( prevGauss - currGauss );
    
    // If difference is greater than a threshold, set previous Gaussian convolution as local luminance
    if (difference > 0.05f)
      localLuminance = prevGauss;
  }  
  return float4(localLuminance, 0.0f, 0.0f, 0.0f);
}

float4 PS_FinalUpdateLocalLuminance( VSOutput input ) : COLOR
{  
  float localLuminance = tex2D(localLuminanceTextureSampler, input.TexCoords).r;
  
  if (localLuminance < 1.0f/65535.0f)
  //if (localLuminance < 1.0f)
  {    
    float prevGauss = tex2D(gaussTextureSampler, input.TexCoords).r;
    localLuminance = prevGauss;
  }  
  return float4(localLuminance, 0.0f, 0.0f, 0.0f);
}


I tried changing 1.0f/65535.0f to 1.0f and there was less black pixels, however there still were some. Maybe that's because something is wrong with my texel->pixel mapping? Maybe it takes a sample of 2 (or more) pixels, where one is already updated and one is black, so the average value is non-zero? I asked about it in this topic in Beginner's forum, but didn't get any answers if the mapping I'm using is correct. Thanks in advance

Share this post


Link to post
Share on other sites

This topic is 4073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this