Toy Car With Opening Doors and Boot

I decided to finally make a guide to help people convert cars from V to IV with 3DS Max, without ever having to touch the horrid program that is ZModeler 2, and with working car tuning and steering wheels.
This guide is a result of about 2-3 years of experience wandering around the dark exploring and figuring out an undocumented system, rediscovering everything from scratch that ZModeler can do and more.

This is probably still only the tip of the iceberg, if anyone else with even just general max knowledge has more tips and tricks I can add them to the guide.
The first try might be rough but once you have it down, this guide should make you able to convert a fully functional car in less than an hour.

Requirements

GTA IV 1.0.8.0 or earlier with the latest versions of ZPatch and ZMenu

3DS Max 2017 (might work on other versions but I did everything on 2017)
My maxscript
ZModeler 3.1.2 (you can get this from a quick google search)
Openformats I/O for 3DS Max (by Alexander Blade, modified by me for more detailed errors, extract into 3ds max folder)
v2saconv by DK22Pac (with a config set up for V cars)
Notepad++ (not required but makes some sections a lot easier)
OpenIV
Codewalker (Discord Server) (newest version required which is only available on their discord server)
My .yft.xml to IV shaders converter
Kam's GTA Scripts (updated for newer max versions by gold_fish)

My extra vehshare for all additional textures (put into vehicles.img)

Extracting files from the game

Use OpenIV to find these with the search feature:
The car's .yft files (they will need to be converted separately):
(carname).yft for LQ interior
(carname)_hi.yft for HQ interior
All .yft tuning parts you want to use, get them from (carname)_mods.rpf


The car's .ytd files (use right click - Export to openFormats):
(carname).ytd
Any other linked .ytd files (you can find the required filenames in vehicles.meta in the txdRelationships section, search for the car's name and you should find it under <child> and the interior .ytd name right above it in the <parent> field, these might be stacked and they might be stacked between different DLCs so make sure to cross check and extract each one until you get to one that has its parent as "vehshare")

Getting collisions

Open ZModeler 3.1.2
Hit import and open the LQ interior .yft you extracted
If the import fails due to an unknown material hash, refer to the "Fixing new shaders for ZModeler" section at the bottom
Click the COL button on the top right

unknown.png
Hit export, select Wavefront .OBJ from the Save as type dropdown, tick Use Materials (*.MTL), untick Flip YZ axes, untick Optimize vertices and make sure Split by groups is selected and then save it
unknown.png

Getting the model

Put all .yft files into the same folder as v2saconv and run convert.exe, you should now have a ton of .dff files

Getting shader lines

Launch Codewalker (use CodeWalker RPF Explorer.exe as the world view is useless for this)
Put all .yft files into a folder and use Codewalker's Open Folder option in the File dropdown to open it
Select all the .yft files, right click and hit Export XML, export to the same folder as my .yft.xml to IV shaders converter
unknown.png
Run yftxml_to_shaders.exe, you should now have a ton of _shaders.txt files

Importing into 3DS Max

Select the Utilities tab on the right and click DFF IO under the Kam's GTA Scripts rollout

unknown.png
In the Kam's GTA Scripts window that just popped up, under Import DFF make sure "Standart" is checked (their typo not mine) instead of GTAMaterial
Hit Import DFF, import either the LQ or HQ interior .dff exported from v2saconv
You should now have the car in your 3DS Max project
Use the regular 3DS Max Import window to import the .obj collision you made from ZModeler earlier, and then drag all of the newly imported __COL_ objects to make the parent object be chassis__COL_
Select all __COL_ objects, right click and hit Rename
Uncheck Base Name, check Remove Last and enter 6 into the Digits box, then hit Rename
Go to the Scripting tab at the top, select Run Script, then navigate to and select my maxscript (zcarconvert)
With all collision objects still selected, hit the Set Up Collisions button in my maxscript, this should result in it looking like this:

unknown.png
Select the imported .dff model, right click and hit Select Child Nodes
Click on the Convert button in my maxscript, this might take a few minutes to complete depending on how high poly the car is

Moving steering wheel

After clicking Convert, if the car has a steering wheel, you'll get a popup of the angle that you'll have to write down. Type that angle into your car's vehicles.ide line in the flags section, e.g.: wheelangle:-10.0 (of course replace -10.0 with the X angle)

It's now recommended to save in case anything goes wrong

Fixing collision materials

Now to do something Rockstar apparently couldn't do for the Kuruma in the Tuners update, hide everything except the chassis_1 geometry object and then select it.
In Polygon editing mode, select all polygons around the doors and windows (you can find the exact polygons by opening the original .yft in OpenIV and hiding everything except chassis, you need to select all the polygons that are red in Bounds view)
With all the right polygons selected, scroll down to Surface Properties and enter 2 in the Set ID box, hit Enter
Some cars also need the same thing done for boot and/or doors, you can again check this with OpenIV
Once all required collisions are done this way, you should have them be colored exactly the same as in the OpenIV bounds preview
unknown.png

Properly burstable tyres

This is actually something ZModeler can't do at all, with this method you can manually select which polygons will never be removed when the tyre bursts, regardless of how big the wheel collision is.

Hide everything except wheelmesh_lf_1 under wheel_lf - wheelmesh_lf
In Element mode, select everything that's supposed to be part of the tyre (and not the disc)
Check inside the tyre as well for potential elements to select as the inside of the tyre is hidden behind the disc but most of the time it is there
With the appropriate elements selected, right click wheelmesh_lf_1 and click Clone
Select Copy under the Object section and hit OK, you should now have wheelmesh_lf_002
Go back into Element mode under wheelmesh_lf_002 and delete the elements you've selected
In my maxscript hit Unburstable wheel, select wheelmesh_lf_1 again and go back into Element mode
Right click wheelmesh_lf_1 and click Select Invert, then delete the selected elements, it should now only be the tyre left.
unknown.png

Any wanted tuning parts need to be added before the next step, follow the Tuning parts section and then come back here

Export and set up .oft

Select the ft_(car name) dummy
In the Utilities tab, under OPEN FORMATS I/O there's a \ FRAGMENTS \ OFT section, hit its Export Single button
This might take a while (my Kanjo port with 70 or so tuning parts took 30 minutes to export, but LQ interior cars with few tuning parts can take less than a minute)
unknown.png
After it's done, open the .oft file with Notepad or Notepad++
Scroll down to the shadinggroup section, you'll see a bunch of gta_default.sps lines
Replace each of these with its appropriate shader line from the _shaders.txt you generated earlier

Special suffixes (these aren't actually part of the texture name):
_color2: copy the line that has these first 3 numbers after the texture name 2.000000;2.000000;2.000000
_color3: copy the line that has these first 3 numbers after the texture name 2.000000;3.000000;3.000000
_color4: copy the line that has these first 3 numbers after the texture name 2.000000;4.000000;4.000000
_tyre: copy the line that uses gta_vehicle_tire.sps and this texture

Special texture names:
unk1, unk2, etc.: 99% of the time this needs to be the line that starts with gta_vehicle_generic.sps plate01


Other notes:

There are sometimes 2 vehglass.sps shaders in _shaders.txt, in this case you have to take the one that has 1.000000 as the last number parameter, the one with 0.500000 would make the glass abnormally shiny. If both are 1.000000, then you can take either.

To fix lights behind glass not showing up properly, you'll first have to find its material ID.
To do this, first count starting from 0 which shader in your shaders list is gta_vehicle_lightsemissive.sps and remember this ID.
In this example shader list, the ID would be 2 as it's the 3rd shader in the list:

gta_vehicle_interior2.sps tyrus_std_interior 2.000000;5.000000;5.000000 100.000000 1.000000 1.000000;0.000000;0.000000 0.450000 vehicle_generic_smallspecmap gta_vehicle_shuts.sps vehicle_generic_doorshut 2.000000;1.000000;1.000000 100.000000 1.000000 1.000000;0.000000;0.000000 0.450000 vehicle_generic_doorshut_normal vehicle_generic_smallspecmap gta_vehicle_lightsemissive.sps tyrus_lights 1.000000;1.000000;1.000000 3.500000 0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000;0.00000000 100.000000 1.000000 1.000000;0.000000;0.000000 0.500000 vehicle_generic_glassdirt vehicle_generic_smallspecmap

Go into the car name folder where your .oft is and open common_mesh_high.mesh
Search for Mtl (the material ID you got) in the above shader list that would be Mtl 2
Select the entire Mtl section, cut, then paste it at the top, right below the line Skinned 1
Repeat this until every section with that material ID is at the top

unknown.png

.wtd file and txdp

Create a .wtd file with your car's model name in wherever you want to install the car (vehicles.img, update.img, etc.)
Open it and drag all textures you exported earlier into it
In the txdp section of vehicles.ide, link vehshareV to the car like so:

vehshareV, vehshare (carname), vehshareV

You can chain any number of .wtd files together like this, so if the main car .wtd is too large (each .wtd absolutely needs to be below 8MB, but 4MB or lower is recommended), you can even go crazy and split it like I have in my Weevil convert:

weevil_livery5, vehshareV weevil_livery4, weevil_livery5 weevil_livery3, weevil_livery4 weevil_livery2, weevil_livery3 weevil_livery1, weevil_livery2 weevil, weevil_livery1

Liveries (for cars that support them)

First, add +livery to the vehicles.ide flags

Next, use Codewalker or OpenIV to extract all livery textures (they're usually in (carname)_mods.rpf as embedded textures in _livery.yft models)

Rename all livery textures to be (carname)_sign_(number) (e.g. for Blista Kanjo it'd be kanjo_sign_1, kanjo_sign_2, and so on) and import them into your car .wtd

Open the .oft with Notepad again and change the livery texture, which is the third to last parameter in each paint3.sps line, to (carname)_sign_1

Example:

          gta_vehicle_paint3.sps vehicle_generic_smallspecmap 2.000000;1.000000;1.000000 180.000000 0.150000 1.000000;0.000000;0.000000 25.000000;0.000000;0.000000;0.000000 0.970000;0.000000;0.000000;0.000000 0.450000 0.800000;0.000000;0.000000;0.000000 kanjo_sign_1 vehicle_genericmud_car vehicle_generic_smallspecmap        

Import into OpenIV, check model in-game

The car should now be ready for import, drag the .oft file into OpenIV in the same place your .wtd is, set up vehicles.ide and carcols.dat lines and start up the game, the car should be ready to go.

Rescaling wheel collisions

Note that this is much less likely to be required with v5 or above of the script as wheel collisions are now calculated automatically based on the wheel mesh radius.

If after importing the car you've realized that the wheel is inside the ground or floating, you'll have to go back to 3DS Max for a little bit.

Go through all 4 wheel collision spheres (wheel_lf_1, wheel_rf_1, wheel_lr_1, wheel_rr_1) and on the right side, change each of their Radius properties to what you think would work (the visual sphere DOES NOT accurately show the collision scale, you'll need to add 0.135264 to the radius to see how big the actual scale is, then rescale it to exactly how big the wheel is, then subtract 0.135264 back from it to get it to be correct)

unknown.png


Extra step: Tuning parts
I recommend doing this one tuning category at a time and saving backups each time

There are 2 methods to create a tuning part, but this method is required for anything attached to the boot, bonnet and doors:


Click the Create tab, in Standard Primitives select Box
Drag a bit in the viewport to create a box, then select it and in its Parameters tab set Length, Width and Height to 0.1
Right click it in the viewport and select the little box to the right of Move to bring up the Move dialog, set Absolute:World X Y and Z all to 0
Right click the Box modifier on the right and select Editable Poly to convert it to an editable poly
With the box still selected, click Set up Collisions in my maxscript
Rename the box from chassis_collision back to Box001

unknown.png
Go back into Kam's GTA Scripts' DFF IO, select Standart material and hit Import DFF again, import all tuning parts you want
To find out where to put the tuning part, you'll have to find its name in carcols.meta (very unusal name for a tuning database R*) and check the <bone> field
If the bone is supposed to be chassis you can skip to the step after Disable Align
Select the tuning part(s), enable Align on the top right and then click the part that you'd need to move it onto
Tick X, Y and Z Position and set both Current and Target object to Pivot Point, untick all Align Orientation and Match Scale options then click OK
Disable Align
Select the tuning part(s) again and click Tuning Part (Box001) in my script
Move the tuning parts (the parent dummies) to where they should be in the hierarchy
Without anything selected, hit Fix ftc_ dummies in my script
unknown.png

If the tuning part has a default misc_ model in the default .yft, you can also move that out, remove the cm_ from the front of the name and do all of the above to it to make it a tuning part so it'll hide when the other parts are selected. (this will result in a few warnings about materials, you can safely ignore them)

If some tuning parts disable multiple misc_  models (you can find a list of disabled models in each tuning part's carcols.ymt entry in <turnOffBones>), you can do this to all of them and then clone the cm_ models as you wish and move them around the hierarchy (you can have multiple cm_ models per bone/dummy) to make everything work.

Creating tuning .dat in the carmods folder
Create an empty file in your carmods folder, call it the same as your car model name with a .dat extension (e.g. tyrus.dat)
As a base I recommend pasting this in:

[Tuning] m_nTuningPartCount=1 m_nCategoryCount=1 m_nDefaultInCategory1=1 m_sCategoryName1="Test"

As you add tuning parts and categories you'll have to increase m_nTuningPartCount and m_nCategoryCount, as well as add new m_nDefaultInCategory and m_sCategoryName entries accordingly
m_nDefaultInCategory is a tuning part's number that the car should spawn with for each category
To get Part IDs, Notepad++ comes in real handy:
Open the .oft file with Notepad++
Open the Find dialog and select the Mark tab
Tick Bookmark line and enter "group " into the Find what box, then click Mark All
In the top left Search menu, hit Bookmark - Copy Bookmarked Lines
Create a new document and paste the clipboard into it
Remove the tabulations and "group " so only the part names are there
Hold alt and drag from left of the first character to left of the first character of the bottom row
Go to Edit - Column Editor, select Number to Insert and enter Initial number 0, Increase by 1 and Repeat 1 then press OK
Add and remove spaces so there's only 1 space between the number and part, example:

0 chassis 1 wheel_lr 2 wheel_rf 3 wheel_rr 4 bonnet 5 door_dside_f 6 window_lf 7 door_pside_f 8 window_rf 9 wheel_lf 10 windscreen 11 tyrus_spoiler_2 12 tyrus_spoiler_3


Remove all the lines that aren't tuning parts (chassis, wheels, bonnet, doors, windows, etc.)
Now go back to the Find dialog and into the Replace tab, put Search Mode to Regular expression
Find:

(.*) (.*)


Replace:

[] m_sName="\2" m_nCategoryID=1 m_nPartID=\1 m_nPrice=0


Now alt drag from the top to the bottom in the middle of the [] brackets and use the same Column Editor method but with Initial number 1 instead of 0 and remove all trailing spaces again
Fill in all the info (name, category, price) while it's easier to read and then use this find and replace with Regular expression mode:
Find (yes, it needs the space in front):

          m_


Replace:

\r\nm_


Copy the lines into your carmods .dat file and adjust your category names, defaults, category and tuning part counts accordingly.
After getting in game if the car spawns with all stock tuning parts instead of all of them enabled, and you can switch between them in mod garages or the trainer Car Tuning menu, then you have done everything correctly and the car is properly tunable.

The alternate method:

Most of it is the same as the above instructions, but without creating Box001, and using the Single Part button instead of the Tuning Part (Box001) button in my script, and then while creating the tuning.dat, use this template for the part:

[1] m_sName="Display Name" m_nCategoryID=1 m_sBoneName="bonenamegoeshere" m_nPrice=0 m_bAlternateMethod=1

This will be compatible across multiple exports and bigger changes to the model as it references the bone name instead of the group ID, but won't work for anything attached to doors, boot and bonnet (they'll all show up regardless of the selected item when those parts are opened)

Up to 8 bone names can be added by adding more lines e.g. m_sBoneName2, m_sBoneName3

Extra step: Fixing new shaders for ZModeler
If you get an error in the collisions step such as Unable to locate material adaptation for shader 0x2239ab26, you'll have to do this:
Export the .yft to XML with Codewalker
Open the .yft.xml with Notepad or Notepad++
Open the Find and Replace dialog and replace hash_9C04C5E4 with vehicle_badges.sps and also do the same with hash_FE65615E and/or vehicle_track2.sps to vehicle_mesh.sps
Right click in Codewalker and select Import XML, select the new modified .yft.xml and import it back, the new .yft this creates will be properly importable in ZModeler 3.1.2 and you can continue with the tutorial

Edited by Zolika1351

Toy Car With Opening Doors and Boot

Source: https://gtaforums.com/topic/974288-iv3dsmax-converting-v-cars-with-tuning-and-steering-wheels/

0 Response to "Toy Car With Opening Doors and Boot"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel