Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Banding artifacts in specular lighting


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 CC Ricers   Members   -  Reputation: 718

Like
0Likes
Like

Posted 04 March 2013 - 01:44 PM

When applying a specular shader function to my pixel shader, the highlights appear correct but I get some odd artifacts in the color. I'm using a basic Blinn-Phong specular implementation. The artifacts are some banding of darker colors in the bright white color of the highlight, kinda like a Moire pattern but not really. They become more apparent with higher specular powers.

 

This is done in a lighting pass for a deferred renderer by the way. It's drawing to a HDRblendable render target, don't know if that's relevant or not. I will post a screenshot later that shows the problem. For now, here is the specular shader code that I am using:

 

// Blinn D1 (Phong) specular distribution 
float BlinnPhong(float3 normal, float3 view, float3 light, float specPower)
{                    
    float3 halfVector = normalize(light + view);
    return pow(saturate(dot(normal, halfVector)), specPower);
}

 

// How it's used in the main function

 

float specLight = specIntensity * BlinnPhong(normal, directionToCamera, lightDirection, specPower);


My development blog: Electronic Meteor

Sponsor:

#2 phil_t   Crossbones+   -  Reputation: 4091

Like
0Likes
Like

Posted 04 March 2013 - 01:52 PM

How are you normals stored in your G-buffer?

#3 CC Ricers   Members   -  Reputation: 718

Like
0Likes
Like

Posted 04 March 2013 - 03:16 PM

My normals are stored in view space, with Z always 1 and X and Y converted from [-1, 1] to a [0, 1] range. Basically with the hue range very similar to this picture.


My development blog: Electronic Meteor

#4 phil_t   Crossbones+   -  Reputation: 4091

Like
0Likes
Like

Posted 04 March 2013 - 03:28 PM

Ok, well I was wondering what the precision was. If you're using only 8 bits per component, it's possible that the precision may not be sufficient to avoid banding in your scenario. If you switch to 16 bits per component, or use it in a forward rendering scenario, does the banding go away?

Another way to test if precision is the issue is to see if the banding matches up with changes in the value of the normal in your G-buffer.

Edited by phil_t, 04 March 2013 - 03:29 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS