Weird shadows due to displacements?

Discussion in 'Mapping Questions & Discussion' started by flamez, Mar 19, 2014.

  1. flamez

    flamez L1: Registered

    Messages:
    17
    Positive Ratings:
    9
    I'm still learning how to wrangle displacements into working properly, but one thing I've noticed is that there and some weird shadow patches where the displacements are. Below is a screenshot of my WiP that shows what I mean.

    [​IMG]

    It seems like theres a pit there that is blocking all sunlight, but the displacement is only 1-2 HUs lower than the rest, I can't see that causing the massive blackhole patches across the landscape I've got now.
     
  2. Exactol

    aa Exactol Certified Hammer Hacker

    Messages:
    401
    Positive Ratings:
    466
    Is there a nodraw brush going across the displacement? Also could we get some shots from hammer?
     
  3. flamez

    flamez L1: Registered

    Messages:
    17
    Positive Ratings:
    9
    Thanks for the quick reply!
    Yes, there are no draws in the area, nestled below the displacement brushes (if this is not the proper way to handle this, please tell me what is...). Below is the view within hammer:

    [​IMG]
     
  4. Exactol

    aa Exactol Certified Hammer Hacker

    Messages:
    401
    Positive Ratings:
    466
    Lower the nodraw a little bit, that is whats causing the weird shadows. As you can see, the nodraw mostly matches up with the odd shadow.
     
    • Thanks Thanks x 1
  5. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    And in case someone asks, the reason nodraw brushes poking through displacements doesn't always result in black spots comes down to the lightmap scale. If a portion of a luxel is not concealed by the nodraw brush, it will show up in game as lit.

    Review here:

    https://developer.valvesoftware.com/wiki/Lightmap_Scale#Lightmap_Scale


    In the screenshot you posted, the nodraw brush is analogous to the cross shaped brush shown in the wiki page.
     
    • Thanks Thanks x 1
  6. flamez

    flamez L1: Registered

    Messages:
    17
    Positive Ratings:
    9
    That did the trick! I moved the nodraw down a few HUs, patched up the leaks that caused, and the ground shadows look great.
    Thanks for all the help guys, and for the good post on Lightmap Scales.
     
  7. sevin

    aa sevin

    Messages:
    959
    Positive Ratings:
    665
    What was the nodraw doing there anyway? Just to serve as a placeholder for a water texture or something until you got around to it?
     
  8. Crash

    aa Crash func_nerd

    Messages:
    3,191
    Positive Ratings:
    4,924
    I would assume it was just sealing the world under the displacement, it was just a little too close fitting.
     
  9. Freyja

    aa Freyja ¯\_(ツ)_/¯

    Messages:
    2,882
    Positive Ratings:
    4,983
    I think? Lightmap scale does nothing on displacements anyway. Pretty sure they light per-vertex of the displacement, so making it higher power gives more detailed lighting.
     
  10. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,220
    Displacements are definitely lit using lightmaps. Just look at the screenshot in the first post up there; you can see the individual luxels in that blotch.
     
    • Thanks Thanks x 3
  11. wareya

    wareya L7: Fancy Member

    Messages:
    493
    Positive Ratings:
    173
    iirc from looking at badlands, a displacement can be perfectly flush with a nodraw and get the light instead of the nodraw blocking it. not sure tho.
     
  12. Freyja

    aa Freyja ¯\_(ツ)_/¯

    Messages:
    2,882
    Positive Ratings:
    4,983
    It does appear that from reading the dev wiki apparently the density of the displacement (size and power) has an effect on the maximum lightmap scale. The wiki is a bit unclear but I think you can't have a luxel bigger than one "square" on the displacement, either that or it means there's a minimum scale you can set, it's apparently linked but is unclear how.

    But thanks for the clarification steve, good to know
     
    Last edited: Mar 20, 2014
  13. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,535
    Both are considered for displacements. In my experience you only get the shadowing if a vertex is obscured from the light source, which is why you can get away with nodraw sticking out of rounded corners when it is only piercing the edges between tris.
     
  14. flamez

    flamez L1: Registered

    Messages:
    17
    Positive Ratings:
    9
    Thanks for all the information everyone, yes the nodraw was sealing the map, but I wasn't aware that the nodraw would affect the shadowing. I had a feeling that it had something to do with lightmap (even though I have no idea what it really does when I enable Lightmap in 3D view) due to the blocky view of the shadows.

    Thank you for all the help and information again, hopefully I'll have cp_andro up and running in a few weeks for you guys to critique and tear down :).
     
  15. fubarFX

    aa fubarFX The "raw" in "nodraw"

    Messages:
    1,633
    Positive Ratings:
    1,725
    I'd try changing the nodraw for a skybox texture. (the skybox texture being almost the same as nodraw except it doesn't block light) for science!
     
  16. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    Not sure that's true. The reason the nodraw brush was allowing those shadows to be created is not because it was blocking light, but because it was blocking visibility. It's a side effect of visibility that prevents vrad from lighting the displacement. This is semi-significant because there is also the block light texture which does in fact block light, but it does not block vis.

    Skybox brushes block vis as well, which means in theory they can block light. The difference is that it also creates light so you might never notice what's going on.

    I can think of a few ways to test it (colored lights between nested layers of skybox brushes would probably work) but it probably doesn't matter.. it'd just be a curious quirk of the engine.


    edit - a check of the developer wiki says that skybox brushes can't cast shadows so it would probably work as desired for the OP. But moving the nodraw brush is probably the "correct" fix.
     
    Last edited: Mar 20, 2014
  17. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,535
    Nodraw is completely opaque to all aspects of the engine, despite being "invisible" to humans.

    About understanding lightmaps, try this: http://forums.tf2maps.net/showthread.php?t=1693
     
    Last edited: Mar 20, 2014
  18. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,220
    For what it's worth, before it occurred to me that OP's image was enough proof that displacements are lightmapped, I went in and tried making a test/demo map with a displaced floor and high-res lightmap scale, only to discover that it was forcing me to use a minimum scale of 9 for some reason. I'd never encountered that before and I wondered if something had gone wrong with Hammer. So "minimum scale" is apparently right, although I have still no idea what the exact rules are.
     
  19. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    Does the minimum change based on the displacement resolution? Because a scale of 9 just so happens to match the number of vertices on an edge for a "power of 3" displacement.
     
  20. wareya

    wareya L7: Fancy Member

    Messages:
    493
    Positive Ratings:
    173
    Displacements don't get split according to visleafs like normal brushes do (valve abuses this property for geometry that goes through skybox brushes in 5gorge and badlands) so using skybox instead of nodraw should work