1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
Like RaceDepartment on Facebook.

I have a technical question.

Discussion in 'Racer' started by John Smith, Mar 16, 2012.

  1. I have been playing this game for about a week now and I was wondering how to change the colors/ paint scheme of a car. If someone could post a step-by step process that would be great. I know it sounds trivial but I can't stand driving a green Ferrari.
     
  2. Stereo

    Stereo
    Premium Member

    If you go into the car folder, there should be a bunch of .tga files.

    The relative standard of Racer is to call the main texture map 'body.tga' or something along those lines (the default Lamborghini uses lambobody.tga).

    If you open that up, you'll see something like this:
    [​IMG]
    You can pretty much see the various parts of the car laid out.

    From here it can go two ways.
    1) The sheet is mostly gray (as with the Murcielago) but the car is a different colour ingame.
    2) The sheet is the same colour you see in Racer.


    If 1), then open up car.shd. Find the section that uses the body texture. It'll be something like this:
    Code:
    shader_murcielago_paintwork~vf_reflect
    {
      cast_shadow=1
      reflect=1
      diffuse=0.97 0.25 0 1
      ambient=0.88 0.19 0 1
      specular=1 0.75 0.25 1
      shininess=14
      mipmap_bias=6
      fresnel
      {
        bias=0.06
        scale=0.98
        power=2
      }
      layer0
      {
        map=lambobody.tga
      }
      layer1
      {
        map=$trackenvmap
      }
    }
    The section determining the colour of the car is ambient=, diffuse=, and to a lesser extent specular=. These are listed in RGB components ranging from 0 to 1. =0 0 0 is completely black, =1 0 0 is bright red, and so on. Just pick the colour you want, and put it in. As you can see here, ambient should probably be a little darker than diffuse. Specular= determines the hilights caused by the sun - on most paint this would be similar to the other two, but you can get funky coloured hilights this way.


    If the body panels are the same colour as in Racer, you'll want to edit the texture. I'll explain how to accomplish this in GIMP since I'm more familiar with it and it's trickier. In Photoshop you can just create an adjustment layer that colorizes, with a greyscale map indicating which parts of the texture to apply it to, and it's pretty easy.
    Start by making a copy of the layer. Then go to colorize (Colors->Colorize)
    [​IMG]
    On the left you can see the duplicate layer, in the middle you can see what happens to the texture when it's been colorized.
    Once you have the colour you want, erase anything from the layer that shouldn't be coloured. This is where having the copy comes in - as you erase, the original layer will show up.

    You'll want to take care of the alpha channel separately. I don't know offhand how to accomplish this in Photoshop. In GIMP, use Layer>Mask>Add Layer Mask... and choose to transfer the alpha channel.
    [​IMG]
    Then you can right click the layer and temporarily disable the layer mask. Disabling alpha makes it a lot easier to see what the various parts of the texture are, if they're transparent.
    [​IMG]
    Once you've got all the lights and stuff back to their proper colours, you should save a copy in a format that support layers, then merge the layers. This copy will let you edit the colour at a later point easily, by just colorizing that upper layer again.
    The easiest way I know of is to use the right click menu of the layers, 'mask to selection', 'disable layer mask' on both layers, 'merge down', and then go Layer>Mask>Add Layer Mask... and choose "Selection" this time.
    [​IMG]
    You should end up with something that looks like the original, except a different colour. Go ahead and save as a .tga, 'lambobody_red.tga' perhaps. You could save over the original texture to save effort, but then you can't revert it easily. In the .tga options, "RLE compression" should make the file a little smaller and Racer is fine with it.

    So once you have the new texture map, open up car.shd, find any layers using 'lambobody.tga' (search and replace should do this easily) and change them to 'lambobody_red.tga'.