Sign in to follow this  
Tut

Custom vehicle lights

Recommended Posts

Introduction

Vehicle indicators are mostly seen on other GTA modifications where the mod 'IVF - Improve Vehicle Features' is compatible. This mod allows for light modifications such as police flashlights, custom LED flashers, indicators and much more. These features are sought after by MTA roleplaying servers a lot. 

This guide aims to introduce 3D modelers to prepare models for customisable lights, which then requires coded shaders to work. Anything related to scripting is not included in this guide. The guide assumes that the modeler has basic understanding of importing and exporting models.

 

 
Editing existing Huntley for indicator lights
With Huntley imported into 3ds Max, isolate the mesh called 'chassis' as it is the only component that needs working lights. As seen the car has 4 lights; right tail light, left tail light, right headlight and left headlight. All 4 has their own material assigned for them to act each their own way. The material color codes are hardcoded in the game telling it when to show illuminated brake lights for when the car brakes and so on.
For this custom vehicle however, any geometry meant for custom vehicle lighting needs white color code and a custom texture name for shadering to work.
Before anything, it's required to get the custom lighting texture ready. For this guide, vehiclelights128 and its illuminated version works perfectly fine. These needs be renamed to customRRLightsOff and customRRLightsOn and so forth. The 'RR' is for 'right rear', where as 'LR' would be 'left rear'. This needs be done for front too, so in total 4 'off' images are needed while only one 'on' is needed, as it can simply be instanced when shadering.
 
Below is a step-step process on editing Huntley's geometry and adding custom indicators.
  1. Add an 'Editable Poly' modifier to the model.
  2. Press '5' key on keyboard which enables 'Select by Element'.
  3. Select the two rear light meshes, ensure they are both highlighted.
  4. On 'Modify Panel' scroll down and find 'Slice Plane', click that. This creates a rectangle that has a line-preview for the cut.
  5. Align the plane to the lights and create two cuts for the indicator lights.
  6. Select one side of the geometry that was cut by using 'Select by Polygon'. On the modifier stack, click 'Collapse all', leaving only 'Editable mesh' on the stack.
    unknown.png
     
  7. Press 'M' key for 'Material browser'. Create a new GTA material.
  8. In the texture slot, add in the 'customRRLightsOff'. On material browser, click 'Assign material to Selection'. Note that this needs be done for the left side too but with different material and texture.
  9. Apply a new modifier on the model called 'Unwrap UVW'. Press 'Open UV editor'.
  10. On the UV editor, enable 'Select by polygon'. Grab the UV island and drag it onto the orange section of the image, which is for indicator lights. 
  11. On modifier stack, collapse all, to save the new UV's.
    unknown.png
    Above: example of what can be achieved.
  12. Front lights section already has indicator lights, so all that needs doing is 2 new materials with each their own light texture, like done on rear side.
  13. The 4 new textures needs be added to the car's .txd file. Model is now ready for export.
  14. Now all that's needed is MTA scripting for the light shaders to work.

 

Exact same process can be applied for creating custom emergency lights. Note that it is not necessary to have these 128x128 textures in the model. They can be downscaled to 4x4 in the .txd and then a MTA shader script can apply the originals, which greatly reduces the size of download. 
This means it'll download 4 images which are then instanced onto every custom model using the lights. To put it short, each .txd will have 4 placeholder-images of 4x4 resolution rather than 4 images of 128x128 resolution.
 

 
 
  • Like 5
  • Thanks 2

Share this post


Link to post
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.