Celestia icon indicating copy to clipboard operation
Celestia copied to clipboard

[1.7.0] LunarLambert sometimes makes objects too bright

Open SevenSpheres opened this issue 2 years ago • 5 comments

Describe the bug While updating content, I noticed that some objects (specifically, Jupiter and Europa) had become excessively bright. Removing LunarLambert 0.5 from the .ssc file seems to fix this. I don't know why it affects only some objects and not others.

To Reproduce Steps to reproduce the behavior:

  1. Add LunarLambert 0.5 to the code for Jupiter/Europa, or just take the files from this branch
  2. Go to Jupiter/Europa in Celestia
  3. See error

Expected behavior Jupiter and Europa appear with normal brightness, like they would in 1.6.x with the same code.

Screenshots juptoobright

Desktop (please complete the following information):

Additional context Possibly related to #1114?

SevenSpheres avatar Oct 13 '21 21:10 SevenSpheres

Tested with this build and the bug is still present, so it's not caused by #1114.

SevenSpheres avatar Oct 13 '21 21:10 SevenSpheres

It seems like this bug depends on the brightness of the texture. Like, if the texture is already bright and LunarLambert is used, Celestia will make it even brighter! But if the texture is less bright, LunarLambert has no side effects. 🤔

pedro_jg suggests that:

Going to the issue of overbright textures, looks like some of [FarGetaNik's] ones were specifically corrected for that, so that using them in 1.6.x made the planets look too dark

Hmm...and I have this screenshot from last year of Celestia Origin's Eris showing the same bug.

SevenSpheres avatar Oct 23 '21 01:10 SevenSpheres

For comparison, here's what I see when using Saturn with LunarLambert 0.5 as rendered by Celestia 2013 (7033ec32 + minimal changes to get it to compile with Qt5), Celestia 1.7.0 (ec232b7f) and Celestia 1.6.2 (eb4e1a64 + minimal changes to get it to compile with Qt5). Ambient light is set to zero.

out

It looks like Celestia 1.7 is consistent with Celestia 2013, but something was changed that made the rendering in 1.6.2 darker.

ajtribick avatar Oct 30 '21 12:10 ajtribick

Enceladus comparison. Using the darker old texture, it is brighter in 1.7 - I don't know if this is the correct behavior or not. Using the brighter texture from Project Echoes, the 1.7 render isn't just brighter, it's shiny as if it had specular enabled. The latter is really the issue I'm referring to. enceladus

SevenSpheres avatar Oct 30 '21 15:10 SevenSpheres

The LunarLambert model changed during the move of the CMOD code into the celmodel module. The four relevant commits are 31a31d4e2fadc0f611b75fd67dd685e3f1ace5e6, ef146f24aa7817e66fd801813a31a36bb1474dd3, c76d2b0fb7ef496d4c371df294163c47099ca585, b92930b79daf06798da01cdfe3290688126cbd64 (only the last of these was buildable, as this one brings the .pro file and the source files into a consistent state)

The relevant change appears to be this change to shadermodule.cpp - relevant comment "Include a phase-based normalization factor to prevent planets from appearing too dim when rendered with non-Lambertian photometric functions."

This block of code does not appear in the branch leading to 1.6.2, and removing this block from current master restores the 1.6-style rendering. I'm not sure what the best way to fix this is, given that this fix has not been backmerged to a released version for ~11 years. A "correct" approach would presumably be to actually do gamma properly (#834) and stop using LunarLambert to approximate gamma correction, whether that can be done in a way that doesn't introduce a break between 1.7-compatible and 1.6-compatible add-ons is another matter.

ajtribick avatar Oct 30 '21 20:10 ajtribick