Textures go all white/low contrast

Discussion in 'Content Creation' started by unyxium, Oct 9, 2019.

  1. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    73
    I have struggled to get the road textures to accurately reflect what the actual image file is. Whenever I try to do something, they go all white/low contrast. I have tried to fix it but have not found any solution.



    Edit: It is now solved. (The reason was because the textures were saved with sRGB instead of Linear)

    Here is the material code:
    Code:
    singleton Material(Highway)
    {
        mapTo = "unmapped_mat";
        doubleSided = "0";
        translucentBlendOp = "LerpAlpha";
        normalMap[0] = "/levels/river_highway/art/road/asphaltroad_laned_n.dds";
        specularPower[0] = "1";
        useAnisotropic[0] = "1";
        materialTag0 = "RoadAndPath";
        materialTag1 = "beamng";
        cubemap = "cubemap_road_sky_reflection";
        specularMap[1] = "/levels/river_highway/art/road/asphaltroad_laned_s.dds";
        specularMap[0] = "/levels/river_highway/art/road/asphaltroad_laned_s.dds";
        specularPower[1] = "1";
        useAnisotropic[1] = "1";
        translucent = "1";
        translucentZWrite = "1";
        alphaTest = "0";
        alphaRef = "255";
        castShadows = "0";
        specular[3] = "White";
        specularStrength[0] = "0.4";
        annotation = "STREET";
       colorMap[0] = "/levels/river_highway/art/road/asphaltroad_highway_a.dds";
       colorMap[1] = "/levels/river_highway/art/road/asphaltroad_highway_a.dds";
       specularStrength0 = "0.4";
    };
    Any ideas on why it occurs and how to fix it?

    Material attached below.
     

    Attached Files:

    • Issue1.png
    • Issue2.png
    • Issue3.png
    #1 unyxium, Oct 9, 2019
    Last edited: Oct 24, 2019
  2. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,653
    Seems to be your layers, you are using them in weird ways.

    Code:
    specularMap[0] = "/levels/river_highway/art/road/asphaltroad_laned_s.dds";
    specularMap[1] = "/levels/river_highway/art/road/asphaltroad_laned_s.dds";
    
     colorMap[0] = "/levels/river_highway/art/road/asphaltroad_highway_a.dds";
     colorMap[1] = "/levels/river_highway/art/road/asphaltroad_highway_a.dds";

    That means you have assigned the same specularMap and colorMap to layer0 and layer1
    Unless I'm missing something, that seems like an error. If it's the same textures, you can just use one layer?

    Then you seem to have set Specular color on layer3, but you don't have any textures on that layer

    Code:
    specular[3] = "White";
    And the last line appears broken:

    Code:
    specularStrength0 = "0.4";
    The 0 after Strenght, which should indicate the layer, is not between square brackets (should be specularStrenght[0])
     
  3. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    73
    I have noticed that the textures themselves are very light as well. It can be seen in the images above in the side panel that the textures used are much lighter than what they should be. The light textures applies not just to roads but terrain materials and billboard textures (e.g. grass) as well in certain circumstances. With the corn field I was making, I ended up counteracting the lightness of the textures in-game with a really dark image texture. See the attached image where the game turns the really dark textures into this much lighter colour. I am not sure why they did that.

    Also, I managed to fix the highway road texture for now, but I think it is still not working exactly how it should. Some roads appear washed out as I have had to counteract the darkness with them as well.
     

    Attached Files:

    • textures.png
  4. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,653
    Can you please make sure your layers are working correctly first? In the previous post I showed that you have the same textures on different layers.
    It's possible the two layers are mixing together, returning brighter colors.

    Grass are a bit of a weird zone, as lighting on them works in a different way, for now let's make sure your static meshes are looking correct.
    Any screenshots of the washed out highway road?
    Also, any possibility for you to upload the mesh, material and textures so I can check them on my side?
     
  5. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    73
    I managed to fix the white textures visible in my first post by replacing the files with a backup copy (maybe something didn't update correctly, or I made an edit I couldn't find and revert). Additionally, removing the specular[3] = "White"; from the road materials seems to work to make the texture back to its original brightness. I have attached the texture used and a screenshot of it fixed there.

    It works correctly even with the duplicate layers in the textures.

    Also, attempting to remove the layer 1 textures results in this bluish colour with no textures visible. I am not sure what is happening there.


    Code:
    singleton Material(Highway)
    {
        mapTo = "unmapped_mat";
        diffuseMap[0] = "asphaltroad_highway_a.dds";
        doubleSided = "0";
        translucentBlendOp = "LerpAlpha";
        normalMap[0] = "asphaltroad_laned_n.dds";
        specularPower[0] = "1";
        useAnisotropic[0] = "1";
        materialTag0 = "RoadAndPath";
        materialTag1 = "beamng";
        cubemap = "cubemap_road_sky_reflection";
        specularMap[0] = "asphaltroad_laned_s.dds";
        translucent = "1";
        translucentZWrite = "1";
        alphaTest = "0";
        alphaRef = "255";
        castShadows = "0";
        specularStrength[0] = "0.4";
        annotation = "STREET";
    };
    Another thing - what is the difference between a colorMap and a diffuseMap? I noticed that materials use either one but they don't appear to do much different.
     

    Attached Files:

  6. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,653
    It's the same thing, both names are accepted.

    Your material does not seem to require 'transulency' (ie. transparency).
    Setting those to 1, you are basically enabling trasparency. Try setting those to zero instead.

    Also try removing the cubemap line.
    It does not seems to be used correctly with your material set that way.
    The way cubemap is used usually is the following:
    Layer 0 is a fully reflective
    Layer 1 is your texture, where the alpha decides to show more or less the underlying cubemap.
    As you have it right now, it seems that the cubemap is completely replacing your texture, since you have set it on layer 0.
     
  7. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    73
    Removing the cubemap line seems to fix it. What's left to do is get the colours of the plants fixed up.
     
  8. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,653
    Copy the material of the plants here, so I can see how it's fully set up
     
  9. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    73
    materials.cs
    Code:
    singleton Material(crops)
    {
        mapTo = "crops";
        diffuseMap[0] = "levels/river_highway/art/shapes/groundcover/crops.dds";
        doubleSided = "1";
        alphaTest = "1";
        alphaRef = "110";
        materialTag1 = "beamng";
        materialTag0 = "beamng";
        materialTag2 = "vegetation";
        materialTag3 = "Natural";
        annotation = "NATURE";
    };
    What it looks like: (This is a png version, I use the dds one which is attached as well)
     

    Attached Files:

  10. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,653
    The texture you posted is different from the one in post #3? (one is darker than the other)
     
  11. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    73
    The png one I attached is the unedited version, which looks like the one I wanted to use but didn't work. I attached the dds that is being used, but as you can see, it is much darker because I did that to counteract the lightness of the plants.
     
  12. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,653
    The DDS above appears like this in Photoshop (Intel Texture Plugin)


    While GIMP and some other tools I usually use would refuse to open it.


    May suspect is that it's saved in the wrong format.
    What software did you use to save it? What plugins you used eventually? And what format did you save the DDS as? (DXT5, DXT3, etc.)


    You can quickly adjust the color of the material by using the color selector. Setting it to something like grey or so:
    Video - Click to Play - Direct Link
     
  13. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    73
    I used paint.net and exported it as BC7 (sRGB, DX 11+).

    Also, that quick shortcut was what I initally used to try and counteract the problem although I thought that there would be something that doesn't involve such a method.
     
  14. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,653
    Do not use sRGB, but Linear instead:
     
  15. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    73
    That works, thanks!


    Edit: I just tested it on some other textures and this is what was causing the issue all along. The roads look correct when I save them as linear instead.
     

    Attached Files:

    • crops_image.png
    #15 unyxium, Oct 24, 2019
    Last edited: Oct 24, 2019
  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