How can I paint a color on any part of the material that is inside 8 points in the world?

I want to be able to paint in color or texture any part of the mesh that intersects 8 points that are in the world position, like this:
7656346--955204--upload_2021-11-14_21-1-10.png

7656346--955207--upload_2021-11-14_21-2-36.png

I managed to lerp the base mesh with a Rectangle Node and change the position with Tile and offset node, but I haven’t been able to convert from world position into the mesh’s position

I mean if your eight points always form an unrotated cube, I’d just pass the cube’s world-space position and size as shader properties. Then all you need to do is just check if a pixel’s world-space position is between the cube’s world-space bounds (check if worldPos.x > boxPos.x - boxSize.x / 2 and worldPos.x < boxPos.x + boxSize.x / 2, repeat for y and z). If it is, you change the color of a pixel to the color that you want to paint it with. If it isn’t, you leave the color as it is.

When you say “a pixel’s world-space position” do you mean the getting the pixel from UV coordinates?

This was the first thing that came to mind but I couldn’t find a “get pixel from mesh” graph node

I don’t know how to do that exactly, but here are some thoughts:

  • Sinterklaas approach would work, but it is shader based, so if want more shapes you gonna have to deal arrays and looping etc.
  • Maybe you could make that red box to depth test on GEqual
  • You could also try using some stencil magic

So I tried using just the Tile + Offset and it really only kinda works when the UV isn’t mapped

Any other object it just becomes completely random

Ok, I got it working with the Position Node. Just split 2 Vector3’s and used them as the position of the faces of the 8 points (6 sides, 2 Vector3)

Next step is to receive actual 8 points and calculate the faces when the 8 points don’t form a square