PDA

View Full Version : regioncrop not working correctly


Wheiraucher
09-06-2009, 12:01 PM
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.

PiXeL_MoNKeY
09-06-2009, 07:51 PM
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

Wheiraucher
09-06-2009, 10:18 PM
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

PiXeL_MoNKeY
09-06-2009, 10:26 PM
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

Wheiraucher
09-06-2009, 10:50 PM
Question is the output one pixel larger? Or is it the correct size with a row of black pixels?

It is the correct size, but with a row and a column of black pixels. Can you reproduce the effect on your computer?

Wheiraucher
09-06-2009, 10:56 PM
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

Wheiraucher
09-07-2009, 09:24 PM
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?

CGTalk Moderation
09-07-2009, 09:24 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.