Jump to content
scotg

Need help with ground vehicle lights

Recommended Posts

Headlights, taillights, reflectors, reverse lights, and interior lighting. All these things that operate on vanilla vehicles, I want to make function on my LM002, AND how to properly set up the textures, model, and configs.

Is there a resource or tutorial for making fully functional lighting on vehicles?

I can place memory points and proxys, but the challenging part to figure out is what parts of the model correspond to what textures, what named selections, and what rvmats - to give it those fine details. Trying to tackle this task with basic custom vehicle knowledge is insufficient.

Share this post


Link to post
Share on other sites

real lights that illuminate stuff need to be defined in the reflectors class in the config.

 

all other "lights" are just "emissive textures". There are a bunch of emissive materials in data_f.pbo\lights that you can use. You texture your vehicle with disabled light. Then you create modelpieces that cover the lights - assign the emissive materials to those pieces. To turn on/off lights you simply create hide animations. (except for lights that are relevant to the reflector classes - you dont need to define animations for these, it hides the appropriate selection automatically)

  • Like 1

Share this post


Link to post
Share on other sites

x3kj +1 pulling through again!

 

Cool, so then reflectors are the cone volume lights?

 

Is it possible to make the brake lights so that they turn the environment red, like a real car? If the glowsticks can do it, then I'm thinking yes.

What about interior dash lights? Is there anything different there? What are the named selection? If it's covered by glass, will the glass properties interfere with its shine/glow?

Share this post


Link to post
Share on other sites

 

Cool, so then reflectors are the cone volume lights?

only that what illuminates other objects. There is a "light cone" visual effect that is just an alpha close to the light.

No, brakelight with light-emission are not something you can normally do to my knowledge. Maybe with script-hacking. Reflectors class lights are best used very sparingly, as they are very calculation intensive.

 

interior dashlights - you use an alphamap-overlay with emissive properties over your normal texture. Check out vanilla cars of how it looks, it works pretty well.

 

Named selections are sets of vertices corresponding to bones in the model.cfg and other things. (open the car sample in objectbuilder - you will see the named selection window in objectbuilder).

  • Like 1

Share this post


Link to post
Share on other sites

interior dashlights - you use an alphamap-overlay with emissive properties over your normal texture. Check out vanilla cars of how it looks, it works pretty well.

 

Named selections are sets of vertices corresponding to bones in the model.cfg and other things. (open the car sample in objectbuilder - you will see the named selection window in objectbuilder).

I know what named selections are... Sorry, I should have clarified: what are the named selections used for dash lights? I have been checking out the guts of A3 cars using eliteness, but I cannot seem to match all the components to see precisely how it works. It tells what materials, textures, and named selections are used for the entire vehicle, but as far as I can see it doesn't explain the combinations used per function of the vehicle. Some sort of flow chart would be nice, but that's wishful thinking.

Share this post


Link to post
Share on other sites

Reflectors have a selection in their config class. Whenever the reflector is disabled - this named selection gets hidden automatically (wthout requiring extra animations). You can make the dashboad alpha-overlay part of this selection.

Alternatively, define your own hide-animation in model.cfg and define useractions, so the player can enable/disable it at his leasure

  • Like 1

Share this post


Link to post
Share on other sites

In your config.cpp you can use:

 

selectionBackLights = "lights_back";
selectionBrakeLights = "lights_brake"; 
 
where the parts in " " are named selections of emissive lights in your visual LOD's.
 
The first hides/shows when vehicles lights are switched off/on and the second when brakes are applied.
  • Like 1

Share this post


Link to post
Share on other sites

Thanks guys! Such great help!

 

selectionBackLights = "lights_back" ... hides/shows when vehicles lights are switched off/on...

 

 

Okay, so this may sound dumb, but I'm assuming I can use this for front, non-headlights? When I look on the SUV and Offroad, they have "daylights" that come on whenever the vehicle's rpm is activated - some in the back and some in the front. Looking at their model.cfg files, it seems confusing. This is from the SUV:

            class daylights
            {
                type="hide";
                source="rpm";
                selection="daylights";
//                sourceAddress = clamp;// (default)
                minValue = -0.8;//rad -45.836624
                maxValue = 0.2;//rad 11.459156
                hideValue = 0.2;
                unHideValue = 1.0;
                animPeriod = 0.0;
                initPhase = 0.0;
            };
            class reverse_light
            {
                type="hide";
                source="Gear";
                selection="reverse_light";
//                sourceAddress = clamp;// (default)
                minValue = -1.0;//rad -57.29578
                maxValue = 0.0;//rad 0.0
                hideValue = 0.2;
//                unHideValue = -1.0;//(default)
                animPeriod = 0.0;
                initPhase = 0.0;
            };
            class Display_off_hide
            {
                type="hide";
                source="rpm";
                selection="display_off";
//                sourceAddress = clamp;// (default)
                minValue = 0.0;//rad 0.0
                maxValue = 1.0;//rad 57.29578
                hideValue = 0.001;
//                unHideValue = -1.0;//(default)
                animPeriod = 0.0;
                initPhase = 0.0;
            };

The brake lights and daylights make sense. Here, the dash looks like it should come on when the engine starts, but that's not the actual case when I use the SUV in game. Also, the choice of names for class and named selection is convoluted and a bit misleading. So the real question: Is the dash geometry actually named "display off," or rather "light_r" / "light_l" (I think this is what x3kj was talking about)?  Also, if it IS included in the "light_l/r" named selection, then how does it stay on when either of the lights is shot out?

Share this post


Link to post
Share on other sites

i dont think the dash is named display_off_hide. That animation could just be another thing that lies on top of the display to block vision of other pieces (for example a "digital" clock that would otherwise be permanently visible).

 

You do not need to conform to those names. Just make sure that whatever name you choose matches between  p3d , model.cfg and the config and you are all good.

  • Like 1

Share this post


Link to post
Share on other sites

uk_apollo and x3kj: Thanks guys, so very much! I've almost got the lights in great working order. There're some minor tweaks needed with the artwork, then it'll be lit like aunt Rosie on Christmas Eve (couldn't resist - just sounded funny).

Share this post


Link to post
Share on other sites

I've got another little hiccup with lighting, but it's probably a really minor oversight on my part. Although my dash lights are now coming on beautifully, I cannot see the dash readings at all when the lights are off. Is this a setting with the light brightness in config, or should I have another, less brilliantly lit dash piece laying under the lit one (so that it'll be visible when the light go off)? I'm trying to imitate analog instruments with circumferential ambient lighting when lit, which means they need to be just visible labels without lighting in the daytime - pre-1990s tech.

EDIT:

Solved, although I'm not sure if this was the correct way: I copied a new instance of the lit dash panel objects. Where the original uses an rvmat with "Emmisive" properties, I applied an rvmat with a way more subtle emission setting, and subtle ambiance to boot. Finally, I disassociated it from the lights' named selection, so that it's visible all the time, and then moved the lit objects slightly in front of them, such that they'll be seen when they "unhide." The result is the intended, subdued, high-res labeling using the same .paa which is also visible in the daytime, when lights aren't allowed to come on, AND there is a visible difference between them, as if they are really lighted dash panels. However, this seems like a convoluted way of doing something that might have otherwise been accomplished more efficiently.

glossary for this post:
lit - having the appearance of self-illumination turned on.
lighted - given the ability to self-illuminate, whether on or off.
emmisive - an incorrect spelling of the word emissive, as it's recognized by RV engine's materials scripts. The material properties that give textures a lit appearance, in the rvmat file.

I am considering posting screenshots of this vehicle (with a theme focused on its lighting), if anyone is interested. I may even consolidate everything I've learned and create a vehicle lighting tutorial, but I feel like I'm the last one who needed help in this area.

Share this post


Link to post
Share on other sites

New lights testing reveals another flaw in my development of this vehicle. Previously, I had been testing the lighting at dusk, right when the game engine allows for lights to come on. The lit dash was bright, and the non-lit dash was not. In fact, I was considering darkening the _ca file a tad in order to get a less bright dash... Then I tested the lighting in the thick of night, when everything is nearly pitch-black, and the lit dash was barely visible under these conditions. IE: The lit dash at midnight should still appear as bright, or even brighter, as it does at dusk - which it doesn't. Any ideas how to correct this?

Share this post


Link to post
Share on other sites

Try this rvmat on the dashboard components you want to light:

   \a3\data_f\lights\car_panels.rvmat

 

This is what it contains:

class StageTI {
	texture = "a3\data_f\default_vehicle_ti_ca.paa";
};
ambient[] = {5,5,5,1};
diffuse[] = {0,0,0,1};
forcedDiffuse[] = {0,0,0,0};
emmisive[] = {160,155,155,1};
specular[] = {0,0,0,1};
specularPower = 1;
PixelShaderID = "Normal";
VertexShaderID = "Basic";

Green, orange and red panel lighting is also available in the same folder.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, uka! That did the trick, and I must have fiddled with those values before realizing I had to hide-unhide a non-lit model piece... I hope there isn't anything else that comes up.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×