Advanced, Raycast onto 3D mesh to get 2D position on texture

Trying to spray paint on a 3D mesh with raycast.

How would I convert the 3D raycast position on the mesh to the 2D position on the texture, so i can draw on the texture and then update it? Never seen this done anywhere…

As long as you’ve got clean uvs you can draw to a 2d canvas and use it as a canvas texture with needs update set to true

Edit: I realised you’re asking the opposite of what I’ve suggested see this answer How I can get position of canvasTexture by raycast on 3d object - #2 by Mugen87

Raycaster. Look up uv key.

Plenty out there ex: https://brushhh.blogspot.com/

1 Like

Yes, that’s it, thanks.