Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Solatar on April 28, 2016, 08:09:01 pm

Title: Question about the loadout screen
Post by: Solatar on April 28, 2016, 08:09:01 pm
Maybe this belongs in MODing?  :nervous:

So, I've been poking around the interface a bit recently, trying to satisfy my obsession over making my install of FSPort look as much like a modern version of FS1 as possible. My question is, when you have environmental maps turned on, the game uses an actual mission background to determine the environmental map applied in the tech room and loadout screens. I thought it was just a generic color, but you can actually see nebula details and a yellow sun in most models. I thought it would use something obvious like the last loaded mission, or the current in the campaign, or something, but I haven't been able to find it.  Is this background file loaded in a mission somewhere, or is it hard coded?



[attachment DELETED!! by Strong Bad]
Title: Re: Question about the loadout screen
Post by: niffiwan on April 28, 2016, 09:37:09 pm
From that picture you're talking about just the weapon selection screen?

For the ship selection screen at least, with the FS1 ship selection effect, I think this code controls the lighting:

Code: (https://github.com/scp-fs2open/fs2open.github.com/blob/master/code/missionui/missionscreencommon.cpp#L1891) [Select]
// lighting for techroom
light_reset();
  vec3d light_dir = vmd_zero_vector;
light_dir.xyz.y = 1.0f;
light_add_directional(&light_dir, 0.65f, 1.0f, 1.0f, 1.0f);
light_rotate_all();
// lighting for techroom

So, I don't 100% understand all that, but it doesn't seem to have any nebula effects?
Title: Re: Question about the loadout screen
Post by: DahBlount on April 28, 2016, 09:59:45 pm
It looks like a nebula due to the way reflection happens, but in reality, it's a uniform bluish green color.
This one to be exact.
(http://puu.sh/ozAYG/ba696a310e.png)

You can determine the color by multiplying the 4 float values after the &light_dir in light_add_directional() by 255 (the maximum RGB color channel value) where the values in order are Red, Green, Blue, and Alpha. The reason it appears darker than the color in the RGB picker is because it gets mixed in a specific manner with the diffuse and spec color of the ships textures in the shaders.
Title: Re: Question about the loadout screen
Post by: Solatar on April 29, 2016, 07:16:02 pm
The tech room version definitely has identifiable nebula and sun features (it looks almost like a skybox) if you drag the ships around so you can control what part of the reflection you can see, so I thought the weapon select screen was the same. In the techroom, especially with the Centaur's big window, you can clearly see green nebula, and a yellow sun.

I went and changed the color in missionscreencommon.cpp (that line shows up in two places, one for each screen), and it seems to have odd effects. If I change it to all red (for an easy to identify contrast, to see if it's working), the light coming from the direction specified in that code turns blue ( :confused:), and the green "nebula" stays on the sides.  The bottom attachment is what it looks like in the ship selection screen if I change the values to the equivalent of 255, 51, 51, 255. It looks the same in the weapon select screen, but since the "light" comes from .000001 off the X axis, it only recolors the nose of the ship (it colors the rendered weapon model, though). It's almost like whatever effect that's shown in the techroom is being applied, and then additional directional lighting is being applied on top of that in the loading screens.

I'm messing around with the PBR branch, btw, but I don't know if that matters?

My "coding" knowledge pretty much tops out at helping 7th graders to make games in Scratch (I'm not even the computer science teacher), so this is at least kinda fun figuring it out. Thanks for your replies :p

EDIT: Figured out the color discrepancy. The first value is the intensity, THEN RGB. According to this (http://scp.indiegames.us/fsodoc/lighting_8h.html) documentation, I can mess with specular coloring too, so I'll try that next.

[attachment DELETED!! by Strong Bad]
Title: Re: Question about the loadout screen
Post by: niffiwan on April 29, 2016, 10:53:36 pm
I'm messing around with the PBR branch, btw, but I don't know if that matters?

It might, I only looked at the current master branch so it's possible there's something in the PBR branch that has added a nebula effect to the tech room.