Perhaps I am faced with a difficult task,could you please help me, : There is a box geometry with a texture from a blender superimposed on it, and there are separately created Points in the amount of 10 pieces on the surface of this cube.
How do I transfer the pixel color from the texture lying on the vector3 cube to each point?
That is, the point lying on the surface of the cube should merge in color with the texture on the cube. Which method should be used to solve this problem, because point requires uv vector2, and which would be the preferred solution method - Data3DTexture, Raycaster, shader? Or maybe there is another solution? I’m new to three.js .
why do you need to do this? there may be a better way…
I’d go with raycaster: (relatively) simple, fast enough and kinda scalable (perhaps 50 points on low spec). Shooting a ray from point position to cube center should do it. For a good starting point you can disect official raycast texture example, and from there get color data.
In general, I thought there were two logical solutions: This is either to somehow split the texture into pixels with vector 3 coordinates and use them, or vice versa, split the mech into triangles with a search for points on them, and then somehow find uv vector2 for a point relative to the triangle.
To put it mildly, it is not easy for me, and these two options have led to a difficult dead end. In fact, raycaster seems to be more straightforward, thanks, I’ll try!