title: How to generate texture mapping images?
body: <p>I want to put/wrap images to 3D objects. To keep things simple and fast, instead of using(and learning) a 3D library I want to use mapping images. Mapping images are used in such a way:</p>
  
  <p><img src="https://i.stack.imgur.com/FQu4K.png" alt="mapping usage"></p>
  
  <p>So you generate the mapping images once for each object and use the same mapping for all images you want to wrap.</p>
  
  <p>My question is how can I generate such mapping images (given the 3D model)? Since I don't know about the terminology my searches failed me. Sorry if I am using the wrong jargon.</p>
  
  <p>Below you can see a description of the workflow.<br/>
  <img src="https://i.stack.imgur.com/MzBgs.png" alt="enter image description here"> <br/>
  I have the 3D model of the object and the input image, i want to generate mapping images that I can use to generate the textured image.</p>
  
  <p>I don't even know where to start, any pointers are appreciated.</p>
  
  <p><strong>More info</strong></p>
  
  <p>My initial idea was to somehow wrap a identity mappings (see below) using an external program. I have generated horizontal and vertical gradient images in Photoshop just to see if mapping works using photoshop generated images. The result doesn't look good. I wasn't hopeful but it was worth a shot.</p>
  
  <p>input<br/>
  <img src="https://i.stack.imgur.com/HfIRI.jpg" alt="enter image description here"></p>
  
  <p>mappings (x and y), they just resize the image, they don't do anything fancy. <br/>
  <img src="https://i.stack.imgur.com/e7dyZ.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/H7M24.png" alt="enter image description here"></p>
  
  <p>result<br/>
  <img src="https://i.stack.imgur.com/rXC7Y.png" alt="enter image description here"><br/>
  as you can see there are lots of artifacts. Custom mapping images I have generated by warping the gradients even looks worse.</p>
  
  <p>Here is some more information on mappings: <a href="http://www.imagemagick.org/Usage/mapping/#distortion_maps" rel="noreferrer">http://www.imagemagick.org/Usage/mapping/#distortion_maps</a></p>
  
  <p>I am using OpenCV remap() function for mapping.</p>