Skip to content

Fix PSDL Ground Shading #54

@Deebz96

Description

@Deebz96

The ground shading we implemented awhile back has a bit of an oversight.

As we know, pitch/heading have a minimum/maximum value of -3.14, and 3.14, with the center being at 0. For pitch, 0 is from directly west, -1.57 is from directly up, and -3.14 is directly from east. Likewise, 1.57 is from directly down, and 3.14 is once again from directly east. This image should help explain how it works.

If light sources have pitch/heading values that stay within the bounds of -3.14 and 3.14, everything works fine. However, if a light source has a pitch/heading value that goes below -3.14 or above 3.14, that light source will glitch out with our system.

MM2's own lighting system works fine with this though. Values that go beyond pi simply loop around. So for example, a value of -6.28 (pi 2x) will loop back around and act the same as a value of 0 (light from the west). A value of 4.17 (pi x1.5) will loop halfway back around, and will act like a value of -1.57 (light from directly above).

I don't remember the exact equation I came up with back when this patch was first made, but I do remember that it wouldn't work with out-of-bounds values. So in order to properly fix this, we'd probably need an entirely new way of calculating light color for the ground.

I suck at math; it's something of a minor miracle that I managed to come up with the original equation. I don't know of a way to do this properly, and I'm assuming you guys are in the same boat. So here are two alternative solutions:

  1. Detect if a lighting file has any pitch and/or heading values that are less than -3.14, or greater than 3.14. If they do, disable our ground shading enhancement and fall back on default behavior. This will allow the ground to be fullbright, rather than glitched. I feel like this should be possible, since Mark just did a similar thing for the digital speedo last night.

  2. Make this lighting enhancement an INI toggle, with a comment of something like "Set this to 0 if you are using any mods that cause issues with this feature". Not exactly ideal, but it beats being forced to either remove MM2Hook or fix the lighting file if you can't live with the glitched shading.

Metadata

Metadata

Labels

bughelp wantedlow priorityProcrastinate on addressing this for as long as possible.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions