blender-renderborder
blender-renderborder copied to clipboard
Rounding issues - inconsistent coordinates
The dimensions of the actually rendered region are sometimes different then what I set in the properties. I suspect these are rounding issues, due to the render region being set with floating point numbers, while this addon only allows integer.
I wonder if this is fixable, because this addon is vital to my projects, and so far the only one that adds this feature. But the inconsistent dimensions leave me with a lot of clean up work.
Settings that reproduce the issue: Full render dimensions: 1200 x 600 Render border dimensions: (x,r,y,t) 812, 928,196,308
It should give an image of dimensions 116x112 But it gives an image of dimensions 116x113


Hi @MrTheRich,
thanks for your report. I guess this is a bug in Cycles X. If I render the given coords in Blender 2.8+, the output is 116x112 as expected (see the screenshot). I also tested if there are rounding issues in Blender 3+ and I could not find anything. I'll have to see what they've changed since then...
Cheers, Christian
Thanks for the quick response @p2or. I'm using blender 3.2.0 btw
If i render with eevee in blender 3.2.0 I get the same 113 pixel high result, instead of 112. So the issue is not with cycles.
@MrTheRich @p2or Hi, Actually i have been experiencing this similar issue right from the beginning. However, I never actually thought that it could be bug. I noticed that It gives this error and will not render video. But for single image it renders with any set dimension. I hope this gets resolved in upcoming version.
And @p2or Thank you for making this wonderful add-on. I find the ability to change camera dimensions quickly very productive.
@gitsamhub Ah, i have not try to render video yet, I render multiple frames single mode by script for my project. But it makes sense, for video encoding the dimension needs to be divisible by two.
@MrTheRich Well I am not really aware of technical things but, if I put settings as bellow it shows the error like this.
So, I am putting '1000 X 1000', but it shows '999 X 1000'.

@p2or I figured out the issue, though not yet the best solution. By converting from int to float, very small rounding errors are introduced. If the final size is only a fraction over the full number, blender will add an extra pixel.
I figured this out by showing unrounded files in the plugin. as you can see: the width is calculated a hair over 114, which leads to a render size of 115 pixels.


If i substract a fraction from the original numbers, the final result is correct:

I don't know what the proper solution is to solve this. maybe subtracting 0.01 by default after conversion from int to float. since blender will add that pixel back on.
But what if the final result is smaller than expected, like in the example of @gitsamhub, also I suspect you can't then be sure if that pixel is going to be substracted to the left or the right side of the picture, messing up the coordinates.
EDIT: a bit more information:

This might explain why the errors aren't always reproducible across machines, since those rounding errors are dependent on the architecture.
Temporary working 'solution'
Adding a small value to the normalized coordinates seems to fix the issue for so far i can test. The rounding with the conversion for feedback makes sure this small value is not additive over time.

This is not a sound solution, since technically you could still go wrong with render resolutions larger than 100k. But this is a quick practical workaround.
Also this is not thoroughly tested for all edge cases.