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

Bug, with fix: Preload component #1950

Open
JustinWomack opened this issue May 6, 2024 · 0 comments
Open

Bug, with fix: Preload component #1950

JustinWomack opened this issue May 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JustinWomack
Copy link

JustinWomack commented May 6, 2024

  • three version: ^0.164.1
  • @react-three/fiber version: ^8.16.3
  • @react-three/drei version: ^9.105.5
  • node version: 20.11.0
  • npm (or yarn) version: 10.2.4

Problem description:

Preload component uses a cube camera to render the scene in a useLayoutEffect in an attempt to increase performance as objects enter the frustum. This can interfere with existing cameras, and also does not eliminate choppiness as these objects are uploaded to the video card.

Relevant code:

Here is the code before, line 28:

 // Now compile the scene
  gl.compile(scene || dScene, camera || dCamera)
  // And for good measure, hit it with a cube camera
  const cubeRenderTarget = new WebGLCubeRenderTarget(128)
  const cubeCamera = new CubeCamera(0.01, 100000, cubeRenderTarget)
  cubeCamera.update(gl, (scene || dScene) as Scene)
  cubeRenderTarget.dispose()
  // Flips these objects back

Suggested solution:

  // Now compile the scene
  gl.render(scene || dScene, camera || dCamera)
@JustinWomack JustinWomack added the bug Something isn't working label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant