#Move UV coordinates on GLB Model

2 messages · Page 1 of 1 (latest)

winter slate
#

Hi everyone,

I'm trying to move the UV coordinates on a model so that the user has the option to move the texture around the model.

To illustrate this, here is a 13s video of the Babylon.js sandbox where this can be done with the UI: https://www.loom.com/share/681d7be500a74534a41f90ad2f9a5ff5

I've been looking through the docs, but couldn't see anything specifically about that.

drcmda mentions something similar in a GitHub comment from two years ago (https://github.com/pmndrs/react-three-fiber/discussions/1488), which I experimented with, but I haven't found documentation about the uv property and the .setXY method he's recommending.

As an alternative, I tried working with offsetting and scaling the texture, which gets me part of the way there, but the texture doesn't properly map around and the edges get stretched and pixelated (see attached image).

I'm using React Three FIber. The meshes from my GLB are structured like this:

<mesh
  geometry={nodes.K_Back.geometry}
  material={materials.K_Body}
  position={[…]}
  rotation={[…]}
>
  <meshStandardMaterial
    map={pattern}
    …
   />
</mesh>

Any ideas are much appreciated.

Thanks for your help guys!

GitHub

I have a shape geometry that I've added to my scene and everything works on that just fine until I try to texture the shape. The mapping is off. I found this snippet that should fix my problem ...

solar marlin