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

Added 'stencil' property to renderer system for enabling stencil buffer on WebGL context #5509

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

mrxz
Copy link
Contributor

@mrxz mrxz commented Apr 5, 2024

Description:
Since Three.js version r163 the stencil buffer is disabled by default. Existing components that rely on it being present might now be broken, for example: mrxz/fern-aframe-components#1. This PR introduces a stencil property on the renderer system, similar to the alpha property, which is passed to the WebGLRenderer constructor, ensuring the relevant buffer will be created on the WebGL context.

Changes proposed:

  • Introduce stencil property to renderer system

@dmarcos
Copy link
Member

dmarcos commented Apr 5, 2024

Thanks!

@dmarcos dmarcos merged commit 863c0e6 into aframevr:master Apr 5, 2024
1 check passed
@coderofsalvation
Copy link

coderofsalvation commented Feb 9, 2025

since the AFRAME 1.5.0 => 1.6.0 the stencil-code of the https://xrfragment.org demoviewer is now in a catch22: if I enable stencil:true:

  • it works in the desktop browser on my laptop (also in VR-mode via WebXR extension)
  • randomly renders meshes on quest 2 in immersive-mode only

Any idea whether there some other factors at play here besides bugs in my stencilcode?

@mrxz
Copy link
Contributor Author

mrxz commented Feb 9, 2025

@coderofsalvation Three.js changed the default to no longer create a stencil buffer. This PR simply adds a way to re-enable it. So with stencil: true it should be how it was before.

The regression in your case is probably caused by a different change (possible in Three.js). Quickest way to find out is using git bisect to pinpoint which A-Frame commit introduced the problem for you.

@coderofsalvation
Copy link

coderofsalvation commented Feb 9, 2025

@mrxz thanks for reminding. So yes it seemed to work when I set stencil: true in desktop-mode, but not in immersive mode (because of the latest included THREE-version I guess).
I've did a new build of the master-branch, and it seems it is no longer randomly rendering meshes [but there's still stencil-shenanigans in immersive mode on Quest only].
Thanks I will investigate further with git bisect.

UPDATE

Indeed THREE seems to be the culprit

$ git bisect start
$ git bisect good # did this a couple of times [and retried]
$ git bisect bad 
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[e08045481417d494c5e91ac53b36e8d453692c7d] Bump three to r163

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

Successfully merging this pull request may close these issues.

3 participants