View.write_image misbehaving

2017
bug
ruby

#1

Hello everyone. I have a strange bug in Sketchup 2017 (make, win 10)
I’ve just noticed that when you export a square view with FOV 90, a dotted line border appears in the lower and bottom sides of the view. This breaks my Cubic panorama plugin.
Any ideas on how to fix it?

I’ve tried changing image size, aspect ratio, format, and setting view.line_width to 0, but the glitch appears anyway.
If you write the image with resolution up to 1020x1020, it comes out fine.
Above that the border starts showing, and as the resolution grows, it becomes thicker, and the gaps bigger.
At about 2000x2000, a square appears, as the lines are so thick and the gaps so wide that the lines meet in the center of the image.
At 2040x2040 the glitch is gone, and its back at 2041x2041.
Curiously, at 4080x4080, there is no glitch.
This is strange. Why do those resolutions work? Why don’t the others?

Here is my test code.

model=Sketchup.active_model
view=model.active_view
cam=view.camera            
pos=cam.eye

newFov=90
newAR=1.0
newIW=24

shadowinfo = Sketchup.active_model.shadow_info
shadowinfo["UseSunForAllShading"]=true

#face front
newTarget=[pos.x+1,pos.y,pos.z]
newUp=[0,0,1]
#set camera
cam.set pos, newTarget, newUp
cam.fov=newFov
cam.aspect_ratio=newAR
cam.image_width=newIW   

keys = {
 :filename => "test2017a.jpg",
 :width=>2048,
 :height=>2048,
 :antialias=>true,
 :compression => 0.6,
}
model.active_view.camera=cam
model.active_view.write_image keys 

And the resulting image

I’ve written about this in sketchucation, but i repeat the post here hoping that more people will see it.
Thanks in advance for any tips.


#2

Using SketchUp Pro 2017 Build 17.0.18899 on Windows 7, with NVIDA 980ti, we have the same issue trying to render a cube map. See attached image.

In addition to the resolution workaround above, a workaround we have discovered is that turning off anti-aliasing resolves the issue - if you can accept the jagged edges that is.

Of note, this is a complete showstopper for our customers using yulio.com’s SU plugin with 2017.


#3

This is an old build and release.

Please verify that the situation still exists in SketchUp version 17.2.2555 (Windows-64bit.)



#4

Confirmed it’s fixed on version 17.2.2555 (Windows-64bit). Thanks.


#5

The glitch still shows up for me in the version 17.2.2555 (SU Pro, Win10 - 64bit):

image

My parameters:

fov = 90
ar = 1.0
iw = 24
antialias = true
compression = 1.0
transparency = true

Modifying the above parameters the glitch changes, but does not disappear. I have observed that the glitch is not only dependent on the image size, but also on the model/view, e.g.:


In the case A, the glitch is gone in a 2040x2040 image (top-left), but not in the case B for the same size (top-right). On the other hand, the glitch is gone in a 2020x2020 image in the case B (bottom-right), but not in the case A (bottom-left).