-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Octahedral Mapping Tests #7183
Octahedral Mapping Tests #7183
Conversation
Thanks for the pull request @OmarShehata!
Reviewers, don't forget to make sure that:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
Can you add more tests? For example, check that a bunch of samples from the octahedral map are close to samples from the original cube map. Also, do the same for the mipmaps. |
@bagnell I added a test to sample all 6 directions, for every mip level, and confirm that the octahedral map is pretty close to the original cubemap color. I had to flip the Y to account for the +Y/-Y face swap. I also had to add a It also seems to be using |
expect(octahedralMap.maximumMipmapLevel).toEqual(5); | ||
}); | ||
}); | ||
|
||
fit('correctly projects the given cube map and all mip levels', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be it
instead of fit
.
|
||
return pollToPromise(function() { | ||
scene.renderForSpecs(); | ||
octahedralMap.update(frameState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the scene method here instead.
|
||
return pollToPromise(function() { | ||
octahedralMap.update(frameState); | ||
executeCommands(frameState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also use the scene here. You can get scene.context
for the rest of the test.
Why not? The idea is that the framebuffer should be cleared to check that the command executed actual renders the right color. If it isn't cleared, the color might be the same from a previous render. |
Wouldn't it work just as well if that was a single separate test to check that the clear command works, instead of every color test also checking it? That would allow me to refactor |
Could you also do this? You could have a function return the clear color and render color. If the test isn't supposed to clear first, then don't clear and return undefined. Your test should also clear before rendering the cube map face and before the sampling the octahedral projection. |
I don't understand. There is a test to check that a clear works. The clear before render is to prevent something like this: it('test 1', function() {
// set up
expect(scene).toRender(color);
});
it('test 2', function() {
// set up
expect(scene).toRender(color);
}); Now, say test 1 runs first and renders |
In that scenario, test 2 would pass, but the "check that a clear works" would fail, right? |
In that scenario, say the clear test runs before or after both of those tests execute. Now all of the tests still pass when test 2 should fail. |
So it's possible for the clear test to pass, but actually clearing could fail in individual tests? |
No, the scenario was to show what could happen if there is no clear before every render. |
So yes, we're still going to clear before each test, it's just that testing that it correctly clears in every test is redundant, but if this redundancy helps here then I'm all for it. Just wanted to make sure we were on the same page. @bagnell fixed the |
This adds a test for the
OctahedralProjectedCubeMap.js
class. I also removed the temporary +Y/-Y swap from the KTX loader.For the sample environment map, can we use something that doesn't have a visible sun, maybe something like this ?
Speaking of which, @bagnell can you write down some steps for generating these KTX files and the spherical harmonics? It might be useful in putting together a tutorial so users know how to use this until there are tools that can export this extension.