1. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    Solutions and more information may already be available.

Normal map shader bug with BC5 textures

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by Teh Daemon, Jun 2, 2019.

  1. Teh Daemon

    Teh Daemon
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    85
    I initially thought this was a mod specific issue (hence my previous thread), but it turns out this is more likely a graphics bug. I've tested everything with a cleared and verified cache, and in safe mode.

    The issue is that, depending on the program used, converting a .png normal map to a BC5 DDS file can result in the normal map's z-component being inverted in BeamNG. This strangely only occurs if the shader quality is set to anything higher than lowest. The picture below shows this

    upload_2019-6-2_11-30-26.png

    I am using a blank normal map with R = G = 128 and B = 256. The png is then converted to BC5 dds using 3 different programs: Compressonator, Crunch, and Paint.net (with the dds2 plugin). The outputs from crunch and paint.net give the correct result, it is only compressonator's output that shows this issue.

    I then viewed compressonator's output dds file using Windows Texture Viewer, and this shows the correct value for the blue component. So I can only assume that the problem lies in BeamNG's shader code, unless there's something else I've missed out.

    Steps to replicate:
    1) install the attached mod test_cube.zip (it's just a modified metal box) and unpack it
    2) rename "test_n_compressonator.dds" to "metal_box_N.dds" and load the vehicle in beamNG
    3) set the visualisation mode to "normal" in the debug settings menu
    4) switch between "lowest" and any other shader quality setting. You should see the normals flip as shown in the above picture
    5) try steps 2-4 with "test_n_crunch.dds" and "test_n_pntdotnet.dds" instead. The normals no longer flip when switching shader quality settings

    The reason why I prefer not to use paint.net or crunch is that it's tedious to export multiple files in paint.net, and crunch does not work with 16-bit PNGs.
     

    Attached Files:

  2. Nadeox1

    Nadeox1
    Expand Collapse
    BeamNG.Support
    Staff Member

    Joined:
    Aug 5, 2012
    Messages:
    13,187
    At 'Lowest' setting, normal maps are disabled.
    At 'Low' and above, normal maps are used.

    It's possible that your normal map texture has the green channel in the wrong direction.
    This tends to change from graphical engine to the other, BeamNG uses inverted green channel IIRC.
    A bunch of DDS exporters specialized for games give you an option to invert the green (Y) channel on export, exactly for this.
     
    • Informative Informative x 1
  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