You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug concerns using a mesh that displays an image as a texture on a plane geometry, and is scaled using the useAspect hook. The mesh is composed as part of a scene that is rendered within a RenderTexture material. On first render, things look fine, but if you attach camera controls to the top level scene, zoom out with the mouse wheel, then resize the screen, the custom mesh scale suddenly jumps up in size. It's my understanding that the useAspect hook should use the camera within the nested scene to calculate viewport sizes. Investigating the useAspect hook, I found that it’s internally using the useThree hook to access the current viewport sizes and make calculations accordingly. Logging out the viewport sizes from within the mesh component shows that the sizes drastically jump up while resizing the window.
Zoom out with the scroll wheel, then resize the preview window, and read the console. You should see that the logged viewport sizes drastically jump up. Additionally, you should notice the mesh will visually scale up outside of the bounds of the current screen.
Suggested solution:
Correct me if I'm wrong, but I thought that the useAspect and viewport sizes should use the camera in the RenderTexture scene to calculate values.
The text was updated successfully, but these errors were encountered:
three
version: 0.167.1@react-three/fiber
version: 8.17.5@react-three/drei
version: 9.111.3node
version: 20 LTSnpm
(oryarn
) version: yarn 1.22.22Problem description:
This bug concerns using a mesh that displays an image as a texture on a plane geometry, and is scaled using the
useAspect
hook. The mesh is composed as part of a scene that is rendered within aRenderTexture
material. On first render, things look fine, but if you attach camera controls to the top level scene, zoom out with the mouse wheel, then resize the screen, the custom mesh scale suddenly jumps up in size. It's my understanding that theuseAspect
hook should use the camera within the nested scene to calculate viewport sizes. Investigating theuseAspect
hook, I found that it’s internally using theuseThree
hook to access the current viewport sizes and make calculations accordingly. Logging out the viewport sizes from within the mesh component shows that the sizes drastically jump up while resizing the window.Relevant code:
Codepen demonstrating the bug
Zoom out with the scroll wheel, then resize the preview window, and read the console. You should see that the logged viewport sizes drastically jump up. Additionally, you should notice the mesh will visually scale up outside of the bounds of the current screen.
Suggested solution:
Correct me if I'm wrong, but I thought that the
useAspect
andviewport
sizes should use the camera in theRenderTexture
scene to calculate values.The text was updated successfully, but these errors were encountered: