Friday 27 December 2013

Importing to rFactor 2

Once I had exported everything from max all I had to do now was modify the code. I did this using Notepad ++. Here's one of the .gen files I modified. As you can see this is the file that you say what models go where. You can also setup the LOD's in here but I wont be making any lod's at the moment.


Now all the models and textures are in the game dev mode. I had a little bit of a problem with the position of the wheels and figured out I needed to adjust the suspension. I had a look round on the forums to find out what piece of code I needed to modify and found someone had made a suspension editor for the first rfactor which also works with rfactor 2 so I had a play round with that. It took me a while again to find out what did what but i managed to get the wheels in the correct position after some trial and error. Here's some of the code I modified. 


I also had to change the camera position of the cockpit camera which was pretty easy to do, just z,y and x values in the code. One other problem I had was the steering wheel would rotate around an irregular axis. So again I did some searching on the forums and found a piece of code. I needed to get the angle of the steering wheel from max and calculate the COS and SIN to get the correct values for the engine. Here's a little piece of code that I used and now the steering wheel rotates perfectly.


And here are a couple of pics of my car working in engine.




Tuesday 24 December 2013

Exporting from 3DsMax

I actually started doing this a while ago so this blog post is a little late. I followed the Complete Vehicle modding tutorial pdf that is on the rfactor 2 website and imported the car they provided. I did that in the first few weeks of my project to get familiar with the workflow. I used this as a base for importing my own car. It was really just a matter of changing file names in the code.

All the material setup is done in Max with a plugin they provided. The only problem is this plugin only works with max 2012 so I had to download the student version of that just to do the exporting. My supervisor advised for me to get the car in the engine before I finish off all the texture work. So the only objects I had textured were the wheels and steering wheel. Its Pretty easy to setup the materials in max once you get used to it. I just had to change my wheels textures as the tyres need their own texture sheet. This is because the tyres have an animated texture that blurs when its spinning.
Here are a few pics of the material setups. Its pretty much the same setup for everything accept for things with alpha channels. cube maps or animated materials. 


Then I just needed to apply the textures to each object. The tyres, rims, brake disks, interior etc all need to be separate and have a specified naming convention. For example for the wheels I have test_car_lr_tire
then just change the lr to lf, rr and lr. This is the same for the rims, brakes and calipers. Also the american spelling of tyre needs to be used which gave me some problems earlier. To export the objects I had to use the GMT file exporter which are the file types rfactor 2 uses. Here's what it looks like.