Skip to content

Jank while scrolling model/texture into view for first time #31

Answered by ffdead
kaspervdm asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @kaspervdm, yes this is a common challenge with threejs in general. You need to make sure all meshes are visible and rendered once for shaders to compile and textures to be uploaded.

ScrollScene will toggle visibility to false automatically for meshes outside the viewport to reduce the amount of draw calls.

If you use useTexture from Drei it will already request the image to be uploaded to the GPU at load time. For 3D models it's a bit trickier but the easiest way is to place a Preload component from Drei in the same suspense boundary as the useGLTF call.

There is also a 'preloadScene' method from useScrollRig that you can use if you need more imperative control.

Let me know how it goe…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ffdead
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #17 on October 11, 2023 07:54.