Perspective correction (or architectural vertical straight lines)

Hello everyone. In the making of a broader toolset addon, I stepped into this little feature that is often needed (as users coming from the other software that ends with “StudioMax” know… yeah, “Camera Correction Modifier” sort of…)

but it looks like it’s hard to find a solution or a script: so I made one, and now I’m sharing it.
This little addon adds a panel in the camera properties. It just has a “Perspective correction” button that makes exactly what you think: the camera X Rotation and Y Shift are changed so that the horizon doesn’t move, but the vertical lines become straight, as often needed in architectural shooting.

Here it is:

Perspective_correction.py (2.7 KB)

Hope you find it useful, cheers!

14 Likes

cool thanx ! make a github for your scripts. maybe the addon ui would be better in the camera settings instead of sidepanel

2 Likes

You’re right. I prefer your solution too, so here is the update (see first post)

4 Likes

Hi lsscpp,

this is a great little Timesaver. Many thanks.

I have a Warning Message in the Console, how can I fix it?

Warning: 'PT_perspective_correction' does not contain '_PT_' with prefix and suffix
2 Likes

Oh that’s nothing too bad, just a warning about not respected naming convention in Blender coding.
Fixed and updated in 1st post

And by the way

I renamed that class
PT_perspective_correction
to
CAMERA_PT_perspective_correction

1 Like

Perfect!
Many thanks lsscpp.

1 Like

this is also good for cartoon backgrounds … often you dont wanna have the heavy 3 point perspective but just a 2 point perspective

1 Like

Blender 3.1.2 working ?

1 Like

Perfect working for version 3.1.1,so I guess it’s okay for 3.1.2 too.
Truly commendable~

1 Like

So how does it know what angle it needs to correct?

Perhaps you should append it to the main camera panel vs using its own panel

1 Like

Have you actually tested this with multiple angles? When I look at the code, it has one hardcoded value. I wonder if this works on different angles because it will use the same value on all

1 Like

Ow i see now, it check the rotation angle and use this in the shift value. That’s clever!

2 Likes

I found that magic number, which i guess it’s arbitrarily hardcoded in Blender. No digging in the code, i swear: it was just a matter of trial and error. :wink:

2 Likes