⚠️ [regression] Environment Samples Limited to 2048

Why is the “Environment Samples” field hard clamped to 2048?

In the other sample fields, they are soft limited initially when using the slider, but you can hand type a bigger value if you want. The exception is the Environment Samples field where even if you type large values, it gets clamped down to 2048.

I assume this must be a bug, because this wasn’t the case in previous Unity versions, and 2048 is definitely too low, I often need to go above it.

I am using Unity 6000.0.34f1 on a Mac, using the progressive GPU lightmapper.

1 Like

Even if I set it via script ( Unity - Scripting API: LightingSettings.environmentSampleCount ) it still is clamped to 2048.

By the way, that docs page mentions “The range is 8 through 1,000,000,000.”

(although that docs page is a mess, it seems it has been copy pasted from the Indirect Samples doc page and stuff has from indirect been left in)

It seems it’s related to m_PVREnvironmentReferencePointCount. If I edit that directly in the .lighting file to something higher, I can then enter higher values than 2048 in the environment samples field. ← That’s my current workaround, I would welcome a less hacky one.

Bug report: CASE IN-93378

Here are two images with environment samples at 2048 and 16384, all other settings are the same.

You will notice that 16384 is much cleaner (and in fact it would still benefit from going much higher, probably around 100k for a “final” bake), which hopefully showcases that being able to use values larger than 2048 is necessary.


I found this in the release notes of some 2022 version:

  • GI: Maximum environment sample is 2048, as no quality improvements could be seen beyond that threshold.

So it seems the clamping is intentional.

But as I’ve demonstrated, this is obviously wrong, there are plenty of improvements to be had above 2048, please reconsider.

1 Like

Are there any unintended consequences if I mass edit all .lighting files and change m_PVREnvironmentReferencePointCount to something really high, so I can then set environment samples freely?

Is its purpose only to limit environment samples, or does it have some other function?

Unfortunately mass editing the m_PVREnvironmentReferencePointCount value is not as great a workaround as I thought.

While it does temporarily let me enter bigger values for environment samples and bake using that value in the same session, the bigger values are not saved in the .lighting file so in a new Unity session I will need to re-enter the value.

I’ll investigate how viable it is to have my own script that holds all the light baking values and then I exclusively use that? At the very least it would save me some headaches, since for example the 2048 changed wiped all the environment sample values I used to have and now I need to go look them up and restore them.

I implemented this. I have a workaround now, but this really was too much work just to circumvent an arbitrary limitation Unity added for no reason.