Skip to content
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

Revisit Reflection Probe implementation #66

Open
takahirox opened this issue Jul 19, 2022 · 0 comments
Open

Revisit Reflection Probe implementation #66

takahirox opened this issue Jul 19, 2022 · 0 comments

Comments

@takahirox
Copy link

takahirox commented Jul 19, 2022

From Hubs-Foundation/hubs#5570

Description of the problem

Our Reflection probe implementation may be a bit danger. Because it switches envMap and envMap2 after setting up WebGL programs.

The Three.js renderer and other webgl modules generate shader code, get program cache, decide whether to change program, and so on, from material (and other objects) properties.

https://github.com/MozillaReality/three.js/blob/7c6fb585ffa7737544871d2bbd4b0864c316f148/src/renderers/WebGLRenderer.js
https://github.com/MozillaReality/three.js/blob/262eb259a1f92c3554a11353b7f52c13900f879e/src/renderers/webgl/WebGLProgram.js
https://github.com/MozillaReality/three.js/blob/12f550e0f44f68e5b6c946dd242ee08e42d209e4/src/renderers/webgl/WebGLPrograms.js

Switching envMap after setting up them can cause mismatch.

More proper implementation may be setting up envMap/2 first and then include them in the decision of shader code generation, program cache, and so on. (Or using the renderer hooks? I haven't deeply dug into them yet tho.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant