regioncrop not working correctly

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 09 September 2009   #1
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.
Old 09 September 2009   #2
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?

"The Evil Monkey hiding in your closet."
Old 09 September 2009   #3
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
   theregion = box2 0 0 (renderwidth-1) (renderheight-1)
   render camera:$camera01 rendertype:#regioncrop region:theregion
Old 09 September 2009   #4
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?

"The Evil Monkey hiding in your closet."
Old 09 September 2009   #5
Originally Posted by PiXeL_MoNKeY: 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?
Attached Images
File Type: jpg onepixel.jpg (550 Bytes, 45 views)
Old 09 September 2009   #6
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
   render camera:$camera01 rendertype:#regioncrop
Old 09 September 2009   #7
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()
 viewport.setCamera c
 theregion = box2 0 0 (renderwidth-50) (renderheight-50)
 setRenderType #crop
 viewport.setregionrect 1 theregion
 max quick render 
 theimage = getLastRenderedImage()
 display theimage

Is this script elegant enough or will i run into unexpected difficulties?
Old 09 September 2009   #8
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 08:00 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.