This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Details

When rendering an image, there are actually three aspect ratios involved:

1) The aspect ratio of the camera, set with the up and right vectors.

2) The aspect ratio of the rendered image, set with the +W and +H parameters.

3) The aspect ratio of the pixels in the intended target medium. While this is very often 1:1, it’s definitely not always so (anamorphic images are common in some media, such as DVDs).

The aspect ratio of the camera does not (and arguably should not, although some people might disagree) define the aspect ratio of the image resolution, but the aspect ratio of the image as shown on the final medium. In other words, it defines how the image should be displayed, not what the resolution of the image should be.

This of course means that the aspect ratio of the target medium pixels has to be taken into account when specifying the image resolution. If the target medium pixels are not 1:1 (eg. when rendering for a medium with non-square pixels, or when rendering an anamorphic image eg. for a DVD), the proper resolution has to be specified so that the aspect ratio of the displayed image remains the same as the one specified in the camera block.

This isn’t generally a problem. It usually goes like “my screen is physically 4:3, so I design my scene for that aspect ratio, but the resolution of my screen is mxn which is not 4:3, but that doesn’t matter; I just render with +Wm +Hn and I get a correct image for my screen”.

However, problems start when someone renders an image using an image aspect ratio / pixel aspect ratio combination which does not match the camera aspect ratio. By far the most common situation is rendering a scene with a 4:3 camera for a screen with square pixels but with a non-4:3 resolution (most typically 16:9 or 16:10 nowadays). The image will be horizontallystretched.

In a few cases the effect is the reverse: The scene (and thus the camera) has been designed for some less-typical aspect ratio, eg. a cinematic 2.4:1 aspect ratio, but then someone renders the image with a 4:3 resolution. The resulting image will be horizontally squeezed.

In a few cases this is actually the correct and desired behavior, ie. when you are really rendering the image in an anamorphic format (eg. for a DVD). However, often it’s an inadverted mistake.

Some people argue that this default behavior should be changed. However, there are also good arguments why it should not be changed. Some argue that POV-Ray should have more features (at the SDL level, at the command-line level or both) to control this behavior.

There are several possible situations, which is why this issue is so complicated. These situations may include:

- The scene author doesn’t really care what aspect ratio is used to render the image, even if it means that additional parts of the scenery become visible or parts are cropped away when using a different aspect ratio than what he used.

In this case the choice of camera aspect ratio should be up to the person who renders the image, and thus selectable on the command-line. However, he should have an easy choice of how changing the aspect ratio affects the image: Should it extend the viewing range, or should it crop part of it, compared to the original?

And this, of course, while still making it possible to render for an anamorphic format.

- The author wants to support different aspect ratios, but he wants to control precisely how it affects the composition of the image. Maybe he never wants anything cropped away within certain limits, but instead the image should always be extended in whichever direction is necessary due to the aspect ratio. Or maybe he wants to allow cropping the image, but only up to a certain point. Or whatever.

In this case the choice of camera aspect ratio should be up to the author, and thus selectable in the scene file, while still allowing some changes from the command-line.

- The author designed his scene for a precise aspect ratio and nothing else, and doesn’t want the image to be rendered in any other aspect ratio. Maybe he used some very peculiar aspect ratio (eg. something like 1:2, ie. twice as tall as wide) for artistic composition reasons, and wants the image rendered with that aspect ratio, period.

Perhaps the author should be able to completely forbid the change of camera aspect ratio in the command-line.

Of course anamorphic rendering should still be supported for targets with a different pixel aspect ratio.

This solution does not necessarily address all the problems described above perfectly, but could be a good starting point for more ideas:

Add a way to specify in the camera block minimum and maximum limits for the horizontal and vertical viewing angles (and if any of them is unspecified, it’s unlimited). Of course for this to be useful in any way, there should also be a way to change the camera and pixel aspect ratios from the command line.

The idea with this is that the author of the scene can use these angle limits to define a rectangular “protected zone” at the center of the view, using the minimum angle limits. In other words, no matter how the camera aspect ratio is modified, the horizontal and/or vertical viewing angles will never get smaller than these minimum angles. This ensures that the image will never be cropped beyond a certain limit, only extended either horizontally or vertically to ensure that the “protected zone” always remains fully visible regardless of what aspect ratio is used.

The maximum angles can be used for the reverse: They ensure that no scenery beyond a certain point will ever become visible, no matter what aspect ratio is used. This can be used to make sure that unmodelled parts of the scene never come into view. Thus the image will always be cropped to ensure this, depending on the aspect ratio.

I’m not completely sure what should be done if both minimum and maximum angles are specified, and the user specifies an aspect ratio which would break these limits. An error message could be a possibility. At least it would be a way for the author to make sure his scene is never rendered using an aspect ratio he doesn’t want. He can use these angle limits to give some leeway how much the aspect ratio can change, to an extent, or he could even force a specific aspect ratio and nothing else (by specifying that both the minimum and maximum angles are the same).

So in short:

- Add a “minimum/maximum horizontal/vertical angles” feature to the camera block. These can be used to define a “protected zone” in the image which must not be breached by command-line options.

- Add a command-line syntax to change the camera aspect ratio (which automatically obeys the “protected zone” settings). Could perhaps give an error message if the command-line options break the limits in the scene camera.

- Add a command-line syntax to specify a pixel aspect ratio other than 1:1. This can be used to render anamorphic versions of the image on purpose (iow. not by mistake).

This can probably be made backwards-compatible in that if none of these new features are used, the behavior could be the same as currently (or at least similar).

Angles are rather difficult to control, and problems with the many existing ways of specifying the camera viewport are likely. Therefore, instead of SDL statements to specify min/max angles, I'd propose to instead specify a "nominal camera viewport" the traditional way, and specify the "protected zone" and "maximum zone" dimensions relative to the nominal viewport's dimensions; i.e. a scene author might specify that e.g. the viewport is to be at least 0.9 = 90% as wide and 0.95 = 95% as high as the nominal viewport, and at most 1.0 = 100% as wide and 1.2 = 120% as high.

As for the pixel aspect ratio, I'd advocate specifying it indirectly via the display's aspect ratio, e.g. in order to render an image at 1280x1024 pixels resolution for a 4:3 display, the user would specify something like "-w1280 -h1024 Aspect_Ratio=4:3" to achieve the required pixel aspect ratio of 16:15. I guess for any given output medium the display aspect ratio is much more commonly known than the pixel aspect ratio.

With (1) and (2) the system is fully determined. To let others match the image size, supplying an INI file with a scene lets them do that. In particular the ability to have multiple sections in an INI file is useful for this (note to self: Is this feature implemented in the core code yet?).

After all, it should be kept in mind that POV-Ray is not a video viewer, but a rendering program. Users need and want control over the image they render beyond what the original author of a scene intended. As the scene is plain text, there is no way to prevent this, and it seems counter-intuitive to add obscure means to get what an author of a scene "wants" other users to do.

The main purpose of the feature request is not to give a scene author the means to limit what another person can do with his scene. The idea is to give the author tools to prevent his image from being accidentally rendered with the wrong aspect ratio. This is an actual problem. I haven't even counted how many renders I have seen of scenes/advanced/abyss.pov with a completely wrong aspect ratio (pretty much destroying the image).

It could be better if instead of -H & -W, the user got to specify either-H or -W and the pixel-ratio ( -P float ? or -PH integer -PW interger ?).

That way, the view would stick to the intent of the scene's creator (inunmodified SDL) and the picture would be fine for the display of thefinal user.

The issue would be the usage of image_width & image_height in SDL, theywould have to be gone.

If the final user wants to see more than intended by the file's creator,he would have, with that system, to open & edit the SDL.

Final note: I do not ask for the removal of -W or -H, but that insteadthe mandatory missing dimension should be provided by computation basedon pixel ratio and the provided dimension (and it might be convenient toprovide either of them to please the final user).On the same line, an explicit "view_ratio" in the camera might computethe up length from the right/angle size (and it might be a clearer cluefor the casual reader:

I basically agree with Grimbert. The idea of specifying the image aspect ratio in the scene file, and specifying only either width or height on the command line or in the ini file, already crossed my mind, too. Though I'd retain the image_height and image_width variables, as they might be useful for level-of-detail adjustments, or other special effects; I have already designed scenes myself that wouldn't work without.

The suggestion that instead of defining the width and height of the image to be rendered, the user instead defines the width only (or the height only), and then possibly defines a pixel aspect ratio (which defaults to 1:1), while the other dimension is determined automatically from the camera settings, is a good one and solves most of the problems described.

However, there may still be the possibility that the author of the scene would want to allow the view to be expanded or possibly cropped if a different image aspect ratio is defined, which the suggestion does not address. This may well be something one wants to support so that one could eg. render 4:3 and a 16:9 versions of the same scene (their difference being eg. that in the latter the horizontal angle of the camera is larger, so more scenery comes into view from the sides).

I agree that some solution for this feature request needs to be found. However, this should not involve an interaction between INI/command-line parameters and the SDL, as we can't have a case where the SDL interacts with the frontend code.