-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
LightProbeGenerator: WebGL error with gl.readPixels in some cases #26765
Comments
Looking at the code, |
I've hacked in half float support but I don't think the result is correct. The sphere is now very bright. https://jsfiddle.net/wtbe3pug/3/ @WestLangley Does the light probe implementation support HDR? Or are the irradiance color values expected to be in the |
Thanks! I think brightness-wise it doesn't look too bad - given that this is a high-dynamic range source texture the results would be expected to be brighter too. E.g. here's a similar thing on the modelviewer.dev page with a comparison of the same environment as HDR and converted to LDR: I'm not super sure about the probe result though; https://jsfiddle.net/rh3t19pq/15/ Probe Result: (but that may be an entirely unrelated issue) |
I edited your fiddle and highlighted my changes, adding tone mapping and exposure control: https://jsfiddle.net/793es8jq/ This very closely matches the irradiance estimated by PMREM, so it looks good to me.
Your hack looks good. File a PR and we can verify. |
In light of my previous comments: #18371 (comment) and #18371 (comment) ... ... I am curious as to your proposed workflow. How do you intend to use the HDR-generated light probe{s} in your app? What is the workflow we need to support? |
I'm aware that envMap basically applies the same effect and this shouldn't be combined. The usecase for us is that there are some custom shaders that differentiate between "diffuse environment lighting" and "reflection response" and for those, the shader takes spherical harmonics for diffuse lighting and an environment map for reflections. This is relatively similar to how light probes work in Unity. Hope that makes sense! |
I expect An alternative is to use low-res cube maps for your irradiance probes. three.js support for cube-map-based light probes is also an option. |
Description
When trying to use the LightProbeGenerator there are some cases where it fails.
The error message is different on
Safari:
Error: WebGL: INVALID_OPERATION: readPixels: pixels is not TypeUint16
Chrome:
WebGL: INVALID_OPERATION: readPixels: type HALF_FLOAT but ArrayBufferView not Uint16Array
and the coefficients being returned are all 0.
Reproduction steps
Run the fiddle in Safari or Chrome
Note
WebGL: INVALID_OPERATION: readPixels: pixels is not TypeUint16
error in the consoleCode
Live example
https://jsfiddle.net/tkgobqnc/20/
Screenshots
No response
Version
r156
Device
Desktop
Browser
Chrome, Firefox, Safari, Edge
OS
MacOS
The text was updated successfully, but these errors were encountered: