HL2 and aliasing

Discussion in 'Architecture and Products' started by Humus, Sep 15, 2003.

  1. tEd

    tEd Casual Member
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,105
    Likes Received:
    70
    Location:
    switzerland
    john carmack mentioned the problem of texture aliasing with specular lit normal maps in his latest plan file

    Renormalization of surface normal map samples makes significant quality
    improvements in magnified textures, turning tight, blurred corners into shiny,
    smooth pockets, but it introduces a huge amount of aliasing on minimized
    textures. Blending between the cases is possible with fragment programs, but
    the performance overhead does start piling up, and it may require stashing
    some information in the normal map alpha channel that varies with mip level.
    Doing good filtering of a specularly lit normal map texture is a fairly
    interesting problem, with lots of subtle issues.
     
  2. PSarge

    Newcomer

    Joined:
    May 7, 2002
    Messages:
    147
    Likes Received:
    0
    Location:
    UK
    OK, I see your point.

    :shock: Ouch, Using the step function normally means your on the road to alias city. It introduces a infinitly sharp edge. Does HLSL have smoothstep (I'm more from RenderMan land)?

    ...and Yes, raising shinyness very high will have a similar effect.

    You win (but I'd expect to against mr bill) :)
     
  3. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    Yup, and so does GL2 too.
     
  4. mrbill

    Newcomer

    Joined:
    Feb 24, 2003
    Messages:
    36
    Likes Received:
    1
    Location:
    Marlborough, MA
    In this case it means you've ARRIVED at alias city. And even though the specular power function doesn't introduce an infinitely sharp edge, it's still introducing a sharp edge, which also puts you at alias city.

    The example above is actually OpenGL Shading Language, but yes, both the OpenGL Shading Language and HLSL have smoothstep.

    -mr. bill
     
  5. Nick

    Veteran

    Joined:
    Jan 7, 2003
    Messages:
    1,881
    Likes Received:
    17
    Location:
    Montreal, Quebec
    I think the aliasing is caused by not using or bad use of dsx/dsy. These shader instructions compute the texture gradients, which are needed to select the correct mipmap level.

    When sampling an environment map for bump mapping, you read the texture indirectly and non-linearly, so the mipmap level does not vary like a regularly 'flat' textured polygon.

    Maybe even using dsx/dsy correctly doesn't solve the problem, because the bump map makes the environment map sampling so 'random' that it would look blurred. Furthermore you can't mipmap a bump map as easily as a regular texture...
     
  6. Dio

    Dio
    Veteran

    Joined:
    Jul 1, 2002
    Messages:
    1,758
    Likes Received:
    8
    Location:
    UK
    Actually, you can't mipmap a bump map at all. The effect of mipmapping a bump map is either to flatten out the bumps, or to expand the width of the bumps.

    The former is usually the more 'acceptable' solution visually, but the fundamental problem is that the mipped bump map may reference multiple separate vectors, and since the lighting can be massively dependent on the exact vector, you really need to evaluate every one of these possible paths and sum them.

    Anything that involves mipmapping bump maps is going to look wrong, one way or another.
     
  7. bloodbob

    bloodbob Trollipop
    Veteran

    Joined:
    May 23, 2003
    Messages:
    1,630
    Likes Received:
    27
    Location:
    Australia
    Two words

    Super Sampling.
     
  8. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    Indeed. If you can't get around the problem by blurring the normal map, reducing specular exponent etc., then super sampling is the only real solution.
     
  9. OpenGL guy

    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,357
    Likes Received:
    28
    Two more words: Poor performance.
     
  10. Ailuros

    Ailuros Epsilon plus three
    Legend Subscriber

    Joined:
    Feb 7, 2002
    Messages:
    9,511
    Likes Received:
    224
    Location:
    Chania
    Then just supersample only the scene area in question.
     
  11. OpenGL guy

    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,357
    Likes Received:
    28
    Uh, you can't do that very easily. For one, how do you go from supersample to non-supersample and back? Your depth data won't make sense at all.
     
  12. Nick

    Veteran

    Joined:
    Jan 7, 2003
    Messages:
    1,881
    Likes Received:
    17
    Location:
    Montreal, Quebec
    Just like multi-sampling, but with multiple samples processed by the shader?
     
  13. bloodbob

    bloodbob Trollipop
    Veteran

    Joined:
    May 23, 2003
    Messages:
    1,630
    Likes Received:
    27
    Location:
    Australia
    This is actually a problem with all pixel shaders I believe unless I am mistaken if you use a shader to create a checkboard texture to a surface you will not get the blurring that occurs with mipmaping of a texture.

    What has to happen but won't for a few more years is all pixel shaders have to be written to a texture and then resampled as a texture or something similar this allows for the super sample and you won't have to worry about the Z problems :).

    Just like SS this has bad preformance.
     
  14. sireric

    Regular

    Joined:
    Jul 26, 2002
    Messages:
    348
    Likes Received:
    22
    Location:
    Santa Clara, CA
    Not to say that things are all perfect, but I just took a gander at the video, and it's not very good. There's tons of aliasing due to the video compression used/encoding.

    I saw the original (on a giant plasma screen) and it was awsome. I would of noticed the bad artifacts, which appear on the video.

    You will be impressed with the real thing.
     
  15. K.I.L.E.R

    K.I.L.E.R Retarded moron
    Veteran

    Joined:
    Jun 17, 2002
    Messages:
    2,952
    Likes Received:
    50
    Location:
    Australia, Melbourne
    I hope not. That would mean I would have to go outside to buy it.
     
  16. Hanners

    Regular

    Joined:
    Jul 12, 2002
    Messages:
    816
    Likes Received:
    57
    Location:
    England
    Isn't that what Steam is for, to stop you agoraphobic people from having to worry about going out? ;)
     
  17. K.I.L.E.R

    K.I.L.E.R Retarded moron
    Veteran

    Joined:
    Jun 17, 2002
    Messages:
    2,952
    Likes Received:
    50
    Location:
    Australia, Melbourne
    Oh yeh. Hehehe. :D
     
  18. Dio

    Dio
    Veteran

    Joined:
    Jul 1, 2002
    Messages:
    1,758
    Likes Received:
    8
    Location:
    UK
    That's a very good point, actually. (I think mrbill is having a discussion around this in another thread as well).
     
  19. Simon F

    Simon F Tea maker
    Moderator Veteran

    Joined:
    Feb 8, 2002
    Messages:
    4,563
    Likes Received:
    171
    Location:
    In the Island of Sodor, where the steam trains lie
    You can in a lot of cases: In a past job we had AA'd procedural textures in a raytracer using just one 'sample' and knowledge of the size of the area to be sampled.
     
  20. PSarge

    Newcomer

    Joined:
    May 7, 2002
    Messages:
    147
    Likes Received:
    0
    Location:
    UK
    That's the classic way of AA in shaders.

    The problem here (and I think I finally understand where Humus is coming from. Sleep is wonderful) is that a small area on a surface which has high curvature can have reflected in it the image of a very large area.

    Think about a shiny ball bearing in a cathedral. If that ball bearing covers just a single pixel in the rendered image then it's colour should be the average of the whole environment, but what it's more likley to be is a single sample of the environment map in a reflection direction. As you move the reflection direction will change wildly and hence alias.

    I guess what you'd want to do is calculate a LOD for the environment map look-up, but that's not necessarily easy.
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...