Giter Club home page Giter Club logo

custom_vehicle_lights's Introduction

Description

This is MTA:SA custom vehicles lights system resource. It allows you to create any lights you want (break, reverse, indicators, sirens, etc, concrete name doesnt matter) and manage they. It is based on simple shader (for brighting light textures) and custom coronas (for emulating light effect).

The resource provides only client-side lights API. For ready to use lights system see improved_vehicle_lights resource.

Demo video here!

Features

  • One shader per vehicle
  • Single light texture (or you can use more if you need)
  • Up to 48 lights per vehicle (technically it can be extended in future)
  • Flexible configuration
  • Non-discrete light power (from 0 to 1)

Requirements

The resource uses custom directional coronas to emmulate light effect. So it requires extended_custom_coronas resource (it is modified version of custom_coronas resource by Ren712 - thx him for coronas).

Exported client-side functions

  • float getVehicleCustomLightPower(element vehicle, string lightName)
  • boolean setVehicleCustomLightPower(element vehicle, string lightName, float power) (power is from 0.0 to 1.0)
  • float getVehicleCustomLightSize(element vehicle, string lightName)
  • boolean setVehicleCustomLightSize(element vehicle, string lightName, float size)
  • int, int, int, int getVehicleCustomLightColor(element vehicle, string lightName)
  • boolean setVehicleCustomLightColor(element vehicle, string lightName, int r, int g, int b, int a)

How to use

Lights config

Firstly look at cvl_config.xml. Here is lights properties. Use it as is or change it as you want.

The "textures" node tells what textures will be used for lights:

  • name name of the texture

The "lights" node defines custom lights:

  • name unique name of the light (used in functions)
  • flag material diffuse rgb value of the texture
  • dummy vehicle dummy name, used for custom corona
  • size size of custom corona
  • color color of custom corona
  • mirrrored use it if u want to mirror dummy position (it's usually used for left-side lights)

The "models" block has the lights unique settings for concrete vehicle models. For example, some models might have red indicators.

  • name name of the customizable light (must be defined in global "lights" node)
  • size size of custom corona
  • color color of custom corona
  • rotation rotation of custom corona (it is recommended to define light rotation by model dummies, not by this config)

Model adaptation

Steps by example of reverse_r light:

  • create material with texture named vehiclelights (this is just default name, you can change it or add another in config)
  • define material diffuse color equals to flag value, for reverse_r it is 255,58,1
  • apply material to light polygons
  • create unique dummy named reverselights and define its rotation (remember that ZModeller has wrong axis, check any "ImVehFt" vehicle model, or just add additional dummy with suffix _dir, for example reverselights_dir, which means light direction vector)
  • done

Note: if you works with ZModeller, remember that DFF importing resets all diffuse colors! Work with ZModeler project files.

custom_vehicle_lights's People

Contributors

rifleh700 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sndrkrly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.