[solved] Applying Perspective to Grid Lines
[solved] Applying Perspective to Grid Lines
I am trying to generate a perspective grid image using the CARTESIAN GRID and PERSPECTIVE features. There is no problem with putting the grid itself into perspective. The actual line widths, however, are a problem. Whereas the lines (in this case) are relatively wide, they should become narrow in accordance with perspective "distance". This is not happening, however. There is no decrease in line width with perspective “distance”. I am using the following sequence of operations: EXTENSIONS → RENDER → GRIDS → CARTESIAN GRID → APPLY; followed by PATH → OBJECT TO PATH; followed by the DRAW BEZIER CURVES AND STRAIGHT LINES tool to draw the 4-node perspective trapezoid beginning with the lower left corner and proceeding clockwise; followed by PATH → OBJECT TO PATH; followed by selecting both images; followed by EXTENSIONS → MODIFY PATH → PERSPECTIVE. Has anyone been able to modify grid line width in accordance with perspective?
Re: Applying Perspective to Grid Lines
Hi.
The perspective transformation is out of the scope of the 2D transformation matrix inkscape uses on canvas.
Meaning you can only skew/scale/rotate/translate/mirror and combine those an object -in addition, do the same with the stroke attribute.
That is, making it impossible to add a varying stroke width with a perspective distortion to an object as per se. The stroke is added always to the transformed path segments after.
Also, there can only be 1 stroke attribute added to an object.
Which leaves no other way than to simulate the effect. The stroke needs to be substituted with some kind of filled path.
The most straightforward solution would be drawing the Cartesian grid, converting it to a single filled path and adding the perspective distortion atop.
But if you are after a 3D look -as if the strokes would be cilinders- there is no easy go. Easier to achieve the result in a 3D software, like blender.
The perspective transformation is out of the scope of the 2D transformation matrix inkscape uses on canvas.
Meaning you can only skew/scale/rotate/translate/mirror and combine those an object -in addition, do the same with the stroke attribute.
That is, making it impossible to add a varying stroke width with a perspective distortion to an object as per se. The stroke is added always to the transformed path segments after.
Also, there can only be 1 stroke attribute added to an object.
Which leaves no other way than to simulate the effect. The stroke needs to be substituted with some kind of filled path.
The most straightforward solution would be drawing the Cartesian grid, converting it to a single filled path and adding the perspective distortion atop.
But if you are after a 3D look -as if the strokes would be cilinders- there is no easy go. Easier to achieve the result in a 3D software, like blender.
Re: Applying Perspective to Grid Lines
Just to reiterate what Lazur said, (sorry Lazur) after the step PATH → OBJECT TO PATH you need to include the step PATH → STROKE TO PATH before doing EXTENSIONS → MODIFY PATH → PERSPECTIVE.
You probably will need to go back and forth with undos to make the stroke width wide enough to be not too narrow at the far end it might be best if you also select all the grid lines after the stroke to path and do a PATH → UNION
You probably will need to go back and forth with undos to make the stroke width wide enough to be not too narrow at the far end it might be best if you also select all the grid lines after the stroke to path and do a PATH → UNION
Your mind is what you think it is.
Re: Applying Perspective to Grid Lines
Thanks, but this procedure results in the grid lines being wider in the perspective background than in the perspective foreground.
Re: Applying Perspective to Grid Lines
Thanks, but adding the perspective atop the single filled path does not work.
Re: Applying Perspective to Grid Lines
It works for me the way I expect it to.... more or less. You can see that if the two endpoints are not level unpredictable results happen
Can you show me more and which version of inkscape and OS are you using? If you post in the help forum you can attach images etc. I have moved this topic so you can.
Steps
Create the grid by using the extension.
Ungroup until no more groups are showing in status bar (this is not because groups are bad but because a group may contain an object)
Object to path until only paths are showing
Stroke to path
Union all (not strictly necessary, you can group instead)
draw perspective guide
Perspective extension
if you keep the two endpoints horizontal you can see it works exactly as expected in the right side of the drawing which is actually a group of two paths transformed using the perspective EXTENSION
In any case if you only want the grid done the Perspective PATH EFFECT method is more useful, the left side of the drawing was done this way. It won't handle groups, so you will actually have to do the union step to reduce everything to a single path, but then you can interactively use the node tool to move the perspective envelope to where it is just right. As you can see I could not include the background color rectangle here so if I wanted that I would have to do it separately.
Can you show me more and which version of inkscape and OS are you using? If you post in the help forum you can attach images etc. I have moved this topic so you can.
Steps
Create the grid by using the extension.
Ungroup until no more groups are showing in status bar (this is not because groups are bad but because a group may contain an object)
Object to path until only paths are showing
Stroke to path
Union all (not strictly necessary, you can group instead)
draw perspective guide
Perspective extension
if you keep the two endpoints horizontal you can see it works exactly as expected in the right side of the drawing which is actually a group of two paths transformed using the perspective EXTENSION
In any case if you only want the grid done the Perspective PATH EFFECT method is more useful, the left side of the drawing was done this way. It won't handle groups, so you will actually have to do the union step to reduce everything to a single path, but then you can interactively use the node tool to move the perspective envelope to where it is just right. As you can see I could not include the background color rectangle here so if I wanted that I would have to do it separately.
Your mind is what you think it is.
Re: Applying Perspective to Grid Lines
Thanks, Druban. I followed your latest procedure. It works perfectly! Much appreciated.