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

DoubleSided transmission broken with WEBGL_multisampled_render_to_texture (Oculus Browser) #28131

Open
mrxz opened this issue Apr 13, 2024 · 1 comment
Labels

Comments

@mrxz
Copy link
Contributor

mrxz commented Apr 13, 2024

Description

When transmissive materials are set to DoubleSided the transmissive objects are rendered in two passes (see: #25502). The back side of the transmissive objects are rendered into the transmissiveRenderTarget while using the intermediate result of the transmissiveRenderTarget. This works as the target is multi-sampled and uses two textures under the hood.

However, when the EXT_multisampled_render_to_texture is supported by the browser, it is used instead of the two textures approach. In this case rendering the back-sides fails as source and destination textures are the same.

[.WebGL-0x20170a200]GL ERROR :GL_INVALID_OPERATION : glDrawElements: Source and destination textures of the draw are the same.

Reproduction steps

  1. Setup a scene with a double sided transmissive material
  2. Open in a browser that supports WEBGL_multisampled_render_to_texture
  3. Notice the back-side not being rendered and error(s) logged in the console

Code

const geometry = new THREE.SphereGeometry( 20, 64, 32 );

const material = new THREE.MeshPhysicalMaterial( {
	metalness: 0,
	roughness: 0,
	ior: 1.5,
	envMap: /* some equirectEnvMap */ hdrEquirect,
	transmission: 1.0,
	side: THREE.DoubleSide,
} );

mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );

Live example

The bug is present in both webxr_vr_sandbox and webgl_materials_physical_transmission.

Screenshots

Without WEBGL_multisampled_render_to_texture With WEBGL_multisampled_render_to_texture
image image

Version

r163

Device

Headset

Browser

Chrome

OS

Android

@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 13, 2024

Yeah, we were hoping to circumvent the feedback loop by always using a multisampled render target, see #26177. It seems there is no way around a separate solution for the EXT_multisampled_render_to_texture case.

In #26177, I have mentioned one possible approach based on copyTexSubImage2D(). Meaning copy the contents of the transmission framebuffer into a separate texture and use it as the value for transmissionSamplerMap. Do you think this approach goes into the right direction or are there other options?

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

No branches or pull requests

2 participants