Realtime painting tools

Is anyone know how http://quixel.se/ work?

  • The technique behind this application.
  • How they do realtime painting and transform 3d UV coordinate to 2d texture coordination?
  • Is that possible to implement by using monogame?

It’s a technique called picking or ray picking. XNA had a sample of object picking, and I’m sure it was this or another similar sample that extended this to pick a single triangle on the object. Once you have the triangle and the position within the triangle, you can map this to a UV position within the texture coordinates assigned to the triangle, and then back to a location on the texture applied to that triangle, and so on. You would already have a copy of the texture data in memory, so you can now modify this texture data with your paint brush, and then set that data on the texture to see the real-time painting on the model.

This is a very simplified view of the entire process, as it is a whole lot more complex than this, but it’s the general idea.

Gah, shock and Horror @KonajuGames, using the old XNA library instead of the Archived XNAGameStudio GitHub page :wink:

seem like a quite expensive process, if u hav a high polygon object

If you do it the naive way and just iterate through the triangles in an object. Which is fine for low poly objects, but you would need a smarter approach for high poly objects, such as using an octree or similar to partition the object into more easily searchable cells.

1 Like