4

UPDATE: Here you can download high quality images of calibration patterns as well as them printed on socks if anyone wants to give this a go

Pardon my lack of vocabulary, this is not my area of expertise and why I'm looking for some guidance on how to create this product preview. I will most likely end up hiring someone

I'd like to create a system that can map/apply new designs onto an image of a sock worn by a model, with the proper transformations and deformations in order to visualize said designs.

The mapping below can be created by printing a matrix "calibration" design onto the product. How the actual mapping/deformation is then created in photoshop or other software is what I would like to learn to do. Ideally I'd like to turn it into a process that can be run in a free/open source software that can be run headless in a linux server (especially as a python script) so I can run it as an internal service for a bunch of designers. As an initial proof of concept a repeatable photoshop or other commercial software action/script would be ok, though!

Things I have:

  • a calibration (matrix) design with dot patterns
  • socks printed with the matrix dot pattern
  • pictures of models wearing the socks

Here is an example of the results I'm trying to achieve:

The pattern to be visualized on the socks pattern to map

The pattern as it would be printed on the socks. Note that it's not just a simple overlay with blending, but actual deformation of the image to take into account the 3D shape of the socks being worn. pattern "printed" on socks worn by model

The socks are printed on a cylinder, so the mapping should reflect the bending of the socks at a 45 degree angle. pattern "printed" on socks

Attached are a sample of white socks to do the overlay over:

Sample white socks

3
  • 2
    Welcome on GD.SE, Andres. Since you used the tag Blender, please be aware of the specific site blender.stackexchange.com. Oct 15, 2019 at 9:46
  • Hey @PaoloGibellini, thanks for the heads up. I think it's probably not a blender specific task, but rather that a solution might be achievable with blender.
    – Andres
    Oct 15, 2019 at 14:34
  • 1
    As long as your images do not have common simple shapes such as straight lines or circles very loose warping should be plausible enough. But the light and shadows should be right. Could you accept it? If yes you can do it in 2D.
    – user82991
    Oct 15, 2019 at 14:59

2 Answers 2

6

To my knowledge there's no way to use UV data in Photoshop and I'm not sure it would help with this example because the deformation is quite strong: it'd be a job for vector displacement filter (which Photoshop also doesn't have). If I had a task like this I'd go 3d and since you have Blender as a tag, here's a little breakdown of how I'd approach this:

  1. Since a sock is a simple object and it doesn't require any complex folds, I'd start with a model from Daz3d (free) as a base

    enter image description here

  2. in Blender I'd cut the feet and run it through voxel remesher (to get rid of toes and details) and quad remesher (to get a nice topology)

    enter image description here

  3. then a simple UV-unwrap, eyeballing the distortion

    enter image description here

  4. Here's a result. It took less than an hour from start to finish, if I spent more time I guess it'd be possible to get even better results? To me it looks quite ok even now

    enter image description here

  5. Blender supports python as you probably know already and rendering from CLI, so then you could write a script to reload a texture and simply run something like this:

    blender --background sock.blend --python change_texture.py -- new_texture.png

    And in render settings of Blender it'd be also possible to set a set of render passes to render %) so you could have shadows, diffuse lighting, etc as separate images.

    enter image description here

8
  • Wow, that's incredible you've been able to do all of that so quickly! Thanks for going above and beyond in an answer. I have 0 experience with 3d modeling, and our current approach is similar, and I was trying to build a blender pipeline, but was left hanging by the 3d modeler I had hired... but I can take photographs and can get around photoshop, so that's why I was solution to the problem I proposed. We have different sock models that we would add in the future. That's why I was looking for a solution that I could repeat easily myself. But maybe we should chat?
    – Andres
    Oct 15, 2019 at 14:37
  • @Sergey Kritskiy Nice answer, the only problem I see is the deformation of the unwrapping, probably a cylindrical projection will be more useful.
    – Rafael
    Oct 15, 2019 at 14:42
  • @Rafael topology could've been better so the deformation could've been less visible. I think cylindrical projection would bring more deformations (because the object is a very deformed cylinder), but I haven't tried that Oct 15, 2019 at 15:16
  • 1
    @Andres well, my email address is in my profile if you have any further questions Oct 15, 2019 at 15:16
  • 1
    your answer is simple, effective and on-point. I'd do the same thing in modo, which is my 3D DCC (Digital Content Creation) tool of choice, in almost the exact same way. The advantage you've given here is both the freeware/open source nature of Blender and the example python to swop and re-render based on new pattern context. Nice answer! Oct 15, 2019 at 17:31
3

I repeat my old comment: As long as your images do not have common simple shapes such as straight lines or circles very loose warping should be plausible enough. But the light and shadows should be right. Could you accept it? If yes you can do it in 2D.

An example

One of your unused socks is clipped and pasted over an image of a foot as a new layer. A mesh warp is done to deform the unused sock to the right form. I admit it's not geometrically a masterpiece. Here's a screenshot under the warping:

enter image description here

Here's the result after warping and fixing a couple of not so good places with the eraser:

enter image description here

It has unfortunately no shading, it's flat. To get some depth I drew a couple of black strokes to a new layer:

enter image description here

After blurring the strokes and deleted the extras (selected the emptiness in the warped layer) I got this shading:

enter image description here

Inserting it and a drop shadow I got the final result:

enter image description here

This is still quite artificial. Much better result can be got by having a photo of a leg with white sock. Blending mode Multiply would give both perfect shading and a good fabric surface texture at the same time.

The warping can be reused for another photo if you use a program which supports it. I used Affinity Photo, which has unfortunately non-reusable warp mesh.

Illustrator's envelope distort with mesh allows changing the photo. Only release the envelope distortion and apply the mesh to another photo which has identical pixel and millimeter dimensions. Reuse the released mesh in Object > Envelope distort > Make with Top Object.

In Photoshop you can try Puppet Warp to a layer which is converted to smart object. Then it's possible to change the content, because Puppet Warp is a smart filter.

8
  • Yes! I think this is a lot closer to what I'm looking for. Can get you a picture of a leg wearing a white sock.
    – Andres
    Oct 16, 2019 at 0:13
  • Insert a download link so it can be tried. I guess I can have time in 2 days.
    – user82991
    Oct 16, 2019 at 0:34
  • inserted an example white sock picture that you can download. working on getting the grey dot matrix pictures.
    – Andres
    Oct 19, 2019 at 13:03
  • @Andres the white sock photos are very bad. There's enough non-blurred detail only at the top edge and in a couple of other places. Their edges are heavily feathered which alone makes them useless. In addition they have too flat light which totally hides the geometric forms of the legs. Sorry, but you need sharp photos which have geometry revealing lights and shadows. You will not find them from textile seller's web pages, they must be taken with proper equipment for this purpose.
    – user82991
    Oct 19, 2019 at 16:13
  • Sorry about that. We just took some professional photos. Should have them in the next 24 hours. Wanted to see if those would do the trick, but clearly not.
    – Andres
    Oct 20, 2019 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.