Skip to content

Conversation

@hayden9329
Copy link

Fixed #2566

The previous workaround set an infinite radius to Float.MAX_VALUE, which can still cause overflow in shader math.

This Pull request updates the following:

  • Clamps infinite, negative, and NaN radius values to Float.MAX_VALUE / 4f
  • Adds a clear comment explaining the fix
  • Keeps "infinite" lights effectively infinite without shader bugs

I tested this locally, no overflow issues.
First-time contributor for a class project.

Clamps infinite, negative, or Not a Number radius to Float.MAX_VALUE / 4f
to prevent type overflow in shaders, as discussed in jMonkeyEngine#2566.
@yaRnMcDonuts
Copy link
Member

yaRnMcDonuts commented Jan 21, 2026

Screenshot tests are expected to fail with this change, as well as with a few other PRs scheduled for v.3.10 that will be changing the visual render of jME's PointLight and SpotLight to better match the lighting algorithm in blender and industry standards.

Currently (as of 3.9.0-stable and earlier), jme's point and spot lights are actually slightly bugged and will cast light far beyond the expected radius of the light (see #2549 for more info) and the issue becomes more severe as more lights overlap.

So a major feature/bug fix of 3.10 is going to be reconciling and fixing our lighting.

Considering this, it is very likely that we will continue to make slight adjustments to the lighting algorithm throughout the early alpha phase of 3.10, so we will wait to fix the screenshot tests to use the new correct images until we have finalized the lighting during 3.10's alpha phase.

Edit: screenshot tests actually passed now, so I guess it was another random failed job-run with the server instance doing the tests/builds. I was just assuming some test had a point light with near infinite radius, but I guess not. Either way, the other PR I linked will indeed break the screenshot tests (for real) so everything I said prior still will apply to those bigger lighting changes.

@yaRnMcDonuts yaRnMcDonuts added this to the v3.10.0 milestone Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infinite radius point lights might cause type overflow

4 participants