开发者

How to implement projection painting?

I'm wondering if anyone has any idea on how to implement a projection painting application. For those who don't know, projection painting is a way to texture 3D models painting directly on them, with your cursor, tablet, finger or whatever, the strokes you do are automatically UV mapped. So if anyone can tell me where to begin, right now开发者_如何学编程 I have a java obj model loader, a UV mapped model with a solid white texture. Any articles/tutorials/example codes/links will be well received.


There are several ways to do this.

A common way to do this in interactive applications is to render the object with the UV coordinates as colours to the framebuffer, read the UV coordinate colour under the cursor, then render the object again as usual.

Another way is to project a ray onto the object, find the face it intersects, then determine the point on the face the ray crosses and project this back into UV space.

The first method is easier to implement, more performant, but suffers from lower precision and in some cases creates some artifacts. The second method is slower, harder to implement, but allows for a very accurate back mapping, if done right.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜