-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Environment map cleanup: No infinite mipmaps, wider epsilons for unit tests #12606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thank you for the pull request, @ggetz! ✅ We can confirm we have a CLA on file for you. |
Verified this fixes the problem. Added instructions to the description on how to verify in nodejs |
Thanks @angrycat9000! @jjhembd Can you verify the test fixes? |
Thanks @ggetz, the code change makes sense. Some of the tests are fixed, but several others are still failing on my machine. 1) creates environment map and spherical harmonics at surface in Philadelphia with static lighting
Scene/DynamicEnvironmentMapManager render tests
Expected (0.09512791782617569, 0.09512791782617569, 0.05843571573495865) to equal epsilon (0.11017649620771408, 0.13869766891002655, 0.17165547609329224), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:270:58 <- Build/Specs/SpecList.js:161668:58)
at <Jasmine>
Expected (0.06610184162855148, 0.06610184162855148, 0.04060539975762367) to equal epsilon (0.08705271780490875, 0.11016352474689484, 0.15077166259288788), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:278:58 <- Build/Specs/SpecList.js:161676:58)
at <Jasmine>
2) creates environment map and spherical harmonics at surface in Philadelphia with dynamic lighting
Scene/DynamicEnvironmentMapManager render tests
Expected (0.004076908342540264, 0.004076908342540264, 0.0027179396711289883) to equal epsilon (0.034476835280656815, 0.04265068098902702, 0.04163559526205063), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:621:58 <- Build/Specs/SpecList.js:161965:58)
at <Jasmine>
Expected (0.0028329347260296345, 0.0028329347260296345, 0.0018886234611272812) to equal epsilon (0.01569328084588051, 0.023243442177772522, 0.025639381259679794), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:629:58 <- Build/Specs/SpecList.js:161973:58)
at <Jasmine>
3) lighting uses atmosphereScatteringIntensity value
Scene/DynamicEnvironmentMapManager render tests
Expected (0.023781979456543922, 0.023781979456543922, 0.014269187115132809) to equal epsilon (0.0322723351418972, 0.039464931935071945, 0.047749463468790054), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:954:58 <- Build/Specs/SpecList.js:162244:58)
at <Jasmine>
Expected (0.01652546040713787, 0.01652546040713787, 0.00991527084261179) to equal epsilon (0.025989927351474762, 0.031872138381004333, 0.04223670810461044), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:962:58 <- Build/Specs/SpecList.js:162252:58)
at <Jasmine>
4) lighting uses gamma value
Scene/DynamicEnvironmentMapManager render tests
Expected (0.1821020245552063, 0.1821020245552063, 0.14133282005786896) to equal epsilon (0.18712928891181946, 0.21367456018924713, 0.23666927218437195), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1068:58 <- Build/Specs/SpecList.js:162341:58)
at <Jasmine>
Expected (0.1265377253293991, 0.1265377253293991, 0.09820842742919922) to equal epsilon (0.13568174839019775, 0.15787045657634735, 0.19085952639579773), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1076:58 <- Build/Specs/SpecList.js:162349:58)
at <Jasmine>
5) lighting uses brightness value
Scene/DynamicEnvironmentMapManager render tests
Expected (0.047563958913087845, 0.047563958913087845, 0.028538374230265617) to equal epsilon (0.05981340631842613, 0.07419705390930176, 0.09077795594930649), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1182:58 <- Build/Specs/SpecList.js:162438:58)
at <Jasmine>
Expected (0.03305092081427574, 0.03305092081427574, 0.01983054168522358) to equal epsilon (0.051604993641376495, 0.06336799263954163, 0.08409948647022247), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1190:58 <- Build/Specs/SpecList.js:162446:58)
at <Jasmine>
6) lighting uses saturation value
Scene/DynamicEnvironmentMapManager render tests
Expected (0.09240995347499847, 0.09240995347499847, 0.09240995347499847) to equal epsilon (0.13499368727207184, 0.13499368727207184, 0.13499368727207184), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1296:58 <- Build/Specs/SpecList.js:162535:58)
at <Jasmine>
Expected (0.06421317905187607, 0.06421317905187607, 0.06421317905187607) to equal epsilon (0.1081928238272667, 0.1081928238272667, 0.1081928238272667), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1304:58 <- Build/Specs/SpecList.js:162543:58)
at <Jasmine>
7) lighting uses ground color value
Scene/DynamicEnvironmentMapManager render tests
Expected (0.21471722424030304, 0, 0) to equal epsilon (0.1342056840658188, 0.11958353966474533, 0.15991388261318207), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1410:58 <- Build/Specs/SpecList.js:162632:58)
at <Jasmine>
Expected (0.14920121431350708, 0, 0) to equal epsilon (0.07575193047523499, 0.11915278434753418, 0.15629366040229797), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1418:58 <- Build/Specs/SpecList.js:162640:58)
at <Jasmine>
8) lighting uses ground albedo value
Scene/DynamicEnvironmentMapManager render tests
Expected (0.3071272671222687, 0.3071272671222687, 0.18753786385059357) to equal epsilon (0.15277373790740967, 0.1812949925661087, 0.19759616255760193), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1534:58 <- Build/Specs/SpecList.js:162738:58)
at <Jasmine>
Expected (0.21341443061828613, 0.21341443061828613, 0.13031496107578278) to equal epsilon (0.0670194923877716, 0.09013032913208008, 0.13857196271419525), 0.01.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:1542:58 <- Build/Specs/SpecList.js:162746:58)
at <Jasmine> |
Thanks for checking @jjhembd! Sorry for the back-and-forth. I've made all the rendering tests relative tests now, instead of any epsilon from an absolute value (which are probably clearer tests of the functionality anyway). Hopefully this works across both our machines 🤞 |
Hi @ggetz, this looks like another improvement. I still have 3 tests failing: 1) produces radiance values with mainly blue direct light
Scene/DynamicEnvironmentMapManager render tests with static lighting at surface
Expected 0.23497266155194546 to be greater than 0.3333333333333333.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:409:28 <- Build/Specs/SpecList.js:161785:28)
at <Jasmine>
2) produces radiance values with mainly blue direct light
Scene/DynamicEnvironmentMapManager render tests with dynamic lighting in philadelphia
Expected 0.2500000535402551 to be greater than 0.3333333333333333.
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:549:28 <- Build/Specs/SpecList.js:161888:28)
at <Jasmine>
3) produces radiance values with more light reflected from the ground
Scene/DynamicEnvironmentMapManager render tests with groundAlbedo property
Expected (0.24079939723014832, 0.24079939723014832, 0.24079939723014832) to be less than (0, 0, 0).
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:863:24 <- Build/Specs/SpecList.js:162117:24)
at <Jasmine>
Expected (-0.00046751584159210324, -0.00046751584159210324, -0.00046751584159210324) to be greater than (0, 0, 0).
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:864:23 <- Build/Specs/SpecList.js:162118:23)
at <Jasmine>
Expected (0.000542024034075439, 0.000542024034075439, 0.000542024034075439) to be less than (0, 0, 0).
at <Jasmine>
at UserContext.<anonymous> (packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js:865:23 <- Build/Specs/SpecList.js:162119:23)
at <Jasmine>
TOTAL: 3 FAILED, 44 SUCCESS I played with the second one, 2) produces radiance values with mainly blue direct light
Scene/DynamicEnvironmentMapManager render tests with dynamic lighting in philadelphia The spec includes 5 renders: scene.renderForSpecs(time);
scene.renderForSpecs(time);
scene.renderForSpecs(time);
scene.renderForSpecs(time);
scene.renderForSpecs(time); I tried different numbers of renders, to see if something wasn't converged yet. But the result is unexpected: any number of renders between 1-4 gives the same value: |
Ran into this same bug with the test in ion. Found that we had some tests that were creating a |
Description
This PR should fixes an error that arises with
DynamicEnvironmentMap
whenContextLimits.maximumCubeMapSize
is zero, such as in a NodeJS environment where there is no working WebGL context. We set a bottom limit at0
, make sure we have valid array sizes, and don't try to update the maps unless we have at least1
mipmap level.While I was in the tests, I went ahead and cleaned up the failing unit tests described in the linked issue.
Issue number and link
Fixes #12302.
Testing plan
@angrycat9000 Would you mind verifying the issue you ran into, or alternatively, leaving reproduction instructions?
npm run test
locally.NPM
Create a test.js file in the root of the Cesium project and run
node test.js
. Make sure it does not error out.Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change