Skip to content

WebGLRenderer: Render target discrepancy between Chrome and Firefox. #31041

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

Open
lambocorp opened this issue May 4, 2025 · 4 comments
Open

Comments

@lambocorp
Copy link

lambocorp commented May 4, 2025

Description

Experiencing two different results when opening project in Chrome versus Firefox.

I have a sky object and a clone of it.
(1) render the sky clone to a target.

const renderTarget = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, { 
	type: THREE.HalfFloatType,
})

(2) render the main scene containing the sky object

// all other objects in the main scene, 
// for example, the red cube in the image below, sample the render target with:
uniform sampler2D renderTarget;
// ...
vec2 screenUV = gl_FragCoord.xy / resolution.xy;
color = texture(renderTarget, screenUV);

In Firefox, the samples align perfectly with the background.
In Chrome, the perspective is warped.
r175

Image

Reproduction steps

Code

// code goes here

Live example

Screenshots

No response

Version

0.175.0

Device

Desktop

Browser

Chrome

OS

Linux

@Mugen87
Copy link
Collaborator

Mugen87 commented May 5, 2025

Do you mind demonstrating the issue with a live example?

You can use on of the fiddles from the Live example issue section.

@lambocorp
Copy link
Author

Code Sandbox

If you move the gui slider for 'far' to 0, the sphere material mixes between it's color and the sample from the render target.
I can't seem to replicate the issue yet, it looks fine in FF and Chrome, but I will try one more modification on the test still.

Just to explain the demo:
it renders a scene with the camera inside of a cube that has plants on the backface (as a temporary 'Sky').
Also render a scene with just that cube (Sky) to target (sky-controller.js).
Put a sphere in the center of the screen.
Patch the sphere's material in fog-controller.js.
The sphere's fog fragment now samples the render target.

@Mugen87 Mugen87 removed the WebGPU label May 7, 2025
@Mugen87 Mugen87 changed the title Render target discrepancy between Chrome and Firefox WebGLRenderer: Render target discrepancy between Chrome and Firefox. May 7, 2025
@Mugen87
Copy link
Collaborator

Mugen87 commented May 7, 2025

I can't seem to replicate the issue yet, it looks fine in FF and Chrome, but I will try one more modification on the test still.

That's good. The smaller the code example the better. This could potentially be a browser issue so a compact test case will be helpful when the issue is reported to a browser vendor.

@lambocorp
Copy link
Author

Yea my core build is huge and complicated, and I tried to extract relevant parts into a test, but CodeSandbox refuses to let me extend Three.Mesh... not sure why, but the test uses a temporary work around instead to try and show the issue. So there's still room for me either to try and get the test closer to the core build which has the issue, or remove aspects from the core to get to a minimal example.

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

No branches or pull requests

2 participants