I have a texture projected on a mesh using decal.
I’d like to map the texture pixels to the mesh geometry position, how can I do that?
the goal is to be able to extract a mesh geometry position or even the face contained that position which is mapped to the a position in the texture.
Um, that’s a very unusual request. Can you please explain your use case a bit? Why do you need this logic?
sure,
let’s say I’m using a decal to project on a model an image with several drawings on it (for example polygons or circles).
I know the model position of the image center as it projected on the model in specific position, and assume I know the image drawings 2d image position or offset from the image center.
I would like to convert those 2d positions to the model positions as they are projected on the model and add some objects on that exact positions.
Um, have you tried to compute the coordinates of these 2D image positions in world space? What happens when you multiply a 2D image position with the world matrix of the respective decal?
didn’t tried it,
the idea of the decal is to get the shape of the model and this shape is not a surface, therefore different image positions lays on different faces with different normal vectors - will result different matrix
Give it a try and see what happens