Solved Vehicle material issues

Discussion in 'Mod Support' started by aljowen, Jul 4, 2016.

  1. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    I am having issues with the materials mostly surrounding chrominess.



    Code:
    singleton Material(Raven_R60_Body)
    {
        mapTo = "body";
        diffuseMap[2] = "vehicles/sunburst/sunburst_c.dds";
        specularMap[2] = "vehicles/sunburst/sunburst_s.dds";
        normalMap[2] = "vehicles/sunburst/sunburst_n.dds";
        diffuseMap[1] = "vehicles/sunburst/sunburst_d.dds";
        specularMap[1] = "vehicles/sunburst/sunburst_s.dds";
        normalMap[1] = "vehicles/sunburst/sunburst_n.dds";
        diffuseMap[0] = "vehicles/common/null.dds";
        specularMap[0] = "vehicles/common/null.dds";
        normalMap[0] = "vehicles/sunburst/sunburst_n.dds";
        specular[0] = "0.5 0.5 0.5 0.1";
        specular[1] = "0.5 0.5 0.5 0.1";
        specular[2] = "0.5 0.5 0.5 0.1";
        specularPower[0] = "128";
        pixelSpecular[0] = "1";
        specularPower[1] = "32";
        pixelSpecular[1] = "1";
        specularPower[2] = "128";
        pixelSpecular[2] = "1";
        diffuseColor[0] = "0 0 0 0";
        diffuseColor[1] = "0 0 0 0";
        diffuseColor[2] = "0 0 0 0";
        useAnisotropic[0] = "1";
        useAnisotropic[1] = "1";
        useAnisotropic[2] = "1";
        castShadows = "1";
        translucent = "1";
        translucentBlendOp = "None";
        alphaTest = "0";
        alphaRef = "0";
        dynamicCubemap = true;
        beamngDiffuseColorSlot = 2;
        materialTag0 = "beamng"; materialTag1 = "vehicle";
    };
     
  2. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,401
    Your diffuseColors look odd. They're all black with 0 alpha.
    Try setting diffuseColor[0] and diffuseColor[1] to "1 1 1 1". You can leave diffuseColor[2] because it's controlled by the colour picker.
     
    • Like Like x 1
  3. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    Still no change.

    I should also add that if you try to load the vehicle with a custom colour the game will refuse to load the vehicle. Meaning the only way to change colour is to using the tuning menu.

     
  4. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    340
    Hey,

    I had a look at the mesh you sent me.
    In the first instance it seems that your material.cs file is linking to the wrong material. The material of the body of your mesh (and other meshes) is called 'Leather' and not 'body'.
    Furthermore it seems that you haven't created a UV map for your mesh yet.
     
    • Like Like x 1
  5. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    340
    As you may can see, I haven't put much effort in creating a proper uv map now. But at least there is one and I gave the mesh a 'body' material.


     
    • Like Like x 1
  6. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    On the blender file the interior material is called 'Leather' and the exterior is called 'body'. Do the material names assigned within blender not directly correlate with what is being exported?
     
  7. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    340
    Oh, damn, sorry... everything's fine with the materials in the dae file. My bad, sorry about that.

    But have you tried to add an uv map?
     
  8. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    No I haven't, I was gonna wait until the model is finished before I start trying to texture it (im not sure if that is the best way to do it though, I can't say I have experience with them). Is it possible to apply a blank UV map to it?
     
  9. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    340
    Actually there should already be a blank map. But since it's blank, it's not able to link the mesh to the 2d representation/texture. I just added a planar projection for testing purposes in the pictures (that's why it looks so crappy).
     
    • Like Like x 1
  10. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    Now that I have added a texture within blender it is (crappily) functioning. Just fiddling with files to get it looking not awful. Thanks

    However the vehicle still does not load with a custom colour selected.

    Also how do you limit the chrominess to prevent it going into the negative range?
     
    #10 aljowen, Jul 4, 2016
    Last edited: Jul 4, 2016
  11. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    340
    You have to create an info.json file, in this file you can define the default colors of your vehicle.
     

    Attached Files:

    • infojson.PNG
    • Like Like x 1
  12. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    When I copy the info.json from another vehicle and fill it in the car no longer appears in the vehicle selector though.
     
  13. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,401
    I like to set the diffuse texture's alpha (The actual texture, not the diffuseColor) to 128 (HEX: 80).
     
    • Like Like x 1
  14. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    340
    You have to change the name within the info.json file ;)
     
    • Like Like x 1
  15. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    How would you suggest is the best way of doing that?

    I am currently trying to set the textures alpha to half using PSE with the nvidia plugin. But it doesn't seem to be making a difference in game so I am not sure I am doing it right.
    • I used the colour picker to get the same colour.
    • Created a new layer
    • filled that layer with the colour at 50% opacity
    • deleted the original layer
    • Exported to dds (using: DXT3 ARGB 8 bpp | explicit alpha)
    • the resulting file is attached.
    When I reload the file into photoshop there is no longer any transparency in the file. (If I save as png the transparency is in the saved file but still makes no difference in game if I set the png as the texture).
    --- Post updated ---
    That is what I have done. I have attached the info.json file

    I also created the other json file just in case that was needed too which I have attached,
     

    Attached Files:

  16. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    340
    Ough... works perfectly here:

     

    Attached Files:

  17. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    Turns out I needed to restart the game in order for the car to re appear :)
     
  18. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,401
    Save as DXT5. Here's a file that should work:
     

    Attached Files:

  19. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    I have replaced the file with that one and rebooted the game and the same issue persists.
    screenshot_00030.png
     
  20. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,401
    What does the materials file look like now?
     
  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