Parallax occlusion mapping (version 0.1)

Discussion in 'Art' started by MOOtant, Aug 7, 2009.

  1. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    Parallax occlusion mapping (version 0.2)

    I played a bit with material system in Source SDK lately and I managed to change VertexLitGeneric to use parallax occlusion mapping. Most of the code was already there, written by Valve.

    It isn't ready for general use. It has no real shader fallback, it doesn't support anything lower than SM 3.0 and practically every material parameter that exists in VertexLitGeneric is disabled.

    These screenshots were made using a simple cube with texture on it with heightmap attached. Textures are from DirectX samples. Screenshots 3 and 4 look weird because I set heightmap scale too high.

    Next thing that I plan to implement is normal mapping. Currently bumps look like holes at some angles because lighting treats it as flat surface.

    If you want to play with the shader, download this file and extract it in SourceMods/Empires.
    v_0_1.zip

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]
     
    Last edited: Aug 9, 2009
  2. Uninspired

    Uninspired Member

    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    The third and fourth ones make me dizzy.
     
  3. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    It looks fine when you set scale to 0.025 instead of 0.2 that I used for screenshots 3 and 4.
     
  4. BitterJesus

    BitterJesus Member

    Messages:
    1,936
    Likes Received:
    3
    Trophy Points:
    0
    Wow, that looks neat.
     
  5. PwnedYoAss

    PwnedYoAss Member

    Messages:
    1,088
    Likes Received:
    39
    Trophy Points:
    0
    Wow, MOOtant high fucking five buddy! WE HAVE PARALLAX MAPPING! The problem is it kills your FPS.
     
  6. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    It's not a big problem. When running DirectX sample bump mapping I get 1100 FPS and with parallax mapping I get 400 FPS. There will be shader fallback and also option that switches back to bump mapping.
     
  7. Caelo

    Caelo Member

    Messages:
    2,371
    Likes Received:
    5
    Trophy Points:
    0
    meh just get it to work goddamit :) I need a good reason to buy a new gfx card :P
     
  8. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    G.odly
     
  9. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    I fixed some bugs and enabled normal mapping. If you want shader to work you need to have base color texture, normal map and a height map.

    I'll upload shader files later.

    [​IMG]
    [​IMG]
    [​IMG]
     
  10. PwnedYoAss

    PwnedYoAss Member

    Messages:
    1,088
    Likes Received:
    39
    Trophy Points:
    0
    So, MOOtant how do you plan on implementing this into Empires? Code-wise that is!
     
  11. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    You put shader DLL in bin/ and that's all. When making a material you use "Emp_Parallax" instead of "VertexLitGeneric".
     
  12. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    Here are some screenshots showing how models can look with parallax occlusion mapping. Most of them have height map that is of far too low resolution. That's why you see all this stretching. NF light tank looks worst because continuous surface on the model isn't continuous in texture.

    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
     
  13. Chris0132'

    Chris0132' Developer

    Messages:
    9,482
    Likes Received:
    0
    Trophy Points:
    0
    I realise you probably don't want to hear this but parallax mapping would be far more useful on LightMappedGeneric than VertexLitGeneric. Models can be made with proper 3d geometry which fades out at distances using LODs, and you would need to make the high resolution geometry anyway in order to make the normal map.

    Lightmappedgeneric materials on the other hand can only use very very simple geometry, therefore they would benefit immensely from parallax mapping to increase their apparent complexity.

    It would also probably be a good idea to see if you can make it work with SSBump because SSbump is apparently less expensive to render than normal mapping for some reason.
     
    Last edited: Aug 8, 2009
  14. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    It is in my plans but it'll take time.

    Parallax occlusion mapping is more effective than additional triangles for everything (including models).
     
    Last edited: Aug 8, 2009
  15. -Mayama-

    -Mayama- MANLY MAN BITCH

    Messages:
    6,487
    Likes Received:
    0
    Trophy Points:
    0
    Pom like all shaders works best if used subtle
     
  16. Chris0132'

    Chris0132' Developer

    Messages:
    9,482
    Likes Received:
    0
    Trophy Points:
    0
    True, but parallax mapping doesn't work at parallel viewing angles, in fact it tends to bug out a bit in my experience, it also doesn't look as good, in most cases you would want to use actual tris for a close in view model (which is what tanks are to the people driving them) and there is no reason why you shouldn't, because you won't see more than one on the screen at once at that detail level. It is also harder to texture for as you demonstrated, the seams are a lot more obvious than they are with normal mapping.

    Tris look better, can do more things, and have no real downsides to their use on models at the sort of range at which parallax mapping would be visible.
     
  17. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    Almost nothing of what you've written is true.

    http://www.ati.com/developer/gdc/2006/GDC06-Tatarchuk-Parallax_Occlusion_Mapping.pdf

    1. Good resolution height map is more memory efficient than triangles. It looks just as good.
    2. Percent of angles where you will not see the detail done with parallax occlusion mapping is extremely low.
    3. Some (quite many) of current models were done with virtual-displacement mapping in mind (parallax occlusion mapping is one of algorithms that implements it).
    4. Sometimes you have to blur the heightmap to make height changes smaller to avoid too quick changes in height.
    5. Making LODs is time consuming and currently we have no LODs for our vehicle models.
    6. It isn't much harder to texture it. You just have to texture models with big contiuous patches.
    7. NF heavy with 2600 polygons + POM will look as good as 10k polygon model. LOD is done in the shader and also by MIP-mapping.

    The fact that I posted almost only screenshots of POM with crappy heightmaps doesn't prove a lot.
     
  18. PwnedYoAss

    PwnedYoAss Member

    Messages:
    1,088
    Likes Received:
    39
    Trophy Points:
    0
    MOOtant, it looks fucking amazing. Want NOW.
     
  19. Emp_Recruit

    Emp_Recruit Member

    Messages:
    4,244
    Likes Received:
    0
    Trophy Points:
    0
    I Can"t Wait Till I Can Play Empires On High Again
     
  20. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0

Share This Page