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

Env maps to goes black for other WebGLRenderer with MeshStandardMaterial. #42

Open
benzsuankularb opened this issue Mar 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@benzsuankularb
Copy link

benzsuankularb commented Mar 14, 2024

I have 2 WebGLRenderer(Canvas) in my web.
However, The second one didn't make use of realism effects.
But the env map goes black when realism effects were used in the first canvas.

I've dug a bit and found the patches of ShaderChunk.envmap_physical_pars_fragment
(https://github.com/0beqz/realism-effects/blob/main/src/ssgi/utils/Utils.js)

I also found the SSGIEffect is trying to disable the patch at the end of each frame.
(https://github.com/0beqz/realism-effects/blob/main/src/ssgi/SSGIEffect.js)
But that's not working when another renderer tries to use envmap_physical_pars_fragment along the way.

globalIblRadianceDisabledUniform.value = true

this.rAF = requestAnimationFrame(() => {
	this.rAF2 = requestAnimationFrame(() => {
		globalIblRadianceDisabledUniform.value = false
	})
})
@0beqz
Copy link
Owner

0beqz commented Apr 5, 2024

Hey, thanks for reporting.

I see, that was a somewhat hack I implemented. The idea is to disable only specular and not diffuse environment lighting for all materials.
Well with SSGI where both these things are calculated I can fix it by enforcing that the envMapIntensity of the scene is set to 0.
However, with SSR it's more complicated.
So it looks like I need to fix it by unsetting that after the render and not the frame.
I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants