1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

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

Chrome/metallic paint on a car not loading from the scenario .prefab file

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by Janusz_Alfa, Mar 27, 2022.

  1. Janusz_Alfa

    Janusz_Alfa
    Expand Collapse

    Joined:
    Mar 14, 2022
    Messages:
    15
    This is weird, I can save any vehicle configuration into .prefab file and it spawns as expected in the scenario. Apart from the chrome/metallic color on a vehicle.

    What I do is:
    1. Load my scenario.
    2. Pause.
    3. Enter F11 editor mode.
    4. Unpack my prefab file.
    5. Close F11 editor.
    6. Chose vehicle.
    6. Enter vehicle parts configurator.
    7. Set vehicle color to chrome.
    8. Close parts configurator.
    9. Open F11 editor.
    10. Pack my prefab.
    11. Copy over new .prefab file into my mods folder, from the safe spare or temp folder used to save files by the world editor, not sure what's its name. Its "BeamNG.USER\0.24\levels\italy\main" for me because I have changed my user folder and the scenario takes place on the Italy map.

    12.Then I delete rest of the "trash" files from this folder - this part is important.

    I won't paste entire .prefab or even the vehicle section of the .prefab. I have narrowed it down a bit. So to get metalic/chrome paintjob (mirror finish in this example) the only piece of data needed in the vehicle section of a .prefab is:
    Code:
    metallicPaintData[0] = "1 0 0 0";
    or:
    Code:
    [\"paints\"]={{[\"metallic\"]=1,[\"roughness\"]=0,[\"clearcoat\"]=0,[\"clearcoatRoughness\"]=0}}
    in the "partConfig =" array/table a bit lower.
    Or both.
    Yes, paint data is saved TWICE in the .prefab file for reasons unknown for me. If the color configs contains different paints in these places, config from "partConfig =" seems to be used.

    ISSUE:
    When I load the scenario the car is just plain white:
    Zrzutekranu117.jpg
    And yes its modded car but vanilla cars act the same.

    When I force the game to reload .prefab file while the scenario is running (just by clicking save in my file editor) then the vehicle magically gets chrome paintjob:
    Zrzutekranu118.jpg

    But then when I hit restart scenario button (R), it becomes white again!
    When I check the car paint under car config tool, then it has no chrome, only some basic paint settings. When i set it to chrome, it becomes chrome.


    I also have this vehicle saved as .pc file, which works like a charm loaded in freeroam mode.

    When I place it in the .prefab in its original form (no "partConfig =" data, only one link to the .pc file) its also spawning white car.

    When I spawn this car from the .pc file into running scenario with white "chrome" car, by using normal functionality of "add car", it spawns with proper metallic painjob next to the white one.

    Zrzutekranu119.jpg

    And now things gets even more confusing. When I won't delete the rest of the files after exiting the world editor from "BeamNG.USER\0.24\levels\italy\main", then the chrome cars are loading like they should. When I delete these files, they load white. Well, if one or two of these files are needed in my mod folder I will gladly copy them over, but I don't know which one, testing this will take forever because I have to reload the whole scenario to make changes take effect.

    This is where I am with my investigation. And yes, tried clearing the cache. Basically no mods, only the "FPS Trapez" - this modded car.


    Also a workaround will make me happy. Like how to change the paint trough lua command so I can simply add it to the car's command line in my .json file to change the color on scenario start.
     
  2. Janusz_Alfa

    Janusz_Alfa
    Expand Collapse

    Joined:
    Mar 14, 2022
    Messages:
    15
    Ok I figured out how to set paint from GE lua:
    Code:
    core_vehicle_manager.liveUpdateVehicleColors(be:getPlayerVehicleID(0), scenetree.findObjectById(be:getPlayerVehicleID(0)), 1, {baseColor = {0, 0, 0, 0}, metallic=0, roughness=0, clearcoat=0, clearcoatRoughness=0})
    
    From vehicle lua:
    Code:
    obj:queueGameEngineLua('core_vehicle_manager.liveUpdateVehicleColors(be:getPlayerVehicleID(0), scenetree.findObjectById(be:getPlayerVehicleID(0)), 1, {baseColor = {0, 0, 0, 0}, metallic=1, roughness=0, clearcoat=0, clearcoatRoughness=0})')
    
    So the second code can be used in scenario json to auto change color on scenario start.

    baseColor, metallic, roughness, clearcoat, clearcoatRoughness all can be ignored or used individually, for example if we only want to add metallic and not change anything else, use {metallic=1} as the paint array. Values are from 0 to 1, for example 0 = 0 black, 1 = 255 white. Value of "1" just before the paint array is just an index of first color set. If the car has more, use "2" or "3" to change them.

    But this is awful awful workaround and probably stop working in the next update or two.
     
  3. Fluffy Panda

    Fluffy Panda
    Expand Collapse
    Global Moderator
    BeamNG Team

    Joined:
    Sep 16, 2020
    Messages:
    1,374
    Hi,

    Could you please send your mod files, so we can take a look into the issue?
     
  4. Janusz_Alfa

    Janusz_Alfa
    Expand Collapse

    Joined:
    Mar 14, 2022
    Messages:
    15
    I made a test scenario so you have less mess to debug. There is only one vanilla car painted metallic on a vanilla map. It behaves exactly as I described in the first post.
     

    Attached Files:

  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