[Closed] regioncrop not working correctly
Hi everyone
I realized that somethings wrong with regioncrop. look at the code i wrote. It should render exactly the same image as a render command without cropping. However, it returns an image that is exactly one pixel too high and wide. This one pixel renders as a black line right, and at the bottom (best turn environment to white to see it). This is really bothering me. And the worst part is that i get it with any numbers in the crop dialog, always two black lines. How does this happen, and how can i overcome the problem? Is it a bug?
c = freecamera()
viewport.setCamera $camera01
render camera:$camera01 rendertype:#regioncrop region:#(0,0,renderwidth,renderheight)
Curiously, the problem does not happen when i manually set the activeviewport to the camera and run only the last line of code.
Help is very appreciated.
Maybe you can add a redrawviews() to force it update the view prior to rendering. What about if you try supplying a Box2 instead of the array does that work?
-Eric
oh, i was so excited when i saw this reply and the redrawviews command, but unfortunately, it wasn’t the solution. Even a forcecompleteredraw led to no change. But please continue thinking about the problem, i urgently need a working solution.
c = freecamera()
viewport.setCamera $camera01
forceCompleteRedraw()
theregion = box2 0 0 (renderwidth-1) (renderheight-1)
render camera:$camera01 rendertype:#regioncrop region:theregion
Question is the output one pixel larger? Or is it the correct size with a row of black pixels? Just trying to figure out the problem. What about using EditRenderRegion Interface to set the desired area, and then submit a region render without the region: parameter set?
-Eric
It is the correct size, but with a row and a column of black pixels. Can you reproduce the effect on your computer?
tried a different approach but got the same awkward result.
c = freecamera()
viewport.setCamera $camera01
theregion = box2 0 0 (renderwidth-1) (renderheight-1)
viewport.setregionrect 1 theregion
forceCompleteRedraw()
render camera:$camera01 rendertype:#regioncrop
ok, guess i found a workaround that works. Instead of using render() and a defined region. I use the max quick render command. Seems to be the only way to get a region render without black lines. very weird problem, though…
c = freecamera()
renderscenedialog.close()
viewport.setCamera c
theregion = box2 0 0 (renderwidth-50) (renderheight-50)
setRenderType #crop
viewport.setregionrect 1 theregion
EditRenderRegion.UpdateRegion()
forceCompleteRedraw()
max quick render
theimage = getLastRenderedImage()
display theimage
Is this script elegant enough or will i run into unexpected difficulties?