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

fix: support cameras array #1688

Merged
merged 4 commits into from
May 22, 2024
Merged

fix: support cameras array #1688

merged 4 commits into from
May 22, 2024

Conversation

xiaoiver
Copy link
Contributor

@xiaoiver xiaoiver commented May 20, 2024

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / Document optimization
  • TypeScript definition update
  • Refactoring
  • Performance improvement
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

In WebXR there're multiple XRViews e.g. left and right eyes. So we need to support rendering to cameras instead of a single camera.

https://threejs.org/docs/#api/en/cameras/ArrayCamera

💡 Background and solution

Since we use RenderGraph now, each camera should have its own render pass.

this.cameras.forEach(({ viewport }) => {
    // main render pass
    this.builder.pushPass((pass) => {});
});

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@xiaoiver
Copy link
Contributor Author

目前确实能根据左右眼相机渲染两次:
截屏2024-05-20 下午5 44 27

但右眼相机渲染完才设置 viewport,导致重合在一起:
截屏2024-05-20 下午5 45 21

@xiaoiver
Copy link
Contributor Author

第二个问题是 z-fighting 导致的闪烁:
IMG_9449

https://threejs.org/examples/webgl_camera_logarithmicdepthbuffer.html

@xiaoiver xiaoiver merged commit 6dd79bc into release May 22, 2024
3 checks passed
@xiaoiver xiaoiver deleted the fix-webxr branch May 22, 2024 07:22
xiaoiver added a commit that referenced this pull request May 22, 2024
* fix: support cameras array (#1688)

* fix: support cameras array

* chore: disable enableDirtyRectangleRenderingDebug by default

* fix: set viewport

* chore: commit changeset

* chore(release): bump version (#1689)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

1 participant