Re: Patch rendering
Status: Alpha
Brought to you by:
cwalther
From: Christian W. <cwa...@gm...> - 2011-11-30 20:49:15
|
James C. Wilson wrote: > So I've got a potential bug relating to layered patch rendering... > > I've got a slide node with a blank, opaque background. Over the > background there are two patches: One, is a wider-then-background image > which scrolls back and forth over the background. The second, is a PNG > with a part in the middle made transparent, so you can see the scrolling > image behind it. It all works fine, however, I can see a seam, one pixel > wide, running on the left and right edges of the patch, peeking down > onto the scrolling image and the opaque background. > > This seam is also present in another node where the patch underneath is > smaller then the background and not scrollling. > > If the cause of this is well known I'd appreciate a heads-up. I've > already checked the PNG to see if I accidently created this seam myself > while editing; that wasn't the case. You are probably seeing what is described in the manual, section 2.9 "Patches", as follows: Subsection "Image": > For technical reasons (interpolation), the outermost pixels along > each edge of a patch image should either be identical to the > corresponding pixels of the background image or fully transparent. In > other words, the patch image should be one pixel larger on each side > than absolutely necessary. Otherwise, the patch may appear cut off > along some edges. Subsection "Advanced Placement in 3D": > Width and height of the patch can also be specified in normalized > units using the nw and nh parameters. Unlike w and h, which give the > total width and height of the patch, these parameters describe the > visible width and height. On panoramas and slides, this is one patch > pixel less than the total width or height because a margin of half a > pixel is cut off each side of the patch, so that the centers of the > outermost pixels lie on the edge, to enable a bilinearly interpolated > patch to blend seamlessly into a bilinearly interpolated background > image. This is similar to what’s done with the cube faces as > described under “Making Cubic Panoramas” in section 2.8 “Cubic > Panoramas”. You should be able to see this if you make your window so big that you can clearly see the interpolation of the pixels (at least 3 or 4 times as big as the original size of the background image). The upshot of it is that to do what you want, the covering patch must be strictly wider (not the same width) as what it's supposed to cover. In the wider-than-background case, that patch must be wider-than-background too. (Because you're stacking multiple patches rather than just putting a patch on the background image, replace "background image" in the first manual quotation with "whatever is behind it".) If you come to the conclusion that this is not what you're seeing, then it's entirely possible that we don't handle wider-than-background patches properly. I don't think I have ever tested those. In that case I would appreciate a complete reproducing example. It has recently occurred to me that it could under some circumstances be useful to be able to display only a (movable) subrectangle of an image on a patch. That would remove the need for a wider-than-background patch (and for covering up most of it) in your case too, I think. -Christian |