# Paint on 3D Model from an Image (not color) but how tf

**URL:** <https://discourse.threejs.org/t/paint-on-3d-model-from-an-image-not-color-but-how-tf/64148>\
**Category:** Questions\
**Tags:** materials, textures, shaders\
**Created:** [April 16, 2024, 11:34am UTC](https://discourse.threejs.org/t/paint-on-3d-model-from-an-image-not-color-but-how-tf/64148 "2024-04-16T11:34:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janhmmr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/janhmmr/32/46712_2.png) [@Janhmmr](https://discourse.threejs.org/u/Janhmmr)\
**Post date:** [April 16, 2024, 11:34am UTC](https://discourse.threejs.org/t/paint-on-3d-model-from-an-image-not-color-but-how-tf/64148/1 "2024-04-16T11:34:59Z")

</div>

I had this idea where the user can paint a 3D Model but instead of painting a color the brush uses an image as reference as paints that, but only a specific part of the Image. (Basically like the copying brush from photoshop).  
I havent been able to make any progress and my last hope is somebody in here knows how this could be doable.

Would appreciate any help!

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [April 16, 2024, 12:29pm UTC](https://discourse.threejs.org/t/paint-on-3d-model-from-an-image-not-color-but-how-tf/64148/2 "2024-04-16T12:29:09Z")

</div>

For a quick, simple and generally sufficient solution - you can just use CanvasTexture and draw images using Canvas API. For a super optimal solution - you could use a RenderTarget with a disabled autoClear.

---

<div class="post-metadata">

**Author:** ![Janhmmr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/janhmmr/32/46712_2.png) [@Janhmmr](https://discourse.threejs.org/u/Janhmmr)\
**Post date:** [April 16, 2024, 12:41pm UTC](https://discourse.threejs.org/t/paint-on-3d-model-from-an-image-not-color-but-how-tf/64148/3 "2024-04-16T12:41:46Z")

</div>

Thank you! Any examples of that maybe?  
Havent really seen many people do that tbh, and havent found a single example doing it

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [April 16, 2024, 5:23pm UTC](https://discourse.threejs.org/t/paint-on-3d-model-from-an-image-not-color-but-how-tf/64148/4 "2024-04-16T17:23:23Z")

</div>

It’s a tricky problem. This is the usual starting point for people exploring this idea… but you can see the difficulty:

[https://threejs.org/examples/webgl\_decals.html](https://threejs.org/examples/webgl_decals.html)

Namely that… linear projections will have some kind of stretching edge case, or clipping, that doesn’t look good.

It’s also an expensive operation to do the extraction/intersection of the geometry within the decal volume, which make it hard to do at interactive rates.

There are things you can do in a shader that are faster but it’s wickedly more complex, and you have to somehow persist the results back out of the shader.

I wrote a painting tool that does the shader based approach just for a spherical brush… but it shows some of the complexity if you look at how the texture has to actually be transformed.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/4/e/4e0bd9f9c235c94af0b343d95aaa8a2a155503bf.jpeg)
