Custom Distort for printing on non-flat media

Here everybody can post his problems with PhotoLine
maho
Mitglied
Posts: 103
Joined: Sun 18 May 2003 02:02

Custom Distort for printing on non-flat media

Post by maho »

Big picture: I'm using PhotoLine to make an image, to be "printed" (engraved) on a beer glass. Something like this:

Image

The problem is that because the surface is not flat, the image appears distorted when viewed. That logo is actually a perfect circle (when measured on the physical glass), but appears as an elongated ellipse when viewed straight on (741 pixels wide and 847 high).

I am looking for some tool similar to the Distort tool, that allows images to be distorted in a non-linear way. In particular, to print on a cylinder, I would like some kind of arcsin(x) transformation Distort, that leaves y-coordinates unchanged. The left and right edges need to be stretched more than the center. EG, something that does this:

Before:
Image

After:
Image

Any suggestions?
User avatar
Hoogo
Betatester
Posts: 4033
Joined: Sun 03 Jul 2005 13:35
Location: Mülheim/Ruhr

Re: Custom Distort for printing on non-flat media

Post by Hoogo »

Had a similar problem when I recreated the stencils of my bike, just the opposite way.
I pasted squared paper to the tubes, took a photo, then used the distort tool to turn everything into squares again.

For a moment I was also thinking about a more perfect tool, but then I considered focal length and didn't bother anymore. Good enough was simply really good enough, I could print, test and correct.

If you're looking for something perfect, then you'd have to consider the distance of the viewer. If you can't tell the distance, then a photo of wrapped squared paper and some manual distortion should be good enough.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
User avatar
shijan
Mitglied
Posts: 1573
Joined: Mon 23 Dec 2019 15:21
Location: Ukraine

Re: Custom Distort for printing on non-flat media

Post by shijan »

There is a Effects -> Effect Filters -> Projection -> Preset: Cylinder
Is it creates perspective in the way you need?
Image
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
maho
Mitglied
Posts: 103
Joined: Sun 18 May 2003 02:02

Re: Custom Distort for printing on non-flat media

Post by maho »

Thanks for the responses, guys.

Hoogo - My problem is actually a bit harder than what I originally described, as my glasses are in the form of a conical frustum rather than a cylinder. The transformation I need is:

x' = R(1-y/H)*arcsin(x/(R(1-y/H))
y' = y (unchanged)

I am sympathetic to the idea of just settling for "good enough" rather than trying to make it "perfect". As you mention, it is only perfect if viewed from a particular distance and a particular angle.

I can't seem to find a way to transform in a non-linear fashion using the Distort tool.

shijan - Thanks for pointing out the Projection menu, which I had never used before. Those effects are really cool. Unfortunately, none of them have the transformation that I need to print on my glass. Conceivably it could be implemented as a custom Rotation file (.rot file), but I don't know how to do that.
Martin Huber
Entwickler
Entwickler
Posts: 4186
Joined: Tue 19 Nov 2002 15:49

Re: Custom Distort for printing on non-flat media

Post by Martin Huber »

maho wrote: Sat 26 Nov 2022 18:35 I can't seem to find a way to transform in a non-linear fashion using the Distort tool.
You can non-linearly change the content of a layer by changing the helper points:
DistortTool.png
You can set a precise precision by double-clicking a point. In the position dialog, you can also insert calculations, so you can simple append a "+ 50" to shift a point by 50 units.

Martin
You do not have the required permissions to view the files attached to this post.
User avatar
Hoogo
Betatester
Posts: 4033
Joined: Sun 03 Jul 2005 13:35
Location: Mülheim/Ruhr

Re: Custom Distort for printing on non-flat media

Post by Hoogo »

I hope we're all talking about the same distort... There are some distort filters within Effects, there were some misunderstandings about that in the past.
Distort.png
You do not have the required permissions to view the files attached to this post.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
User avatar
shijan
Mitglied
Posts: 1573
Joined: Mon 23 Dec 2019 15:21
Location: Ukraine

Re: Custom Distort for printing on non-flat media

Post by shijan »

Yep, it is Distort Tool in Toolbox
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
maho
Mitglied
Posts: 103
Joined: Sun 18 May 2003 02:02

Re: Custom Distort for printing on non-flat media

Post by maho »

Thanks Martin, using the Distort Tool the way you suggest looks very promising- I tested it on paper. I'm going to test it on the laser tomorrow.

Is the Distort Tool available as an Adjustment Layer as well? That would be very helpful.
Juan
Mitglied
Posts: 615
Joined: Thu 06 Oct 2011 08:08

Re: Custom Distort for printing on non-flat media

Post by Juan »

maho wrote: Tue 29 Nov 2022 04:41 Is the Distort Tool available as an Adjustment Layer as well? That would be very helpful.
Agree.
User avatar
shijan
Mitglied
Posts: 1573
Joined: Mon 23 Dec 2019 15:21
Location: Ukraine

Re: Custom Distort for printing on non-flat media

Post by shijan »

Probably Distort can't be Adjustment Effect because it is a Vector Effect, so same as all other vector effects you can enable/disable/edit it in Layer Attributes:
Image
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
User avatar
russellcottrell
Mitglied
Posts: 254
Joined: Sat 26 Jul 2014 10:13
Location: California

Re: Custom Distort for printing on non-flat media

Post by russellcottrell »

Quite a challenge! I think the only way to do it accurately is with scripting. I was going to write a PL script but I started testing the math on an HTML canvas and came up with this:
http://www.russellcottrell.com/blog/glassWrap.htm
It is very utilitarian (so far) but I believe it is accurate. You can select a file on your computer, then right-click and save the resulting image.
Actually, it is only accurate in the x direction; there should be a very slight curvature in the y direction, but it probably is not significant. Will look into it.
User avatar
shijan
Mitglied
Posts: 1573
Joined: Mon 23 Dec 2019 15:21
Location: Ukraine

Re: Custom Distort for printing on non-flat media

Post by shijan »

Guess Distort Tool method suggested by Martin Huber produce sort of Linear transformation but not a true reversed cilindrical projection. So russellcottrell's method seems more realistic.
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Martin Huber
Entwickler
Entwickler
Posts: 4186
Joined: Tue 19 Nov 2002 15:49

Re: Custom Distort for printing on non-flat media

Post by Martin Huber »

shijan wrote: Sun 04 Dec 2022 15:46 Guess Distort Tool method suggested by Martin Huber produce sort of Linear transformation but not a true reversed cilindrical projection.
It is a 3rd degree polynomial, and yes, it is not a true reversed cylindrical projection.
User avatar
russellcottrell
Mitglied
Posts: 254
Joined: Sat 26 Jul 2014 10:13
Location: California

Re: Custom Distort for printing on non-flat media

Post by russellcottrell »

User avatar
Herbert123
Mitglied
Posts: 2201
Joined: Sat 12 May 2012 21:38

Re: Custom Distort for printing on non-flat media

Post by Herbert123 »

I would do this in a 3d App. Also because the shape on which the graphic is projected may not have a smooth surface and attempting to convincingly deform a decal along an uneven surface is a big hassle in my experience. Here is a quick Blender example:
muggy.jpg
You do not have the required permissions to view the files attached to this post.
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait