-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add option to ignore colorspace information in texture images #9624
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
Conversation
|
Thanks for the pull request @j9liu!
Reviewers, don't forget to make sure that:
|
|
The change seems good for glTF but it could impact rendering of non-glTF images such as imagery on terrain, textured polygons, or billboards. You might notice something if you compare sandcastle examples on this branch vs. The safe thing to do would be to add an option to CC @ptrgags @sanjeetsuhag for the |
|
@lilleyse - just pushed some changes, is this better? |
|
@lilleyse - what do you think of these changes? I haven't found a workaround for the I changed the structure of the options in the |
| crossOrigin, | ||
| deferred, | ||
| flipY, | ||
| skipColorSpaceConversion, |
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.
I did a global search for createImage and noticed that some terrain and imagery tests require updates. See ArcGisMapServerImageryProviderSpec.js and others examples like below - the new parameter needs to be added.
Resource._DefaultImplementations.createImage(
request,
crossOrigin,
deferred,
true,
true
);
| expect(window.createImageBitmap).toHaveBeenCalledWith(blob, { | ||
| imageOrientation: "none", | ||
| premultiplyAlpha: "none", | ||
| colorSpaceConversion: "default", |
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.
Excellent tests throughout!
| * or an object with width, height, and arrayBufferView properties. | ||
| * | ||
| * @param {Object} source The source {@link ImageData}, {@link HTMLImageElement}, {@link HTMLCanvasElement}, or {@link HTMLVideoElement}, | ||
| * @param {Object} options Object with the following properties: |
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.
For the sake of API symmetry we should also make the same changes to CubeMapFace.prototype.copyFrom.
|
@j9liu thanks for the updates, they look really good overall. Just a few small things left and this PR should be ready to go. |
|
@lilleyse - I think I addressed all your comments; let me know if I missed anything! Also, I noticed that these two tests fail when I run them -- should I look into them? They were failing before I made the major changes to |
Source/Renderer/loadCubeMap.js
Outdated
| * | ||
| * @param {Context} context The context to use to create the cube map. | ||
| * @param {Object} urls The source URL of each image. See the example below. | ||
| * @param {Boolean} skipColorSpaceConversion If true, any custom gamma or color profiles in the images will be ignored. |
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.
| * @param {Boolean} skipColorSpaceConversion If true, any custom gamma or color profiles in the images will be ignored. | |
| * @param {Boolean} [skipColorSpaceConversion=false] If true, any custom gamma or color profiles in the images will be ignored. |
| Resource._DefaultImplementations.createImage( | ||
| request, | ||
| crossOrigin, | ||
| deferred | ||
| deferred, | ||
| true, | ||
| true |
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.
Ah I should have been clearer about this. The only functions that need to be updated are those that were already passing in the optional parameters like here. Since createImage now takes 6 parameters code like below needs to be changed
Resource._DefaultImplementations.createImage(
request,
crossOrigin,
deferred,
true,
true
);
changes to
Resource._DefaultImplementations.createImage(
request,
crossOrigin,
deferred,
true,
false,
true,
);
Source/Scene/SkyBox.js
Outdated
| if (typeof sources.positiveX === "string") { | ||
| // Given urls for cube-map images. Load them. | ||
| loadCubeMap(context, this._sources).then(function (cubeMap) { | ||
| loadCubeMap(context, this._sources, false).then(function (cubeMap) { |
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.
Fine to use the default value here
| loadCubeMap(context, this._sources, false).then(function (cubeMap) { | |
| loadCubeMap(context, this._sources).then(function (cubeMap) { |
It looks like the tests pass in |
|
@lilleyse - sorry for the misunderstanding! I reverted the changes. You were right, the fix for the missing parameter made those two tests pass. |

Fixes #9390.
The
UNPACK_COLORSPACE_CONVERSION_WEBGLflag was not set toNONEas specified in the glTF documentation.When the Sandcastle from the issue is copy pasted into a local session, it should now look like this. The spheres across each row are identical.
cc @ebogo1 @shehzan10