Topic was automatically imported from the old Question2Answer platform.
Asked By
stormreaver
I have a texture on a flat surface, and I’m sliding the texture across that surface. I would like to clip the texture when it moves off the side of the surface to give the effect of the image scrolling off the surface, but Godot simply starts redisplaying the texture on the opposite side (repeats).
Is there a setting somewhere that will prevent the texture from repeating like that, but will instead clip the texture at the surface’s edges?
After much research, and an unnecessary detour into shaders, I found the simple solution: Sprite3D. Combining the region_rect and offset properties, I am able to get the effect I am after: a texture that slides off the end of a surface.
For anyone interested, here’s a video of the solution:
I mostly get the effect I’m after, but Sprite3D is HORRIBLY slow. On the Quest 2, one 1024x256 Sprite3D causes a noticeable slowdown, and a few more of them make my game too slow to be playable. It quickly gets to the point where the Quest 2 becomes almost entirely unresponsive (somewhere around seven or eight).
Contrast this to meshes with 1024x1024 textures, where I can have many meshes without any noticeable impact on playability.