question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multisampling on newer iOS depth/stencil issue

See original GitHub issue

Description of the bug

The scene depth/stencil rendering is broken on iOS devices version 15.4+ (supporting WebGL 2.0) when multisampling is enabled. This works as intended on the desktop and also on older iOS devices, where WebGL2 is not supported. When the multisampling property is removed, all works even on 15.4+ iOS versions. Tested on several iOS devices.

This video shows what is happening:

https://user-images.githubusercontent.com/24633729/192964722-5b2d641b-ef3c-4f1a-be68-369fd5369d62.mov

To Reproduce

Everything is standard code for working with PP.

const renderer = new THREE.WebGLRenderer({ 
    powerPreference: "high-performance",
    antialias: false,
    stencil: false,
    depth: false
});
const maxSamples = renderer.capabilities.maxSamples;
const composer = new EffectComposer(renderer, { multisampling: Math.min(4, maxSamples) });

const noiseEffect = new NoiseEffect({premultiply: true})

const effectsPass = new EffectPass(
    camera,
    noiseEffect
);

composer.addPass(new RenderPass(scene, camera));
composer.addPass(effectsPass);

Expected behavior

This video shows the expected behaviour. It is the same footage as the previous one, but without the issue / multisampling set to 0:

https://user-images.githubusercontent.com/24633729/192964592-f0aec077-0316-4615-869a-cc7512a98651.mov

Library versions used

  • Three: 0.144.0
  • Post Processing: 6.28.7

Mobile

  • Device: iPhone SE 2020
  • OS: iOS 15.4+
  • Browser: Safari / Chrome

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
otrubakarelcommented, Oct 7, 2022

I can also confirm that this bug is no longer present on iOS v15.7

0reactions
vanruesccommented, Oct 7, 2022

I was able to reproduce the issue on an iPhone 13 with iOS v15.4 via browserstack but I did not see the bug on iOS v15.5. So it looks like this was fixed in v15.5.

I used the following Sandboxes for testing:

  1. MSAA buffer + copy to screen // https://e3z8n2.csb.app/
  2. MSAA buffer + render to screen with effects // https://8rcqnu.csb.app/
Read more comments on GitHub >

github_iconTop Results From Across the Web

Copying depth texture to buffer on… | Apple Developer Forums
P.S.: I'm running iOS 9.3.5 on an iPhone 6 and an iPad Pro. Implementation roughly looks like this (using non multi-sampling):. MTLRenderPassDescriptor ...
Read more >
Multisampling on iOS can't get depth texture? - Stack Overflow
I have set up rendering to a framebuffer with color and depth textures on iOS, all works ok. I then tried to add...
Read more >
Using modern OpenGL ES features with ... - Qt
It conveniently hides the differences between OpenGL and OpenGL ES, enables easy usage of packed depth-stencil attachments, multisample ...
Read more >
Multisampled Render Targets and Resolve Operations · Issue ...
(2) There is no “resolveTarget” field for depth or stencil attachments, and the field “hasResolveTarget” of "depthStencilAttachment" must be ...
Read more >
Reading the Depth Buffer in Apple's Metal API
And this is where weird problems started to occur. When I used a large render target size (e.g. 2048×2048 or more), everything worked...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found