Tutorial, how to make transparent windows to Automation exported car

Discussion in 'Content Creation' started by fufsgfen, Jul 17, 2018.

  1. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,784
    This is for beginners that just want to get started with improving their Automation exported vehicle, goal is to have windows that you can see trough and being able to drive from inside of the car.

    After completing this tutorial you should have incar view for your vehicle and basic knowledge of how to start modding a vehicle.

    Tools required:
    Notepad++ https://wiki.beamng.com/Notepad++

    Make sure you have installed Notepad++ and it is working before proceeding!

    OPTIONAL: Syntax highlighting for Notepad++ so you can see colors in words when editing jbeam files:
    https://www.beamng.com/threads/how-to-enable-proper-highlighting-in-notepad.39158/#post-588554


    First thing to do is to extract contents of your exported vehicle .zip file to vehicles folder, so that you can edit files.

    Inside a zip there are several folder, here is example of my 2C_Drift car .zip file folder structure:
    upload_2018-7-17_18-39-45.png

    Contents from the 'art' folder from zip goes to Documents/BeamNG.drive/art/ folder

    Contents from vehicles folder from the zip goes to Documents/BeamNG.drive/vehicles/ folder


    For example here is my vehicle called 2c_drift correctly extracted, note the path on top of the screenshot:
    upload_2018-7-17_18-36-39.png

    From screenshot you can see materials.cs being highlighted, right click that file and choose open in Notepad++ option:
    upload_2018-7-17_18-51-53.png

    You should see materials.cs file open in Notepad++
    upload_2018-7-17_18-54-11.png

    Reason you can't see trough windows is that their material is double sided, so what we need to do is to make that material single sided. Sadly finding out which material is for windows is not always easy, so we need to become hackers and use our skills in hacking to figure out which is correct material to edit.

    Fear not, hacking is not that difficult at all.


    Keyword for double sided is doubleSided = "1";


    We know that we want to change doubleSided value from 1 to 0, so we need to search for

    Keyword for double sided is doubleSided = "1"; value.

    While staring Notepad++ hit awesome key combo of ctrl+f and new window pops up:
    upload_2018-7-17_19-2-42.png

    To that window we must write doubleSided = "1"; to look for any occurrences of that keyword, then hit Find Next button and Notepad++ will highlight first keyword it finds:
    upload_2018-7-17_19-5-18.png

    How to know if that is material responsible of having non see trough windows? We test it, so change 1 to 0 and save file:
    upload_2018-7-17_19-8-18.png

    Then launch the game and see if your vehicle has transparent windows or not (you can keep game running after that and hit ctrl-r to reload vehicle after making new changes to materials.cs), mine has not, so I know that is not the correct material:
    upload_2018-7-17_19-12-37.png

    So as I know that is not correct material, I write a comment next to double sided, you might of noticed on Notepad++ screenshot above I have written //not after that doubleSided keyword. // is code for a comment, anything on that line after // is ignored by the came so you can write anything you like to help you remembering things.

    Write //not next to that doubleSided keyword and make sure you change value back to 1 from 0!

    upload_2018-7-17_19-16-36.png

    Now each material definition has a start and the end, we can call that as a material block.

    Each material block starts with
    Code:
    singleton Material(internal material name for game to use)
    {
    Each material block ends with '}' so you can see this is one material block or just material:
    upload_2018-7-17_19-20-44.png

    From the name of material or textures it uses we can try to guess what part uses that material, sadly windows don't say windows or not necessarily even glass on it, so we need to search for next doubleSided = "1"; and change that to doubleSided = "0"; save, test what changed in game.

    If change did not make windows transparent, then we write again //not next to doubleSided keyword and change value back to 1, then proceed to search next occurrence.

    Keep doing that as long until you find material that controls windows.
    upload_2018-7-17_19-46-43.png

    When you finally find correct one, write //yes next to it, you can also write controls window transparency so you will know later which one it was in case that you might need to find it again:
    upload_2018-7-17_19-27-3.png

    Next you need to copy materials.cs from your vehicles folder to your vehicle.zip, just drag and drop over one in zip file and make sure to overwrite old one, so you can share your mod with transparent windows to others.

    Congrats on your first successful brute force hacking!

    More advanced information about materials.cs can be found here:
    https://wiki.beamng.com/Vehicle_Materials


    Next job is moving the camera.

    Open your vehicles jbeam file, which is located in Documents/BeamNG.drive/vehicles/yourvehiclename/yourvehiclename.jbeam
    upload_2018-7-17_19-32-48.png

    Section that controls cameras is called camerasInternal and there line "hooddriver" controls position of your incar camera.
    upload_2018-7-17_19-35-14.png

    Numbers are X, Y and Z coordinates, what you need to do is make one small change to one of them and then test in game to see where it moves to.
    0.1 is 10cm and 1.0 is 1 meter.

    As a general rule more X moves camera more to left, more Y moves camera backwards and more Z moves camera up, each vehicle needs different adjustments, if you want LHD or RHD that is up to you.

    Camera might become bit shaky if moved to LHD as beams holding the camera node are getting longer, but you can go to game options and enable relative camera (it defaults to incar camera position) if it is not enabled already, I have set relative camera as default because it is awesome:
    upload_2018-7-17_19-40-45.png

    You can move relative camera around with w,a,s,d, pageUp, pageDown, turn using keypad and control FOV with 7 and 9 keys from keypad.

    Happy modding!
     
    • Informative Informative x 9
    • Like Like x 3
    • Agree Agree x 1
  2. Raspytooth28

    Raspytooth28
    Expand Collapse

    Joined:
    Jun 17, 2017
    Messages:
    9
    This works great, thank you.
     
    • Like Like x 1
  3. TheR4vas

    TheR4vas
    Expand Collapse

    Joined:
    Mar 7, 2017
    Messages:
    17
    I tried changing every doublesided to 0, even tried changing all "doublesided" to 0 at a single time, but the car looked the same. Can ou help me out?
     
  4. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,784
    Sometimes change is not happening until you restart the level.

    Also make sure to take out your car's zip file from the mods folder, it should not need that, but sometimes it does need it, bit random.
     
  5. TheR4vas

    TheR4vas
    Expand Collapse

    Joined:
    Mar 7, 2017
    Messages:
    17
    I did restart the level and I did bring out the car out of the zip file, but there was no "art" folder in documents/beamng/ so I just created one. Did everything as you mentioned, doesn't work. I mean, you could teamviewer this sh*t.
    --- Post updated ---
    Just tried zipping everything together, even zipped it doesn't change anything.
     
  6. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,784
    Could you drag and drop fresh exported zip to your post?

    I could try to look what it going on with your vehicle then.
     
  7. TheR4vas

    TheR4vas
    Expand Collapse

    Joined:
    Mar 7, 2017
    Messages:
    17
    Sure thing, here you go.
     

    Attached Files:

  8. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,784
    Looks like you need to turn some of those doubleSided back to 1, but windows are see trough.
    upload_2018-7-25_0-26-38.png

    material_2_h_turbo_s_h_turbo_s_body0 is your window material.

    material_0_h_turbo_s_h_turbo_s_body0 is your body material, which you might want to have doubleSided = 1

    So it should work, but I'm not sure why windows have been transparent in your computer.

    Use ` to see console after you have loaded your car and see if there is something like mapTo material_2_h_turbo_s_h_turbo_s_body0 was replaced / overriden, that would mean there being some other material.cs file with same material name, which would create a conflict.

    That is one possibility that comes to my mind, not sure what else it could be.
     
  9. TheR4vas

    TheR4vas
    Expand Collapse

    Joined:
    Mar 7, 2017
    Messages:
    17
    Changed it.
    upload_2018-7-25_0-40-40.png
    Saved it.
    Zipped it.
    Launched beamng.
    Loaded it.
    upload_2018-7-25_0-44-7.png
    Same sh*t.
    --- Post updated ---
    Attached 2 pics, maybe they will help.
     

    Attached Files:

    • 1.png
    • 2.png
  10. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,784
    Hmm, I think one thing needs to be made sure. Windows will turn transparent only from when looking from inside to out, they will still be normal black when looking from outside.

    Another thing is that you have LUA error, I'm not sure where that comes from though, but maybe running safe mode helps with that.

    If you want windows to be transparent or some opacity when viewed from outside, you need to edit material like this:
    singleton Material(material_2_h_turbo_s_h_turbo_s_body0)
    {
    mapTo = "material_2_h_turbo_s_h_turbo_s_body0";
    //diffuseMap[0] = "vehicles/common/null.dds";
    // specularMap[0] = "vehicles/common/null.dds";
    specularPower[0] = "255";
    specularStrength[0] = "1";
    castShadows = "1";
    doubleSided = "0"; //yes
    reflectivityMap[0] = "vehicles/common/glass_base.dds";
    diffuseColor[0] = "0.14902 0.145098 0.168627 1";
    dynamicCubemap = true;
    translucent = "1";
    translucentBlendOp = "Mul";
    // alphaTest = "0";
    // alphaRef = "1";
    materialTag0 = "beamng";
    };

    Also make sure you set doubleSided to 1 in material_0_h_turbo_s_h_turbo_s_body0

    upload_2018-7-25_1-26-25.png upload_2018-7-25_1-28-3.png
     
    • Like Like x 2
  11. TheR4vas

    TheR4vas
    Expand Collapse

    Joined:
    Mar 7, 2017
    Messages:
    17
    I've set doublesided 1 on everything, except material_2_h_turbo_s_h_turbo_s_body0, but I've switched even that back to 1, because I got the windows transparent! Thank you so much :oops:.
    upload_2018-7-25_1-40-3.png
    upload_2018-7-25_1-40-12.png
    Next thing, do you know how to do any of that stuff :confused::
    1. detachable hood/doors/trunk
    2. the current version doesn't have a picture on it (only the mod, the vehicle itself), so I need to add one.
    3. make "sport" ESC, because now it's only "green" and "turned off".
    4. Widen the front rims, they need to be as wide as the rear ones.
    5. make the exhaust attached.
    6. there is no driveshaft now, need to add one.
    7. Most importantly make an interior.
    8. Also one more very important thing, make the car handle more realistic, because it should handle like a boat or a house, because it's an SUV, but now it handles like an 800kg, AWD, with best tires in the world, 1000hp car.
    9. Last, but not least (and probably the hardest part), to make the car crash more realistically, because now you can crash at 200kmh and the car still steers after that.
     
    #11 TheR4vas, Jul 25, 2018
    Last edited: Jul 25, 2018
  12. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,784
    There are many ways to achieve a goal, you can indeed have windows that are doublesided and still can see trough, but it might get difficult to drive at dark with such dark windows, however it is artist himself who chooses from all the options :D

    Some of your questions go to quite advanced topics, can't say I would of done all those myself.

    Interior part is something I have been just experimenting, but it is still too early to write much about it, but when I learn the process well, I hope to make a tutorial about it.

    As this topic is about making windows transparent, it might be best if you start new topic into mod support section when you have some progress on some of the areas you wish to improve your vehicle.

    For wheels, it might be best to make them wider in automation, also look tutorials topic at Automation sub-forum that has video about how to make car suspension setup in Automation. Before that make sure your car's weight is correct in Automation, change safety and interior options to get more/less weight.

    This is place where you can find some tutorials:
    https://www.beamng.com/threads/tutorials-index-list-of-useful-guides.51454/

    Especially these two might answer some of your questions and help you get started (maybe I should add these end to my tutorial under title "where to go next":
    https://www.beamng.com/threads/tutorial-how-to-make-a-configuration.34199/unread
    https://www.beamng.com/threads/tutorial-how-to-do-engine-swaps-with-pictures.56000/

    Also there are some info here, which would help with building exhausts, changing how vehicle crashes etc.
    https://www.beamng.com/threads/is-y...ecially-at-speed-intro-to-aerodynamics.56379/
     
  13. Martin.S

    Martin.S
    Expand Collapse

    Joined:
    Apr 16, 2017
    Messages:
    215
    Can you help me? Because this happens for my car;
     

    Attached Files:

    • screenshot_2020-04-13_16-14-31.png
    • screenshot_2020-04-13_16-14-40.png
  14. qu4rk

    qu4rk
    Expand Collapse

    Joined:
    May 4, 2020
    Messages:
    1
    Hello. Idk if anyone still checks in on this forum but im trying to make the windows seethrough using your method and nothing changes with the car.
     
  15. Martin.S

    Martin.S
    Expand Collapse

    Joined:
    Apr 16, 2017
    Messages:
    215
    For my car too. I don't know what i have to do :(
     
  16. Apexio

    Apexio
    Expand Collapse

    Joined:
    Jun 3, 2020
    Messages:
    1
    Hello fufsgfen

    first I thank you for telling this to us and so many work on it.

    I got the material single sided easily and was watching to your lines.
    For me it worked fine because in my cars it seems only to be the last body material before chassis materials beginns.
    Maybe this works for others too.


    Now my questions to the view,

    "camerasInternal":[
    ["type", "x", "y", "z", "fov", "id1:", "id2:", "id3:", "id4:", "id5:", "id6:"],
    {"nodeWeight":0.24},
    {"selfCollision":false},
    {"collision":false},
    {"beamSpring":69000},
    {"beamDamp":200},
    {"beamDeform":51000},
    {"beamStrength":"FLT_MAX"},
    ["hood", 1, -2.17666, 1.91099, 60, "a93","a94","a89","a90","a46","a45",{"cockpitCamera":false}],
    ["hooddriver", 1.459037, 2.28492, 2.27957, 60, "a93","a89","a88","a92","a46","a45",{"cockpitCamera":false}],

    1.
    Does the view for "hood" and "hooddriver" stay cockpitCamera "false"?

    2.
    And i changed the x,y and z for hooddriver but the view doesnt change, even if I change the parameters for "hood" too. But no change at all.
    I loaded levels again and the car too, but nothing happens. I have no issues in log or console.
    I could only sit in and watch out by using relative view and move with wasd keys, but this has to be changed again and again, its not saved and view differs from car to car.
    I take here a picture from my view with this method.

    Iam sure it works, but i have to know how.
    I hope you are still active here and can help me out as fast as possible.


    3.
    And last thing to your own post:
    singleton Material(material_2_h_turbo_s_h_turbo_s_body0)
    {
    mapTo = "material_2_h_turbo_s_h_turbo_s_body0";
    //diffuseMap[0] = "vehicles/common/null.dds";
    // specularMap[0] = "vehicles/common/null.dds";
    specularPower[0] = "255";
    specularStrength[0] = "1";
    castShadows = "1";
    doubleSided = "0"; //yes
    reflectivityMap[0] = "vehicles/common/glass_base.dds";
    diffuseColor[0] = "0.14902 0.145098 0.168627 1";
    dynamicCubemap = true;
    translucent = "1";
    translucentBlendOp = "Mul";
    // alphaTest = "0";
    // alphaRef = "1";
    materialTag0 = "beamng";
    };

    What did you change here? But it seems that the lights also get invisible from inside with this setting here.

    greetings
     

    Attached Files:

    • screenshot_2020-06-03_17-44-09.png
  17. tonimark

    tonimark
    Expand Collapse

    Joined:
    Feb 1, 2020
    Messages:
    15
    thanks it worked but for some reason 2 vehicles are created one with transparent windows and one without do you know why ?
     
  18. хубун

    хубун
    Expand Collapse

    Joined:
    Nov 11, 2017
    Messages:
    6
    What parameter is responsible for the transparency of glasses ? I want to make them more transparent
     

    Attached Files:

    • 2020-10-23_15-56-59.png
  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