1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Featured TUTORIAL Your FIRST car in Assetto Corsa - Basic Guide

Discussion in 'Car Models | Physics' started by luchian, Aug 22, 2017.

  1. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    LAST EDIT:
    04-09-2017: feedback from Pankykapus (3D artist at Kunos)
    27-08-2017: added info from @garyjpaterson (ty)
    ***

    INTRODUCTION
    There are already tutorials on car modding for Assetto Corsa out there. However, I feel they don't treat the subject as a whole. Example - the car_pipeline directly coming with Assetto Corsa. It's long and complex, and has a lot of useful information. But it concentrates too much on the graphical side and not enough on the rest. And that makes it not so straight forward to succeed with your first car. I personally like to start simple and once that is clear, continue to build on it. If you're anything like me, then please keep reading :).

    What you see, does NOT matter.

    Well, it matters if you want to make a top mod, and boost immersion, of course. And that should be our ultimate goal. But from AC engine's point of view, you could drive a cube. Or you could simply drive on thin air. Under the hood, a complete working car looks like this (selected cube being the front left wheel):
    01_helpers.jpg
    *a bunch of dummies with specific orientation and names.

    ..while what you actually see, could be this. Just the pilot hovering. But still, a working "car".
    02_hover_pilot.jpg

    The point is, do not be distracted by the visual mesh. All the work is done by the dummies (also known as null, helper, empty, etc) and their naming. For those familiar with 3d animation, AC is working in the same way: dummies act like an interface between what user wants to see and what the engine understands. Create them, name them correctly, place them at key joint points and have fun with the result by attaching the visual mesh(es).

    TL;DR : We like it simple (and hopefully you too); we use dummies (and you will too).


    LET'S DO THIS
    Our goal is to create the simplest working car.
    However, just the pilot flying would be a little boring. So, we are going to take just one tiny step further. We are going to use this exotic car model. I have put a lot of effort into making it, obviously :D.
    03_basic_model.jpg


    These are the main steps:

    1/ Prepare and populate the folder structure

    2/ In your 3D software (Blender, 3DS Max, Maya, etc):
    A/ respect the dummy naming
    B/ respect hierarchy between dummies and mesh
    C/ export to FBX up to 2014/2015 format (2016 is unsupported)

    3/ In KS EDITOR (aka SDK Editor, AC SDK, AC Editor)
    A/ import the car .fbx file you have just created
    B/ define the shaders/materials
    C/ export to .KN5
    D/ repeat for collider

    4/ Edit \DATA\*.ini files

    5/ DRIVE !


    1/ Folder structure
    This is the first step. A good, clean folder structure will always make things easier. But this is also required, so that AC understands it. This is a small project, so I have used the same folder for all the files, from 3D to kn5. When you'll be working on that awesome car of yours, you might want to have 2 separate folders, one DEV folder with all reference data and 3d models, and one "driving" folder in \content\cars.

    NOTE: We are going to base the tutorial on the Formula K provided in \assettocorsa\sdk\dev\content\cars\formula_k. And simplify it. So we'll copy only some of its contents. I will specify it when the case.

    So, our example car is called acm_tutorial_basic. Therefore, that's also the name of the folder. Like we mentioned, everything is already in place for the final export. Full path:
    04_folder structure.jpg

    The green rectangles indicate the mandatory files and folders for the exported car. "White" files are only there during development, and you'd want to take them out before releasing your car publicly. Let's discuss the contents. A * mark, means we'll get back to it with more detail.

    \animations
    - this is where the animation files are stored for a car. Things like gear shift, steering, etc. You can just copy this from formula_K or other car.​
    \data*
    - this is the key folder in your future car. Inside are all the ini files we need to work on for the physics. Once the car is ready to go public, there is a possibility to release it exactly as is, but nowdays the entire folder is packed in one single file called data.acd​
    \sfx
    - the sound folder. Assetto Corsa uses the FMOD audio engine and all the sounds of a car are packed in a .bank file. We are not going to go into the "how-to" for sound at this point (this will be another nut to crack). However, in order to have a working car mod, we DO need a sound. Therefore, we'll speak about the simple solution, using an existing car's .bank audio file. See THIS for info (you can skip step 2, if in a hurry).​
    \skins
    - skins folder. Every skin, has it's own sub-folder. You might want to edit the preview.​
    \texture
    - very important folder. All the car's textures must be here. To start, you can copy it from formula_k, because it also contains some common shared textures, in the sub-folder flames. Otherwise, whatever new texture you create and use on your car, just drop it directly in the \texture folder.

    Once the model is finished and exported to kn5 file, all your textures will be included in the kn5. So you can then delete all, and just leave the "default" texture folder you copied from the formula_k.

    BONUS: if you use this folder from the beginning, during your modelling phase, the materials will be already assigned to the car when you open it in KS Editor.​
    \ui
    - this is used in the menu and contains 2 files: the badge (PNG, 128x128 px) and basic data for the car in the ui_car.json. You should at least edit the name, so it will be easy to find your creation in the menu :). You can edit it with notepad, but for convenience and all the other text files you need to modify, I recommend something like Notepad++.
    \acm_tutorial_basic.kn5*
    - your car, exported from KS Editor (with textures). Notice the identical name as the folder.​
    \collider.kn5*
    - this is a very boxy version of you car, used for physics calculations.
    Rest of the files (driver_base_pos.knh to tyre_3_shadow.png you can just copy them from formula_K at this point.

    2/ Preparing your 3D model
    Screens here are made in Blender, as that's the tool at hand. Similar concept will apply for 3dsmax, Maya or other modelling package.
    05_hierarchy.png
    *above scene will also be attached to present post

    2A: dummy names
    Set scale to Meters.
    Model the basic car. A car body and 4 wheels. All objects MUST have a material/texture.
    Naming (for visual mesh) can be anything. I prefer to use a prefix like VISUAL so it's clear what part is what.

    Create dummies that control the wheels. Remember, when we use dummies, the names are key factor, so always respect them. (use CAPS). In present case (LF stands for Left Front, LR for Left Right, etc):
    WHEEL_LF
    WHEEL_LR
    WHEEL_RF
    WHEEL_RR

    NOTE: never scale them once created (especially if working in 3dsmax). For game logic, it doesn't matter what size they are, but scaling them afterwards can cause all sorts of issues.

    *Blender has a great little thing - when you create an empty, you can choose whether it's just axis, or a cube, or sphere, etc. Since for the wheels we'll have overlapping empties, it might be a good idea to make them different shapes.

    2B: respect scene hierarchy
    Make every mesh a child to its respective dummy !
    In this case, we want the wheels to rotate, so we need to make the visual wheel a child to the dummy. E.g.: Visual_wheel_LF mesh is a child of WHEEL_LF dummy.
    The hierarchy is very important. If we don't respect it, the car might load ok, but nothing will move. The wheels would be stationary as if part of the body design :).

    IMPORTANT NOTES:
    - all dummies must have Z-axis pointing forward and Y-up.
    - car's body origin/pivot point : the model must be placed with the wheels touching the ground on the 0 coordinate (see below).
    07_pivot_points.png

    - pivot point of dummy must be identical to pivot of child mesh (or vice-versa). E.g. below: wheel mesh (colored texture) and the dummy (cube) have identical origin/pivot point.
    08_pivot_origin.png

    2C: export to FBX format
    Great, you have everything setup. You are ready to export to FBX (up to 2014/2015 format; 2016 is unsupported). If you are working in Blender, it is a good practice to check the box Selected Objects. This will allow you to only export what you have selected (e.g. car + wheels, but NOT collider; supposing you have them all in the same scene).
    Also, pay attention to the little button next to scale (must be deselected).
    Export in the same folder (see folder photo above).
    09_export_car_blender.png


    Awesome. Now, KS EDITOR time !

    3A: import the car .fbx
    You should see something like this (if the car is black, you are probably missing textures. You can reassign them here in the editor - just go to material tab, select object, reassign texture).
    10_ks_editor.png

    3B: define the shaders/materials
    For this tutorial, it doesn't really matter what material/shader settings you are using. Just play with values till you like what you see. We'll cover car shaders in separate topics.

    3C: export to .kn5
    - the name of the exported file must be identical to the name of car folder (see folder photo above).
    - use only lowercase, otherwise you might run into issues

    3D: collider
    - physics/collisions calculation is very CPU intensive (especially when everything needs to happen in milliseconds). Therefore using a high poly mesh for collisions would be impossible. It is therefore required to use a VERY (40-60 triangles) low poly basic shape as collision box.

    - repeat above steps 2C to 3C for collider. Name it collider.kn5 and export to your car folder (see folder photo above). Note you need to set it with a material called GL, then assign the GL shader in KsEditor before exporting.

    - for this tutorial, the car geometry is very simple, so we are going to use a copy of the body (only body, no wheels, no dummies). But, for your future projects, you will need to define a basic box about the same size as the car.
    11_collider.png

    - notice the pivot point also at 0 (Y) as the car.
    - NO vertex under the car bottom (so DON'T go as low as the ground)

    Good, now you are done with the graphical part.
    ***

    PHYSICS
    Now that AC engine knows how to communicate with our visual car, we need to define all that nice technical data about our vehicle. That will determine its behavior inside the sim.

    4: Edit \DATA\*.ini files
    Again, we will start with base files from formula_K.
    BUT, for the very first car, we don't need them all. I have reduced the number of files (and modifications) to a minimum in order to get your car moving. After that, it's just a matter of studying and crunching numbers in order to bring the behavior close to what's expected. Most of them, are self-explanatory once you take a look inside.

    So, I divided the ini files in multiple categories, as you will see below.
    Where editing is required, that is also indicated.

    MANDATORY (without them, the car will not load and game will crash)

    aero.ini :used to define all wing-type objects
    - delete all the wings except 'body', then delete all the wings *.aoa files except body.
    - uses (therefore also needed):
    - wing_body_AOA_CD.lut - defines the lookup table for Coefficient of Lift
    - wing_body_AOA_CL.lut - defines the lookup table for Coefficient of Drag
    * you can add as many wings you wish, but don't forget to add the corresponding _CD and _CL .lut files for them

    cameras.ini - default is ok to start with

    car.ini : car parameters.
    - we should at least change the SCREEN_NAME (can be anything), as it will appear while in-game
    - IMPORTANT: we don't deal with suspension animation at this point so be sure to set USE_ANIMATED_SUSPENSIONS=0

    driver3d.ini : default is ok to start with

    engine.ini : defines engine parameters.
    - uses the lookup table:
    - power.lut (mandatory)
    - note: no coast.lut file is required anymore. Must keep the section in engine.ini to keep AC from crashing, but do not use for data.

    lods.ini : used to improve performance (but we'll speak about it another time)
    - edit block LOD_0, and put your .kn5 file name
    - since we don't have any other LODs at this moment, we delete all other blocks LOD_1, 2, etc

    suspensions.ini : suspension type and data
    - modified wheelbase to 1.9m and CG to 0.3 to match more or less our little 3d model (visual reasons).
    - NOTE: this indicates the car's CG so a better suited value to start with is 0.5 (50%front)

    tyres.ini : define tyres parameters.
    - uses lookup tables for both wear and temperature. Depending on the type of tyre you wish to use, corresponding *.lut file must be added. In this case:
    F3hard_front.lut
    F3hard_rear.lut
    tcurve_F3hard.lut
    etc.
    All the parameters (e.g. heating) are in the tyres.ini under [THERMAL_FRONT] and [THERMAL_REAR]. Supposing you would like to modify tyre overheating and temperatures, you would play with:

    friction_k value is heat generated by lateral sliding
    rolling_k value is heat generated by rolling driving straight.

    You would first need to determine when are your tyres overheating. And than play around with the values. Small adjustments and not both parameters at same time, ie; if you're overheating while cornering than adjust friction_k etc.

    final.rto, ratios.rto
    These can be deleted, they are used for cars with multiple gear ratio options (as it's the case for formula_k). The setup.ini will refer to this, so if you do remove them, then make sure to amend that too (just delete the relevant section).

    OPTIONAL, BUT MANDATORY (car should load, but behave weird)

    brakes.ini : brake parameters
    - car will load in-game, but.. you'll have no brakes (this is the way James Bond's car would be sabotaged in Assetto Corsa, for example) :D

    colliders.ini : defines collision behavior for bottom of the car (car bottom touching the ground). This should come as an addition to the collider we already have (that handles all other body collisions).

    drivetrain.ini : drivetrain parameters
    - car will/should load, but you can't engage any gear.

    setup.ini : used to define all the available option user has in garage
    - car will/should load, but when you hit drive, game could crash.

    At this point, your data folder should look like this:
    12_data_folder.png

    ..aaaand you should have a complete working car ! GO DRIVE THIS BEAST ! :D
    13_ingame.png


    ***
    When you want more, you'll notice the presence of a sub-folder named FOR_LATER_USE. That one contains all the files that are optional at this phase (meaning your first drive), but should be defined and moved to data folder for the final car. A few words on them:

    throttle.lut : This controls your throttle map (though very simple, just a 0-100% input versus output). This will have a perfect linear throttle, you can tweak it later:
    0|0
    100|100
    /gary

    ai.ini : AI parameters

    ambient_shadows.ini
    : defines size of car shadows

    analog_instruments.ini : controls analog dash instruments

    blurred_objects.ini : when you will wish to include blurred rims on your car, you will need this file.
    - do NOT forget it later

    digital_instruments.ini : controls digital instrumentation incar
    Just a reminder to always delete the contents of this at a start of a new project, always causes crashes as its looking for a dummy that is likely not there on your model. /gary

    damage.ini : controls visual damage level

    dash_cam.ini :

    electronics.ini : controls electronic driving aids car might have

    escmode.ini : controls the orbiting camera you sometimes see in the pits, the height/distance it is away from the car. /gary

    flame_presets.ini : very detailed info about exhaust flame phases, never messed with this before. /gary

    flames.ini : this is the simple controls for exhaust flames, used to control the position and direction. Tip - open the console (press Home), enter "set observeFlames 1" (case sensitive) and you can see the flames and can edit them realtime. /gary

    lights.ini : different light parameters

    mirrors.ini : mirror parameters
    - important when you'll include mirrors

    sounds.ini : sound parameters (e.g. engine position). Without it, probably defaults to some standard sound configuration (?)

    suspension_graphics.ini : Genuinely have no idea what this is for, never used it/seen it used for any car even those with animated suspension. Just leave it blank. /gary

    wing_animations.ini : animated wings

    NOT REQUIRED (delete/ignore)
    proview_nodes.ini - delete. Will be automatically created.
    coast.lut (obsolete)

    FINAL NOTES
    If you change the name of a folder/car, you need to check 3 things:
    - name of folder and name of kn5 file are identical
    - edit lods.ini and change the name of the kn5 to be used
    - change bank file (and GUIDs if the case)

    This is really a BASIC guide. It's meant to get your first creation moving. Once you understand how it works, the rest is just a matter of adding additional dummies to different car parts. Although, some additional guides should surface this forum, don't hesitate to consult the pipeline doc. NOW, it will be more relevant since you know the link between different components of a complete mod car.


    Happy modding :).

    PS:
    I have attached the complete folder for the above project. It only misses the bank file, due to its size. If you want to run it in-game, you just need to copy the bank file from the cobra and rename it to acm_tutorial_basic.bank (the GUIDs is already prepared for this car). Why this car ? It had the smallest bank file :D.
     

    Attached Files:

    Last edited: Dec 15, 2017 at 9:43 PM
  2. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    UPDATES:
    04-09-2017: feedback from Pankykapus (3D artist at Kunos)
    ***

    Polygon budgets:

    LOD A exterior: 125k tris
    LOD B exterior: 20-25k tris
    LOD C exterior: 10-12k tris
    LOD D exterior: 2-3k tris

    HR Cockpit: 125k tris
    LR Cockpit: 7-10k tris
    LR Cockpit in LOD B: 4k tris
    LR Cockpit in LOD C: 2k tris (concentrate detail above window level)

    These are generic budgets, so a good reference to keep in mind. But in practice there is no real limitation (higher or lower). It's just that going lower might hurt detail, going higher might hurt FPS.

    Another aspect of modelling cars, imho, is the detail of the wheels. Sometimes, you can get away with lower detail on car body, but very well made wheels. So here are some numbers to help in this direction as well.

    Budget for a wheel (tyre+rim) should be around 5-7k tris (for normal-looking rims).
    Can go as high as 12k in case of complex geometry.

    Recommended number of outer sides on tyre+rim is 80 (unless the number of spokes requires otherwise (70 or 90), reduce by half in each lower LOD; One thing to consider here is also the number of spokes the rim has, as it might influence your choice.
     
    Last edited: Sep 4, 2017
    DrDoomsLab likes this.
  3. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    Reserved for further goodies (e.g. add rims+tyres)
     
  4. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    Reserved
     
  5. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    Reserved
     
  6. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    Reserved
     
  7. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    A stupid overlook made loose about 3h today to get back inline with the guide. But it's coming along. I'll see if I can post tomorrow. There are some changes, but all in the right direction I believe. (..and with this occasion I've reserved yet another post for later).
     
  8. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    Finally, it's OUT ! It took quite some time :D
    Please, let me know if you spot any issues, or you'd like to bring additional information. Hope it helps.

    For those familiar with the initial first post, I have decided to use a simpler car for tutorial. And I would like to start later a WIP thread for the Legends Car :).
     
    DrDoomsLab likes this.
  9. garyjpaterson

    garyjpaterson Member

    Joined:
    Jun 28, 2017
    Likes Received:
    44
    Great effort, really the first 'all-in-one' tutorial, almost everything else will only get you so far - this gets you from nothing right to a working car :)

    Few pointers

    Collider - Note you need to set it with a material called GL, then assign the GL shader in KsEditor before exporting.

    Dummys - Didn't see it mentioned, but never scale them once created. Doesn't matter what size they are, but scaling them afterwards can cause all sorts of issues.

    CG_location - I know at this stage your example is very basic, not sure where you're getting 0.3 from for that value. As a starter I'd use 0.5 (50%front), 0.3 is typically for rear engined cars like a 911 (which yours certainly doesn't look like!)

    throttle.lut - This controls your throttle map (though very simple, just a 0-100% input versus output). This will have a perfect linear throttle, you can tweak it later:

    0|0
    100|100

    final.rto, ratios.rto - These can be deleted, they are used for cars with multiple gear ratio options. The setup.ini will refer to this, to make sure to amend that too (just delete the relevant section).

    digital_instruments.ini - Just a reminder to always delete the contents of this at a start of a new project, always causes crashes as its looking for a dummy that is likely not there on your model.

    escmode.ini - This controls the orbiting camera you sometimes see in the pits, the height/distance it is away from the car.

    flame_presets.ini : Very detailed info about exhaust flame phases, never messed with this before.

    flames.ini - This is the simple controls for exhaust flames, used to control the position and direction. Tip - open the console (press Home), enter "set observeFlames 1" (case sensitive) and you can see the flames and can edit them realtime.

    suspension_graphics.ini - Genuinely have no idea what this is for, never used it/seen it used for any car even those with animated suspension. Just leave it blank.

    I think that's it for now :)
     
    luchian likes this.
  10. AccAkut

    AccAkut New Member

    Joined:
    Sep 4, 2017
    Likes Received:
    7
    so, now I have an account here aswell

    Regarding GL material: I think at some point your could not choose it via the dropdown menu in the KS Editor, requiring modifying the persistence file by hand - but at common\assettocorsa\sdk\editor\system\cfg you will find a txt file named shader_filter_list.txt in which all sorts of shaders are listed. Delete them from the list, and you can choose them in the Editor.

    Also, either Blender does something weird when exporting, or the KSEditor when importing, but to get the collider mesh to work correct you need to export it turned by 90°, basically pointing into the sky
    [​IMG]
    (http://www.assettocorsa.net/forum/i...al-editor-does-not-have-gl.15192/#post-275967)


    Regarding scaling dummies... I never had an issue with that in Blender, as long as I "Applied Scale" on those modified dummies (which I often do for clarity reasons). Probably in some way related to the collider stuff above.
     
    luchian likes this.
  11. garyjpaterson

    garyjpaterson Member

    Joined:
    Jun 28, 2017
    Likes Received:
    44
    Never had that issue with the GL shader, always been there for me. Good to know a solution if it disappears though.

    And yeah, I you can reset or collapse scale/transforms on dummys in 3DS too, but I have had issues in the past with this so tend to just make them again.
     
  12. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    @AccAkut hi there, welcome :).

    GL material/shader
    Yes, there used to be a time when some shaders were hidden and you had to edit the txt file. For the most common ones, I think this is not an issue anymore. It is however handy to know where to look in case of trouble.

    Axis
    Hmm, I don't have any problems exporting the collider (I work in Blender as well). Actually both for the body mesh and collider, it seems it's not even necessary to bother modelling with Y-up. In my experience, this is only important for the dummies. But maybe I was just lucky :D. I will repport back in case of problems.

    Dummies
    I had no trouble in Blender either. But then again, in Blender is extremely easy to play with units.

    @garyjpaterson
    I did however, had this problem in max, about 1 year back when I gave car modding a try.
    ..and it was ^^ also the reason why I quitted and stayed with tracks. Units in max are a big mess (..at least for not very experienced users like myself) :).
     
  13. lukeno995

    lukeno995 New Member

    Joined:
    Nov 3, 2017
    Likes Received:
    0
    the bank file where is?
     
  14. lukeno995

    lukeno995 New Member

    Joined:
    Nov 3, 2017
    Likes Received:
    0
    ok i found it
     
  15. speedingscientist

    speedingscientist New Member

    Joined:
    Dec 6, 2017
    Likes Received:
    0
    Hi so I have a problem:

    I started working with your tutorial now a few months ago and now i got everything done, but I tried to load my car, which I followed your tutorial directly on, and it doesn´t load I only get from the loading screen back to the main screen.

    Ok then I thought I made a mistake and wanted to look if it the game loads our downloadable car but it doesn´t load it either. Does anyone here know why this might happen?

    thanks for helping
     
  16. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    The downloadable car does not work because you did not read all the instructions :). I am willing to bet that you did not copied the .bank audio from the cobra like it's written in the 1st post :p.

    As for your car, nobody can guess without more info or attaching logs.

    PS: welcome to the forums :)

    Sent from my phone using Tapatalk
     
  17. speedingscientist

    speedingscientist New Member

    Joined:
    Dec 6, 2017
    Likes Received:
    0
    I did copy and rename the file from the cobra :) so this is why I ask. Didn´t attach the file because I compared it to yours and it´s exactly the same and it can´t load yours too.
    thanks for the quick answer
     
  18. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    I am referring to attaching logs, not car folder.
     
  19. speedingscientist

    speedingscientist New Member

    Joined:
    Dec 6, 2017
    Likes Received:
    0
    well that´s another problem.... I get the window that theres an error "view log for details" but when I´m looking for the log file there is none.
     
  20. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    560
    Where are you searching for it ?

    Sent from my phone using Tapatalk
     
: tutorial, car mod