Unsolved Distant terrain shadows issue

Discussion in 'Mod Support' started by DePains, Dec 27, 2018.

  1. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    After the AO (useless) and normal maps baking, I've done the diffuse and now I'm facing a shadow issue with my distant terrain. As images will explain better than words, here you go :

    In the first one, sun is higher (almost noon) than in the second one, compare shadowing of the dt versus the terrain itself.
    Capturedcran132.png Capturedcran133.png

    Here are the diffuse and normal :
    nurburg_dt_d.png nurburg_dt_n.png

    And the materials.cs setting :
    Code:
    singleton material(nurburg_distantterrain)
    {
       mapTo = "nurburg_distantterrain";
       colorMap[0] = "nurburg_dt_d";
       normalMap = "nurburg_dt_n";
       translucentBlendOp = "None";
    };
    Does somebody know what might be the issue ? Thank you !
     
  2. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    I believe that you are getting that because of the normal map.
    At such distance, shadows are not visible, what you see is the normal map still affecting the lighting.
    The extents have one, and it's affecting the lighting.
    Terrain not, and the sun being directly above it means the thing is fully lit.
     
  3. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Thanks for the answer Nadeox1,

    I forgot to precise that I tried without the normal map, and I get this :
    Capturedcran134.png
    The same thing without the normal details.

    I don't know if it might be relevant, just in case its 16*16km and have 64*64 faces. Setting it to "emissive" remove those "shadows".
     
  4. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    Uhm, it might be the terrain details goes lower the farther you go from it.
    The normal view you posted in the first post shows it's completely flat, while the surroundings are not.

    I mean, from such distance, it's not that odd, the terrain is being simplified to save on resource, as you don't see tiny details from up there.
    You can tune that if you want (I'd not suggest) by changing the 'error' value in the terrain parameters (scene tree)
     
  5. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Well, I'd make a video if my graphic card and its drivers weren't that old.
    Distance doesn't influence those shadows, they look exactly the same no matter the camera distance :
    Capturedcran135.png

    As for the flat normal map were the terrain is, that was empty (transparent) and filled that way by the Intel texture works plugin for Photoshop when I converted from PNG to DDS.

    I added the files if anyone what to have a direct look at this :
     

    Attached Files:

  6. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    Now that I look at it close, your normals on the extents looks quite wrong.
    How did you bake them?
     
  7. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    You have the details in one of the previous thread you helped me on : https://www.beamng.com/threads/how-to-properly-bake-textures-for-distant-terrain-blender.59209/
    Last post mainly.

    Thank you so much for taking some time to have a look on that :)

    EDIT :
    What do you call the extents ? The edges of the normal ?
    Note that the last two pictures are the model without the normal texture... Those weird shadows aren't due to the normal (I cleared the cache after removing the normal in the material.cs).
     
    #7 DePains, Dec 28, 2018
    Last edited: Dec 28, 2018
  8. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    Ah, forgot about it.

    I'm calling extent the mesh around the real map.

    Can you please check disabling the normal map on the extent, to see if they are doing something wrong?
    I'd be expecting the extent to have the same lighting as the map, especially if the sun is directly above them.
     
  9. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    I was trying to retrace the steps I've done for the normals as anyway I'd like to have them as correct as possible. I'll post that this afternoon or tomorrow probably.

    Hum, I'm still lost on the extents thing. I've searched online for beamng or torque 3D with "extents" and "normals", I found your "simple_map" but not how to edit the normals for the extents.
    Could you please tell me how to ?

    I found this in the "Visibility modes" in the editor :
    Capturedcran136.png Capturedcran137.png
    What is the "Advanced Lighting : Normals Viz" ? It fits with those shadows sort of.
    --- Post updated ---
    As it's been a month more or less, I've redone it from scratch, to be sure :

    1. Blender cycle
    2. Create two grids at 0/0/0 (65 and 2049 subdivisions to have 64² faces and 2048² faces respectively) with 16000 X/Y dimensions
    3. Create one plane at 0/0/0, 7999.9 X/Y dimensions
    4. For the two grids : displace modifier with the DT heightmap as texture, strengh set to 730.487 and then apply
    5. Shrinkwrap modifier with the plane as target, project Z negative, move down the plane and then apply
    6. Remove the plane
    7. Edit mode, front ortho view and remove the faces moved by the shrinkwrap modifier for both grids.
    8. Now I have a low poly and a hi poly of my DT. I duplicate the low-poly, smooth shadows and then export as collada for BeamNG.
    9. Select the low-poly, add a material, create an image in the "UV/Image editor", edit mode, select all faces, top ortho view, unwrap with "project from view (bounds)"
    10. Select the hi and then the low-poly, go to bake, select "normals", active to selected (distance = 250, that's necessary because the two grids are quite far from each other in some places), margin to 0 and bake, I get this :
      dt64_normals1.png
    11. Now I add a multiresolution modifier to the low-poly mesh (set at 5 for the two grid to have the same number of faces), bake and I get this :
    dt64_normal2.png

    I imported that into BeamNG, with the normal and without. I get the same thing as above.
     
    #9 DePains, Dec 29, 2018
    Last edited: Dec 29, 2018
  10. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    There's no real name for this thing, I just call them extent because they go past the actual level extension :p

    In the first screenshots, the normal of the extent looks quite wrong.
    It should be close to the terrain, but in here it's completely different.

    Can you please check with no normal map applied to that mesh material?
     
  11. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    I'd like very much to but i'm sorry I can't find where to edit/find that, could you point things out please ? Which mesh ?

    I don't see anything in my level that fit what you describe me, is it in the game steamapp folder ?
     
    #11 DePains, Dec 29, 2018
    Last edited: Dec 29, 2018
  12. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    This is the mesh / extent I'm referring to:


    The outer thing around the actual level. The normals are looking wrong from the pics above.
    I suspect it's the normal map you baked. You should check removing/disabling the normal map from its material and see if the lighting is closer to the terrain's one then
     
  13. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Ah, the distant terrain I made. Well I've done that. It just remove the details from the normal :
    Capturedcran138.png Capturedcran139.png

    dt with normal map // dt without normal map

    The "Advanced Lighting : Normals Viz" screenshot I post above is taken without the normal map for the extent.
     
    #13 DePains, Dec 30, 2018
    Last edited: Dec 30, 2018
  14. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    It does not make much sense to me.
    Can you please send the level or smth?
    I will check as soon I have some spare time.
     
  15. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Map has been shared with Nadeox1 in a conversation, I'll post here the solution when found.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice