Flickering and aliasing - fresnel reflections

Discussion in 'Technical Archives' started by feels3, Sep 30, 2012.

  1. feels3

    feels3 Member Staff Member

    Joined:
    Sep 4, 2011
    Messages:
    1,201
    Likes Received:
    142
    Last edited by a moderator: Sep 30, 2012
  2. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    Aliasing on edges is typical for materials with fresnel reflections. My shaders for rF1 have this issue aswell. It can be partially solved in pixel shader, but being limited to Shader Model 2.0 i ran out of instructions so it stayed this way.


    Two factors contribute to it:

    1. The fact that reflected environment doesn't exactly match surroundings of given polygon.

    Actually, all games have it (more or less apparent, but it's there), because cubemap must be captured at one given point in space. In this case entire building is using one cubemap that contains sky and therefore contrast on edges is very obvious.

    To solve this, I suggest placing reflection mapper inside garage and include garage instance in it.
    Then create another reflection mapper in the same place, but without garage included.
    Use first reflection mapper for materials inside garage and the other one for materials on the outside of garage.

    This way you will avoid having sky reflection on objects inside garage.


    2. Low tesselation of models.

    Normal vectors are interpolated between vertices. It's very similar to shadow vs lighting problem I described in my .pdf about geometry.
    If the triangle you see near edge is facing 5 degrees towards us and next triangle (the one we don't see) is facing 15 degrees away from us, then normal vector at the edge between these triangles is facing 5 degrees away from us (straight average).
    This means that what we see on edge is performing lighting, reflection and fresnel calculations based on normal vector that is facing away from observer. You wouldn't see a sufrace facing away from you in reality, yet in realtime graphics these things happen due to low tesselation.

    Here's how it happen - we're looking at the yellow polygon. Red arrows show normal vectors:

    [​IMG]

    And here is the reflection:

    [​IMG]

    Blue arrows show our line of sight and green arrows show our line of sight after being reflected according to normal vector.
    Note that in case of upper vertex, we're looking at normal vector "from the bottom" and reflection will actually turn our line of sight towards polygon, which is impossible in reality.

    That's the problem right there. If you look at my .pdf about geometry there's an example with cube with round edges there. There was a problem of far edges of cubes being dark. And it was the same reason - polygons facing observer had some normal vectors facing away from observer, so they were partially lit as something observer wouldn't normally see.


    You could say, that insdead of ricochet, you're getting a slingshot ;)


    Shaders may partially solve it by tweaking normal vectors never to face away from observer, but "highlighted edges" are just something typical for fresnel reflections. The higher fresnel power is used and the higher difference between min and max fresnel is, the more aliasing you will get.
    So another solution to your problem would be using much less fresnel max and just go with reflections that aren't very sensitive to viewing angle. Should be enough for most materials inside garage.



    Here's an example of specular reflection going wild on a post:

    [​IMG]

    It's not so obvious on upper part of post, because it has bright sky in the background, but it's clearily visible with trees in background.
    If this post had actual reflections of sky and trees, then it would be much less apparent.
     
    Last edited by a moderator: Oct 1, 2012
    1 person likes this.
  3. feels3

    feels3 Member Staff Member

    Joined:
    Sep 4, 2011
    Messages:
    1,201
    Likes Received:
    142
    Thanks for the detailed explanation.
     

Share This Page