Page 1 of 2

texture , effect 3D

Posted: 2012-04-06T03:34:05-07:00
by stefek143
it's possible to do something like this? :

Image

+ texture

result:
Image

I was found in internet that php script doing such effect, and I think with use imagemagick but how it is possible?

Re: texture , effect 3D

Posted: 2012-04-06T03:39:20-07:00
by anthony
I believe they would start with a flat texture image, then 'warp' it using a pre-generated 'distort or displacement map' Shading and overlaying would then be applied.

See IM Examples, Image Mapping Effects, Distorts and Displacements
http://www.imagemagick.org/Usage/mapping/#distort
whcih will introduce you to the concepts.

Re: texture , effect 3D

Posted: 2012-04-06T09:54:03-07:00
by fmw42
Sometimes you can take the graytone image and adjust its contrast and brightness and use that for the displacement map.

see examples at
viewtopic.php?f=1&t=16921&p=62696&hilit ... irt#p62696
viewtopic.php?f=1&t=20455&p=81771&hilit ... ace#p81771

But as Anthony says, you may have to adjust the displacement map or create a better one.


I have not given this much thought, but perhaps one can take the shoe and make it binary (b/w) and then use -morphology distance to create a grayscale displacement map. see http://www.imagemagick.org/Usage/morphology/#distance

Re: texture , effect 3D

Posted: 2012-04-08T06:24:49-07:00
by anthony
I don't thnk mathematical methods would work well here.

The definate bend and compession along the top surface to make it look right needs some work.

One way to help with this is to get photos of a object with a checkerboard pattern to it. The check corners can then be used to define control points in setting up the distortion/displacement map needed.

Re: texture , effect 3D

Posted: 2012-04-10T04:07:48-07:00
by stefek143
souonds like very hard to do.. maybe smb will do some simple example how to put similiar texture on such shoe?

Re: texture , effect 3D

Posted: 2012-04-10T10:22:30-07:00
by fmw42
stefek143 wrote:souonds like very hard to do.. maybe smb will do some simple example how to put similiar texture on such shoe?
smb -- what or who is that?

Re: texture , effect 3D

Posted: 2012-04-10T12:35:52-07:00
by stefek143
smb - somebody ;-)

Re: texture , effect 3D

Posted: 2012-04-10T16:06:10-07:00
by fmw42
I don't think anyone here knows exactly how to do that without using 3D modeling and texture mapping software. IM does is only a 2D image processor. So there is only so much it can do.

You have been given ideas with which to experiment. I think that is the best we can do. If some one else has any ideas, I am sure they will add their comments or examples.

Do you have the original texture image that you want to overlay onto the shoe? If so, post that as well, otherwise no one can do any testing to compare to your result.

Re: texture , effect 3D

Posted: 2012-04-10T20:37:10-07:00
by anthony
It should not be hard to do. Just need a little artisty in a image editor like gimp to generate the maps.

Re: texture , effect 3D

Posted: 2012-04-11T03:59:31-07:00
by stefek143
I'm trying to do some gradient maps(with use photoshop), but unfortunatly any good results, the main problem is area what I marked on the picture.

PS. for me no matter is texture like on picture or not, I just want to do such effect.

Image

Re: texture , effect 3D

Posted: 2012-04-11T10:23:21-07:00
by fmw42
If you want others to try something, we need the original texture image that you are trying to put on the shoe.

Re: texture , effect 3D

Posted: 2012-04-11T11:40:55-07:00
by stefek143
for example this texture:

Image

Re: texture , effect 3D

Posted: 2012-04-11T14:51:13-07:00
by fmw42
It would have been nicer to have the same original texture image so that one can compare.

Nevertheless, your texture image is not the same size as your shoe image, so it needs to be stretched. But try this. It is the very same technique used in the two examples listed above for similar things.

(Change the amount below to make the distortion increase)

(NOTE for ease of my use, I renamed images and I added 1 as a prefix to all images)

amount=5

convert \( 1dollar.jpg -resize 180x151! \) \( 1shoe.jpg -auto-level \) \
-virtual-pixel transparent -compose displace \
-set option:compose:args -${amount}x-${amount} -composite 1dollar_dm${amount}.png

convert 1shoe.jpg 1dollar_dm${amount}.png \( -clone 0 -threshold 55% \) \
-compose over -composite 1shoe_1dollar_dm${amount}_comp.png

Image

Note I did -auto-level on the shoe so as the make the effect more intense in the first command
I also thresholded the shoe to make a mask for compositing the texture over the shoe in the second command

This is effectively a "shape from shading" method using the shading as a displacement map.

P.S. It occurs to me that some of the "effect" may just be coming from the stretched overlay image. So a larger image that can be cropped to the right size, might be a better indication.

So I made a grid pattern

convert -size 180x151 pattern:hs_cross 1grid.png

Image


Then applied the same processing:

amount=5
convert 1grid.png \( 1shoe.jpg -auto-level \) \
-virtual-pixel transparent -compose displace \
-set option:compose:args -${amount}x-${amount} -composite 1grid_dm${amount}.png


convert 1shoe.jpg 1grid_dm${amount}.png \( -clone 0 -threshold 55% \) \
-compose over -composite 1shoe_1grid_dm${amount}_comp.png

Image

Re: texture , effect 3D

Posted: 2012-04-12T07:03:43-07:00
by stefek143
thank you !

your effect is really god but one main thing I dont see, please look on my picture :

Image

as you can see the area what I've marked in this place has effect like "arch", texture(dollar) begin from the top and go down with "arch effect" and this make effect 3D. On texture with letters (few posts above) is possible to better see. Letter move from top to bottom without deformation and all of this make 3D effect.

Re: texture , effect 3D

Posted: 2012-04-12T11:19:07-07:00
by fmw42
I am not sure I understand what you think is wrong. Try increasing the amount parameter to increase the effect. Otherwise you may have to manually paint the mask to change the shading to get the effect you want.