Hard Light Productions Forums

General FreeSpace => FreeSpace Discussion => Topic started by: EatThePath on May 08, 2022, 01:31:31 pm

Title: The future of lighting flags in FSO
Post by: EatThePath on May 08, 2022, 01:31:31 pm
Since becoming more involved in the graphics side of FSO I have been increasingly dissatisfied with -spec_point, -spec_tube, -spec_static and -ambient_factor, for a number of reasons. I want to remove them from the engine, but I also know that they serve an important role since the engine does not provide brightness options. I've discussed my plan of action on discord with a number of people over the past year or two, but I didn't want to change such a deeply ingrained part of FSO without bringing it here too.  I'll go over my reasons first, then my plan of action.

The -spec lighting flags were added almost 20 years ago, along with shine maps. In my experience they are used almost entirely as brightness controls by the community, either by user options or for mod visual design. The thing is, they're really bad at that. They don't control brightness overall but rather the brightness of specular reflections, the sharp highlights on shiny parts of a ship. This has a number of negative consequences.

(https://i.imgur.com/KpIp1QS.png)

Here's a comparison of -spec_static 2.0, 1.0, and 0.0 on two ships from the same angle under the same lighting conditions. It shows a number of the issues.


I'm sure when these flags were added and specular was a relatively new feature people were tuning, this made sense. Now though, PBR textures have specularity as an integral part of the artistic intent for a ship from the very start and the flags unpredictably mangle that intent more than anything else.

Ambient_factor I hopefully don't have to explain, the math behind it is confusing, for little benefit. Simple scaling is what people expect and likely what they should get.

So what am I going to do about it?

Of course none of this is set in stone, I'm confident in it but there's always the possibility that discussion or development will prompt a change of plans.

Firstly, I will disable the current set of flags, and replace them with two new ones. -lights and -ambient, both simple multipliers on the lighting. I want to do this rather than simply update the old ones so that people are aware of the changes and have the chance to adjust for them, rather than having their lighting change in potentially subtle ways and only discovering why down the line.

Second, I will add a swath of brightness controls to the lighting profiles table, again controlling the whole light rather than only the specular. This will allow much more detailed changes to lighting than would ever be practical as command line flags, and allow mods to incorporate these changes directly into their files rather than relying on launcher flags to implement their visual design. When profile switching is fully implemented this will even let mods tweak their global lighting properties from mission to mission, such as making weapon lights dimmer and smaller in nebula missions or the like.

In my mind if you want to adjust a game's lighting at that level of granularity you are dipping into what is essentially modding, just as much as editing the HUD or fonts is, and it makes the most sense to support that via tables. Still, while it is my hope that mods will take more ownership of lighting design over time and players will feel less need to adjust it I have no expectation that this will happen immediately or completely. So as lighting profiles matures as a feature I will be mindful of ensuring there is always a viable way for an end user to over-ride a mod's settings if they feel the need.

In doing all this I also intend to disable the SunSpecularRGB config option in stars.tbl. I have yet to find a mod that uses this option and it has all the same problems as the specular flags do. With it gone the FSO's shaders can be somewhat simplified under the hood, and quite possibly improved further too.

Please, let me know if you have any concerns or question. I understand that I am messing with something the community takes for granted and I want to do it in the best way I can.
Title: Re: The future of lighting flags in FSO
Post by: Phantom Hoover on May 08, 2022, 03:05:50 pm
I'm entirely in favour of this; the current situation with lighting settings is frankly an embarrassment and I'm personally sick of having to think about it at all. We've gone through 3 or 4 different overhauls of the lighting model since those parameters were introduced and more are entirely possible in the future.
Title: Re: The future of lighting flags in FSO
Post by: Grizzly on May 08, 2022, 03:15:03 pm
I had a lot of fun messing around with lighting flags ~10 years ago but now with all the newfangled PBR and deffered lighting I'm happy if there's just a "one size fits all" solution rather then a bunch of things you have to manually set depending on which built you are on.
Title: Re: The future of lighting flags in FSO
Post by: mjn.mixael on May 08, 2022, 10:02:12 pm
There also seems to have been a general culture shift in the community where once there were vocal players would would commit murder if they lost the ability to fine-tune things. Now it seems most players are happy to let mods and artists have more say in how their creations look. +1 from me.
Title: Re: The future of lighting flags in FSO
Post by: 0rph3u5 on May 09, 2022, 01:38:17 am
Quote
allow mods to incorporate these changes directly into their files rather than relying on launcher flags to implement their visual design

You had me at this.  :)
Title: Re: The future of lighting flags in FSO
Post by: Mongoose on May 09, 2022, 03:09:02 pm
I've always stuck with whatever the default lighting settings were, no matter how good or bad they wound up looking, because having to fiddle with multiple esoteric flags seemed like far more trouble than it was worth. Having something that actually makes logical sense would be a massive improvement. :yes:
Title: Re: The future of lighting flags in FSO
Post by: Iain Baker on May 09, 2022, 05:30:43 pm
Sounds good to me 👍
Title: Re: The future of lighting flags in FSO
Post by: perihelion on May 09, 2022, 07:06:13 pm
I agree also.  I used to occasionally mess with different lighting settings back in the days of the pre-Knossos launcher, because a lot of people had included their own settings so I could try them out with ease.  But since Knossos didn't include those easy lighting presets, I just stopped bothering and used whatever defaults the mod came loaded with.  I wanted to spend what little free-time I have playing mods, not starting and exiting FSO over and over again to see what THIS setting tweaked...
Title: Re: The future of lighting flags in FSO
Post by: Iain Baker on May 10, 2022, 11:17:47 am
I find I always use the same dark and moody lighting presets for any campaign that isn't a meme campaign. So long as I will still be able to do something similar I will be happy  :)

My go-to settings are below if anyone is interested, although I'm open to suggestions about how to improve it. I'm aiming for dark and moody, with lots of dynamic lighting and colour from stars and weapons.

-ambient_factor 70 -spec_point 0.4 -spec_static 2 -spec_tube 0.8 -spec_exp 0.8 -bloom_intensity 15 -no_emissive_light -shadow_quality 1 
Title: Re: The future of lighting flags in FSO
Post by: Lykurgos88 on May 10, 2022, 12:51:48 pm
If I recall correctly, most of the lighting settings (especially ambient factor) were rendered near useless after the version 3.8.0 which introduced forced HDR. The modularity was also gone as it was no longer possible to turn off all the extra graphic options and play with retail level graphics if one wanted.

For me the version 3.7.4 is still the best looking FSO version when it comes to achieving moody and dark lighting. It had dynamic shadows and deferred rendering but no HDR nonsense. The specular effects were also so much better. The fact that different specular parameters no longer have much effect on the game is very telling.

Sure, the MVP assets are miles better now then they used to be, but the lighting is soooo important to the overall mood of the game. I actually took years of break from FSO after the release of 3.8.0 in 2016. I was so disappointed in the lighting and the fact that SDL2 broke all kinds of ****, like some of the most memorable Force Feedback effects in my joystick. Direct Input worked way better.

-----------------------

A bit ranty post, but still I applaud any efforts in fixing the current lighting system and its parameters  :yes:
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on May 10, 2022, 11:30:27 pm
As a little history, I dabbled in FSO a little around 3.6.12, and only came back to it and got really invested late in 3.8's lifetime. The modern HDR+PBR setup is what I know, so I'm not too well equipped to recapture old magic I don't know.

BUT, the features added for 22.0 in https://wiki.hard-light.net/index.php?title=Lighting_Profiles.tbl may help you achieve what you want. I think a lot of people's dissatisfaction with the HDR comes not from HDR intrinsically, but some of the choices made in implementing it. A few of the most important of those those choices are now configurable, and you can play with them in the lab accessible by pressing F3 from a mainhall. I still need to finish the illustrated guide to them, but the lab is really the better way probably.

-ambient_factor 70 -spec_point 0.4 -spec_static 2 -spec_tube 0.8 -spec_exp 0.8 -bloom_intensity 15 -no_emissive_light -shadow_quality 1 
FYI, unless the wiki is lying to me spec_exp and no_emissive_light do nothing currently. Emissive light is off by default.
Title: Re: The future of lighting flags in FSO
Post by: Admiral Nelson on May 11, 2022, 04:20:00 pm
I certainly applaud this effort.  I must say I've always found the current set of lighting flags and such about as comprehensible as Linear A. It would be very useful to have something as critical to the gameplay experience configurable in a straightforward manner, hopefully with some suggest quality "defaults".
Title: Re: The future of lighting flags in FSO
Post by: Durandal on May 16, 2022, 07:33:52 am
This isn't just a "sounds good" but a resounding "PLEASE, IMPLEMENT IT!" from me. Would solve a lot of concerns I have as a developer.
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on May 26, 2022, 08:31:30 pm
Time to show off what the new flags look like. There may be a few tweaks yet, but this should be fairly indicative of how things can will work

-light sets a mutliplier, defaulting to 1, for all lighting.
-ambient sets a similar multiplier that applies to only ambient light.
-emissive sets a minimum level of brightness for lighting no matter the conditions or what other settings are set to. the old -emissive_light flag remains, now setting this value to something approximating the look with the emissive flag on.

The first three sliders in the lab replicate the effect of adjusting these.


Using both a modern pbr ship and the decidedly non-PBR Erebus. If you compare to my original screenshot set, you can see it gives you a lot more power in both cases.

This is without qaz's new shaders, which are still in development but are very promising. It's possible my changes will be in 22.2 and his in 22.4, but it's also possible both will be in 22.4. We're coming down to the wire a bit on that deadline.

A final note: These controls along with many others are also going in the lighting profiles table. Currently in review is the ability to set modifiers for each type of light or each type of weapon, affecting both size and brightness of the lights, covering all the bases of the old flags and more. These settings are set up to stack with the command line flags; if a user plays with -light 2.0 they'll see every mod as twice as bright as originally designed, and so forth.
Title: Re: The future of lighting flags in FSO
Post by: Dilmah G on May 26, 2022, 10:36:09 pm
Love everything about this. Damn, the Erebus looks hilarious with high emissive settings though!
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on June 11, 2022, 10:35:29 pm
Just as an update, we didn't get everything needed together for 22.2 so your -spec_... and -ambient_factor will still work in the upcoming verrsion. However, a lot of the mod-side replacements for the flags did make it in, and can be found in Lighting_Profiles.tbl (https://wiki.hard-light.net/index.php?title=Lighting_Profiles.tbl). These already affect the whole light rather than the specular, and if you're updating a mod for 22.2 which uses default command line lighting settings I would recommend at least looking into changing over from them to this.
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on September 14, 2022, 06:04:27 pm
Another heads up! these features have started getting merged into development builds. Tonight's nightly should contain the command line flag changes and associated lighting profiles values. Qaz and I have a lot of graphics code working through review right now. If you're playing nightlies you may see things change a bit as each goes in, but the final stages once merged should bring the typical freespace lighting and ship pretty close to how they look now, but better in some key subtle ways.
Title: Re: The future of lighting flags in FSO
Post by: Dilmah G on September 14, 2022, 10:19:29 pm
Delicious.
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on September 16, 2022, 12:48:09 pm
Well that happened quicker than I expected! All of our lighting and shader changes are in as of the current build. Enjoy the shiny things, let us know if anything breaks, and probably stop using invisible suns to fake planet-shine
Title: Re: The future of lighting flags in FSO
Post by: Trivial Psychic on September 20, 2022, 03:03:58 pm
Soooo, how does the new lighting system work?  I've been using command-line flags all of this time.  I can compensate by changing things in the lab, but as soon as I quit the game, any of those changes are lost.
Title: Re: The future of lighting flags in FSO
Post by: Asteroth on September 20, 2022, 11:01:04 pm
https://wiki.hard-light.net/index.php/Lighting_Profiles.tbl has a full description. By making such a table and putting it in your root data/tables directory it will overwrite/modify any downstream mod.
Title: Re: The future of lighting flags in FSO
Post by: jadeddragoon on September 21, 2022, 11:54:57 am
There are still command line options (https://wiki.hard-light.net/index.php/Command-Line_Reference#Lighting) for lighting. It's mainly the specular lighting command line flags that have been depreciated. There are also several new command line flags. I believe the idea is for mod creators to lean toward using the tables, though any one can as Asteroth points out.
Title: Re: The future of lighting flags in FSO
Post by: Trivial Psychic on September 22, 2022, 04:04:47 pm
I've been testing out the Command Line flags (thanks for that Dragon, BTW), though I'm still having difficulty getting things to match up with how I had it before.  It'll take more trial end error to get it how I want it.
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on September 23, 2022, 01:01:46 pm
Can you post a screenshot or old flags? I'd not mind trying to help, and if there's a gap I'll see if I can help fill it.
Title: Re: The future of lighting flags in FSO
Post by: Trivial Psychic on September 24, 2022, 12:29:33 am
This is what I used:

-ambient_factor 75 -spec_point 1.5 -spec_static 2.0 -spec_tube 2.0 -shadow_quality 3

I'm currently using this:

-ambient 0.1 -light 0.1 -emissive 0.15 -shadow_quality 3

The lighting in the cockpit (flying TBP you get cockpit view by default on most fighters) is different.  There are a hell of a lot more shadows and shifting light sources.  I also get some ripply rainbow pattern on some of the cockpit as well.
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on September 24, 2022, 12:11:57 pm
Alright, well, I'm not sure about the rainbow ripples, if you let me know what fighter and level it was on I'd like to take a look and see it myself. But also there was a bug with the changes that was fixed yesterday that could cause all sorts of unpredictable artifacts, s o if you could check with the most recent nightly first I'd appreciate it.

As to the actual flags... -ambient_factor 75 is on a typical level going to be around -ambient 0.125 so you're good there. -light 0.1 is going to make all your scenes 10% as brightly light as they should be, though, while your old settings were making everything brighter. In most cases the new factors are going to have more impact than the old, so I'd suggest trying -light 1.2. With the scene so dimly lit the envmap lighting is going to be much more dominant, which might be the rainbowy look you're seeing in the right cases. If you really hate the look of the enviromental reflections then -noenv is an option. This might be desirable if you're trying to closely recapture the look of B5, but only due to b5's rendering limits at the time...

Finally, if you're getting rid of ambient it doesn't make much sense to use -emissive at all. It just adds white light to all scenes, and is probably the only reason you're getting much light at all with the -light 0.1 you're using.

Let me know if that helps any.
Title: Re: The future of lighting flags in FSO
Post by: Galemp on September 24, 2022, 01:42:32 pm
I'm also not sure what the effective difference is between ambient and emissive. Would ambient light be increased in the nebula, perhaps?
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on September 24, 2022, 03:33:45 pm
The main difference is that the ambient setting depends on the ambient light in every level. -Ambient 0.5 is always half of what the ambient would be without it, -ambient 2 is double. -Emissive on the other hand always adds white ambient to everything, untouched by the other modifiers. If you want a bit of ambient in every level even if a mission designer zeroed it out, emissive can do that for you.
Title: Re: The future of lighting flags in FSO
Post by: EatThePath on September 26, 2022, 10:08:07 pm
https://wiki.hard-light.net/index.php/Lighting_Profiles.tbl has a full description. By making such a table and putting it in your root data/tables directory it will overwrite/modify any downstream mod.

If anyone ends up feeling they really,really need that fine grained control of making different lights brighter, dimming all the suns and boosting the dynamic lights or whatnot, an important piece of the planned feature set is going in tonight.

What Asteroth suggests to do is common wisdom, I've seen it suggested for various things over time by many people since I joined the community, but it is not actually correct. Sticking things in that location is fine for adding to mods or overiding the base game, but both reading the code and trying some clear test cases has shown me that if you have the same file, or the same value, in both a mod's data/tables and fs2/data/tables, the mod wins. So that's no good for user customization if mods start adopting tables.

The feature added tonight is a new flag, -override_data. When present this activates a new step in the load order that will always be after the mods. With this flag active, anything in fs2/_override/data/ will be loaded after the base game and all mods, so people can put tweak tables in there, and share those tables, if they feel that need. This opens up a lot more fine grained tuning over things like light sizes, or lights from different types of weapons, that the specular flags did not provide at all.

I hope to eventually add some more features to lighting profiles intended to be used with this, so you can adjust relative to the mod's choices rather than just hard set your own values, but for now you have this at least. Mods can set their lighting identity more concretely, without the need for launcher flags, and tweakers can still take that control back if they feel the need.
Title: Re: The future of lighting flags in FSO
Post by: Nyctaeus on September 29, 2022, 05:56:54 pm
Love that stuff so far. Ez to produce cursed results, but overally awesome. May I have a setting to control how much light is being emitted by background? So far it seems to be fixed by brightness of the skybox bitmap itself.

Edit: And glowmap/emissivemap intensity pls.
Title: Re: The future of lighting flags in FSO
Post by: Galemp on September 30, 2022, 11:16:53 am
The main difference is that the ambient setting depends on the ambient light in every level. -Ambient 0.5 is always half of what the ambient would be without it, -ambient 2 is double. -Emissive on the other hand always adds white ambient to everything, untouched by the other modifiers. If you want a bit of ambient in every level even if a mission designer zeroed it out, emissive can do that for you.

Very helpful, thank you :yes: