#moving a decal across a mesh

32 messages · Page 1 of 1 (latest)

thorny moth
#

Hello! I am a complete beginnner to threejs and am facing a problem and am asking for anyone to help or point me in the right direction. I am trying to implement a 3d mockup website where a user can upload an image onto a 3d model and be able to move that image around the model. <Decals/> that are put onto the meshes tho tend to act weird where they warp, stretch and sometimes disappear when their position is changed on the model.

Has anyone ever implemened something like this or knows a good way to do it?

Any help would be appreciated!!!

latent jolt
thorny moth
#

thank you so much for responding

#

I will send you my code

#

atleast the parts that I think are relevant to the implementation

#

is there a best way to send it?

latent jolt
#

Could you give me dm?

#

I will share my email with you.

nocturne yacht
#

you would probably need to adjust the projection of the decal

#

to the normal of the surface it moves over

thorny moth
#

how would I acheive that?

nocturne yacht
#

raycast from the camera to the mesh

#

and then generate a decal using the

#

position and normal of the intersection

thorny moth
#

would raycasting work if the model also rotates?

nocturne yacht
#

if you take taht into account, yes

#

threejs or threemeshbvh have out of box functionsthat handle that

#

this is another option

#

it uses projection to accomplish a decal-like effect

#

if you only have 1 or 2 decals it could work well

thorny moth
#

thank you I will look into it

thorny moth
#

??

nocturne yacht
#

not sure, you might have to make your own integration

#

if this is an r3f thing, posting it in #1136579051830644756 might get the attention of those more experienced w/ fiber & drei

thorny moth
#

I dont think it is an r3f thing, but I will go there for extra help. thank you

#

I found this video posted in a post in #1136579051830644756 and it is literally everything I wanted

#

it does look lay raycasting bc the model isnt moving that smoothly across the model unlike other demos I have seen

nocturne yacht
#

this actuallylooks like uv unwrapping