Lighting File Explained

User avatar
aeffertz
Posts: 2702
Joined: Sat Sep 06, 2014 7:01 am
Team: Malt Liquor Boiz
Location: Wiscansin

Lighting File Explained

Postby aeffertz » Tue Jan 30, 2018 2:53 am

Figured it'd be a cool idea to make a quick run down on the lighting file from things I've learned from playing with it and reading all over this site and compile all the info into one place. So we'll break it down part by part.

sun_vector [X Y Z] - The location of the sun. Probably the most important part of the lighting for a well lit track.

The x-axis indicates the sun's distance east (positive) or west (negative) of the center of the map.
The y-axis indicates how high or low the sun is.
The z-axis indicates the sun's distance south (positive) or north (negative) of the center of the map.

Image

So if we wanted the sun to be in the top left corner (or northwest corner) we could make the values [-1 Y -1], which moves the sun one unit to the west and one unit north from the center and is now aiming towards the center of the map. Basically, look at the layout of your track to best determine which direction you want the shadows to be casted

One important thing to keep in mind, any track sections that run parallel with the direction of the sun will be casting shadows on the front or back of a bump. Where this comes into play is erode and ruts in a section. You can shade the front or backside of a jump face with decal work since those won't be changing but you can't shade the ruts that form through out a race. So it is best to have the sun shining in a direction that is not parallel to any lane on the track (or as best as possible) for even lighting through out the entire track.

The sun will cast no shadows if centered. Here is [0 1 0] Terrible, no bumps are shaded.
Image

Now let's just move it straight east. Here is [1 1 0] Now you are able to see some ruts but others are still practically invisible.
Image

So let's find a good place. Something diagonal should work just fine with this track layout. Keep in mind, the further away the sun, the darker the track will get but you will get deeper shadows. So find a happy balance that goes along with the style of track. We can also adjust brightness a few other ways. For this track, I've decided on [.75 .75 -1] works best overall for rut shading and overall track brightness.
Image

sun_color [R G B] - Color/intensity of the sun.

Equivalent to RGB values in photoshop divided by 255. [1 1 1] would equal white, so something like [0.8 0.8 1.0] would have a blueish tint. Choosing a higher number will equate to more intense lighting and often it will wash out colors on trackside objects or the bike rider but you can go with something like [2 2 2] for an extreme bright lighting. If you moved the sun far away from your track for shadows and want to brighten it up without losing detail in the decals, make the sun color bright but keep an eye on objects.

ambient [R G B] - Dirt decal ambient lighting.

Same rules apply as the sun color, only this value only effects the terrain decals.This is another way to brighten decals, however raising this value will wash out details in the decal file as you brighten it up. It will also wash out lighten the shading. So play with these numbers if you have too dark of shading or decals on the track but like the rest of the lighting over all since this will only affect the ground.

global_ambient [R G B] - trackside objects/bike/rider/etc lighting.

Same color rules again, only this just affects objects. If your rider looks like he's way too bright compared to the rest of the track or washed out, lower these values. Or if he appears too shaded, raise these values.

near_plane 0.25
far_plane 5000


In 3D rendering there are two planes that control the nearest and farthest distances things can be rendered at.The closer together they are the more precise your Z buffer is.

Image

Anything outside of the two planes won't be rendered. This setting is usually just set it and forget it for most tracks, but if you are having weird rendering issues on track objects, maybe try adjusting your far plane.

jlv
Site Admin
Posts: 12687
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Lighting File Explained

Postby jlv » Tue Jan 30, 2018 2:59 am

Nice write up! One correction - the sun vector is just a direction. The game will act as if it's infinitely distant. The length of the vector doesn't matter.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

User avatar
Jakob Hubbard
Posts: 363
Joined: Fri Nov 24, 2017 3:16 am
Team: BPC
Location: Cold

Re: Lighting File Explained

Postby Jakob Hubbard » Tue Jan 30, 2018 3:59 am

Thanks Alex. This will be very useful.
Image

User avatar
Wahlamt
Posts: 6397
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Lighting File Explained

Postby Wahlamt » Tue Jan 30, 2018 5:27 am

Amazing! Finally able to understand this stupid thing... Is the top left -1 Y -1 and the bottom right 1 Y 1 ?

User avatar
aeffertz
Posts: 2702
Joined: Sat Sep 06, 2014 7:01 am
Team: Malt Liquor Boiz
Location: Wiscansin

Re: Lighting File Explained

Postby aeffertz » Tue Jan 30, 2018 5:35 am

Wahlamt wrote:Amazing! Finally able to understand this stupid thing... Is the top left -1 Y -1 and the bottom right 1 Y 1 ?


Yep. You could do [2 Y 2] [.5 Y 1.5] etc.

User avatar
Wahlamt
Posts: 6397
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Lighting File Explained

Postby Wahlamt » Tue Jan 30, 2018 5:47 am

aeffertz wrote:
Wahlamt wrote:Amazing! Finally able to understand this stupid thing... Is the top left -1 Y -1 and the bottom right 1 Y 1 ?


Yep. You could do [2 Y 2] [.5 Y 1.5] etc.

An then it would be somewhere "outside the map", right?

User avatar
aeffertz
Posts: 2702
Joined: Sat Sep 06, 2014 7:01 am
Team: Malt Liquor Boiz
Location: Wiscansin

Re: Lighting File Explained

Postby aeffertz » Tue Jan 30, 2018 5:57 am

Well like JLV mentioned, it's more so just the direction in which the lighting shines. The farther away you go, the dimmer it gets though.

User avatar
yzmxer608
Posts: 15169
Joined: Mon Dec 29, 2008 4:30 am
Team: Race Tech/SD
Location: Wisconsin, U.S.A

Re: Lighting File Explained

Postby yzmxer608 » Tue Jan 30, 2018 3:12 pm

Thanks! I struggled for along time with the vectors, a visualization like this helps a lot. I also have a small program that will create the lighting file for you based on what you enter with color pickers etc. that Wheels made. I can't seem to find his original post on it but can upload it if anyone wants.
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.

User avatar
M@xTizZz
Posts: 2546
Joined: Wed Jan 25, 2012 4:20 pm
Team: TizZy-Design
Location: France

Re: Lighting File Explained

Postby M@xTizZz » Wed Jan 31, 2018 1:04 am

thanks a lot Alex, you wrote it fast :)
Maxime Tison #51 [EU] | #951 [NA]
|MXSEMF Official admin Image| |Tizzy Design Owner Image|
Skype ID : max_tizzz

User avatar
ColtonD719
Posts: 192
Joined: Tue Jun 21, 2016 4:15 am
Team: Privateer
Location: California
Contact:

Re: Lighting File Explained

Postby ColtonD719 » Fri Feb 02, 2018 9:22 am

Thanks for putting this together! I never quite understood the sun vectors, and always just used this calculator: viewtopic.php?f=11&t=25668

But this definitely helps me wrap my brain around what is going on better.
Colton, Track Creator

Released MXS Tracks

User avatar
yzmxer608
Posts: 15169
Joined: Mon Dec 29, 2008 4:30 am
Team: Race Tech/SD
Location: Wisconsin, U.S.A

Re: Lighting File Explained

Postby yzmxer608 » Sat Feb 03, 2018 3:57 am

Found Wheels' program:

viewtopic.php?p=399504#p399504
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 1 guest