Setting render border coordinates

Blender has the ability to limit the scope of rendering – outlining a region the special render border and checking the Border checkbox on the Render – Dimensions tab in Properties window. If such frame is set – Blender render only a limited area of the image.

Render border
Render border

There are two ways to set render border via the Blender API:

  1. With the view3d.render_border operator:

This operator is used in the 3D VIEW context:

Border coordinates countdown starts from the top-left corner of all window (0,0) and ends in the lower-right corner with values correspond to the window size.

Border region coordinates for render_border operator
Border region coordinates for render_border operator
  1. With modifying scene properties – maximum and minimum border boundaries relatively to the rendering camera view:

In this case, the render border coordinates set as a percentage ratio to the resolution of the rendering scene (camera view). The render width and height are equal to one unit, and the render border coordinates are set as a proportion of it.

Render border region relatively camera view
Render border region relatively camera view

In both cases, to activate render border usage the Border checkbox turns on with:

 

0 0 votes
Article Rating
Subscribe
Notify of
guest

6 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Rombout Versluijs
Rombout
6 years ago

Hi there do you know how to get the coordinates from the render border when its in 3dview. I know how to set it and but in need to coordinates for a different render engine. I use a different engine and with draw_gl i then draw that image in the viewport.

Nikita
6 years ago
Reply to  Rombout

Hi!
You can get render border coordinates of view3d border through:
bpy.data.screens[‘Default’].areas[number_of_3dview_area].spaces[number_of_3dview_space].render_border_min_x
for example it may be:
bpy.data.screens[‘Default’].areas[3].spaces[0].render_border_min_x

Rombout Versluijs
Rombout
6 years ago
Reply to  Korchiy

OKay great, this info is hard to get. Nobody seems to be interested in that data. I couldnt see the correct data cause in Hiver info is wrapped.
So the others are render_border_min_y etc etc

Thanks hope ill manage to find correct areas and spaces. Not sure why they dont use the same as the other but simpler reference

Nikita
6 years ago
Reply to  Rombout

This is the problem of the right context. If you execute your operator from the window with right context, for example you create a button in T-panel of 3d-view window, you can use the simple bpy.context.area.spaces.active to have the required area and space. But if you try to execute this comman from, for example python-console window, you will have an error. So, if you are sure, that the context is right, you can use bpy.context. If it is not so, you will hav an error or you need to rewrite the context.

Rombout Versluijs
Rombout
6 years ago
Reply to  Korchiy

Thanks again, i got it working how i want it to work. Now i need to work a bit on getting it pixel perfect. Think i need to check functions and see where i can add int.

I got both function of render border now working, from camera as well as 3dview.

Thanks man this really helped. I really had been googling for couple hours

https://www.dropbox.com/s/l6ave3o4x1txq6v/Screengrab_IRmode_v3d-mode.png?raw=1

Rombout Versluijs
Rombout
6 years ago
Reply to  Korchiy

I found this, area.spaces.active, which is way shorter and i dont need to make 2 loops