Strange image behaviours in SketchUp

Hoping someone can help.

After years of using SU with no issues, imported images now seem to ‘disappear’ when placed directly onto object faces. Whether they’re transparent or solid background, I now have to pull images away from the desired object plane (by 5mm or so) in order for them to be visible, it’s quite maddening.

This isn’t rendered scenes, it’s within the SU modelling environment. Any ideas what’s going on? It’s been a problem for many months, and over multiple version updates. It’s not an intermittent occurrence, it’s every import of a bitmap image, jpg, png or tiff, where ‘use as image’ is selected. Images imported ‘as texture’ behave as expected, no visibility issues.

I’m on macOS Monterey, SU Pro Version 23.1.341, I use images created in Photoshop - RGB jpegs and transparent png. Any help appreciated.

See example, the bottom row of 2 images have been pulled away from the cube in order to be visible.


SKU image behaviour.skp (255.1 KB)

1 Like

I tried the file in older versions of SketchUp, including 2017. It looks the same, nothing seems to have changed.

This sounds like standard z-fighting behavior. Applying an image as a texture will place it on the face. Placing an image in the same plane as a face will cause z-fighting and the image will show half the time and the face the other half the time. You need to have images stand off the face to be seen or cut a hole in the face to present interference. The severity of the z-fighting depends on the distance between the face and the camera. This is how SletchUp has worked since at least V7, as far as I remember!

Thank you, yes, what you describe is exactly my experience, but only in the last 6 months-ish. I used to be able to import directly onto the face of an object without the need to ‘stand off’, as you say. ‘Z-fighting’ is a new term to me.

The attached example is a file created in July '23 in SU Pro. On the right hand side is a transparent png imported at the time the file was created (directly onto object face, same plane). On the left hand side (selection highlight in blue on screenshot) is the exact same png file, imported today, which is now invisible, this is now the default behaviour for all image imports. I’m baffled.


TTROTC 10.skp (226.2 KB)

1 Like

I see what you are saying.

I noticed the visible image is glued to ‘something’ and if you unglue the image, the two images will perform the same, meanig both will disappear. I don’t know how I would go about re-glueing the images.

What’s more, if you look at the reverse side of the dark face you’ll see both unglued images perfectly from all directions.


2 Likes

Interesting, I never noticed the ‘unglue’ option before. Doesn’t mean much to me but it’s something to investigate. Thanks.

One of the characteristics of the “glue” property is that the image take visual precedence over the surface even though they share the same plane.

When you initially import a raster as an image object into SketchUp and place it on a Face, SketchUp automatically adds the “glue” property to the image.
I can confirm: The versions before 2023 can glue it to Group, Componentinstance, or to other Image, but the current (latest) v23.1.340 on Windows that ability are no longer works. And the insertion point of image is jumping to the image center, instead stays on the lover left corner when you release the image. So, for sure something has been changed (bugged) at 2023. :blush:

Workaround 1: The “glue” property can be achieved by going to the editing context of Group or Component containing the face and place it to face.

Workaround 2: A small code snippets or Extension can be written to glue Image to Face, to Group, to Componentinstance, or to other Image.

Solution: In the hand of Sketchup dev team. :wink: @TheOnlyAaron

(Note: The copy paste image to other place does not initiate the addition of “glue” property in any case. You need to import again, or drag’an’drop from File explorer.)

V 2021
img_glue

V 2023
img_no_glue

2 Likes

Just to see, here are the quick & dirty: Select the Image and the Group (or ComponentInstance, Face) and copy-paste code snippets to Ruby console and hit Enter (Return).

module DezmoGlueImg
  extend self
  def msg
    t0 = "Please Select only two drawingelements:\n"
    t1 = "\nAn Image + Face or ComponentInstance or Group or Image"
    UI.messagebox(t0+t1)
  end

  def gluable(dwge)
    dwge.is_a?(Sketchup::Image) ||
    dwge.is_a?(Sketchup::Group) ||
    dwge.is_a?(Sketchup::ComponentInstance) ||
    dwge.is_a?(Sketchup::Face)
  end

  def glue_img
    sel = Sketchup.active_model.selection.to_a
    return msg() unless sel
    return msg() unless sel.size == 2
    img = sel.grep(Sketchup::Image).first
    dwge = (sel - [img]).first
    return msg() unless gluable(dwge)
    img.glued_to = dwge
  end
end
DezmoGlueImg.glue_img

img_glue_snippet

Brilliant, you’ve cracked it, thanks so much :+1:
Both your workarounds work as described for me on macOS. Is it possible to make workaround 2 an extension to permanently revert to the original default glue property for imported images? Beyond my skills, but I’m curious.

Anyway, hopefully the older glue property behaviour is reinstated at some point, until then, many thanks for your code snippet solution :slightly_smiling_face:

1 Like

From a programming point of view, it is unfortunately quite difficult to select (pair to) the drawingelement (Group or component instance) to which the image should be glued, if you want to do it on a whole model at once.
An interactive tool - the user select an Image then the group to be glued to, one after other - , perhaps I will be able to create, but I need to think about the details… cant promise anything more right now, definitely I cant give a deadline, or at all…!

1 Like

After solving the glue-to issue… it occurs to me, why not place the image flat and then explode the image and then make it into a component, edit the definition so that it glues to any surface [perhaps cutting a hole depending on what it shows]… then select from the Components-Browser and place as many instances of it as you like, which will glue to what ever they’re placed onto ?

1 Like

If you peek beneath the covers using Ruby, you will find there is some very strange stuff going on with regard to Images!

It turns out that the raw data for an Image is captured in a special kind of ComponentDefinition (CD) in the model’s DefinitionList. The Entities collection of the Image’s CD contains a Face and its Edges, presumably the size of how the image was imported. You can detect this kind of CD via the ComponntDefinition#image? query on it. You can copy and paste an Image via the GUI and it will show up as another instance of the same CD. If you import the same image file a second time, it gets a separate CD and a sequential name such as Image#2. The CD also has a Behavior object that determines things such as how new instances of the Image are supposed to snap to other objects. Initially it is set to SnapTo_Arbitrary, meaning that the Image should snap to any Face or object. But, at least in my tests, this doesn’t work on 2022 or 2023. The snap outline shows up as you place the copy, but the copy doesn’t glue to it. I suspect some subtle code change in 2023 caused this to also happen when the Image is first imported.

Edit: I should mention that, like Groups, the Images don’t show up in the Components window.

1 Like

Sounds good, but
you have got flickering with that, while the “original” Image glued_to don’t… (Don’t ask why :blush: )
flicker

That’s why I suggested using cut-hole property too ?
But of course it’s only good for face, not for groups/instances…

1 Like

I see in the API docs that Image#glued_to and Image#glued_to= were implemented in the 2021.1 release.

At the same time, these methods were also implemented upon the Group class and a gluing setter overload to ComponentInstance#glued_to=, so they were making changes in the gluing code just before version 2022.


In the 2023.0 Release Notes we have …

  • Placing and resizing an imported image performance greatly improved.

  • It is now possible to immediately convert an imported image to be a Group or Component from the contextual menu.

… so again they were into the gluing part of the code.

I have had the same experience. In previous versions the image placed on the surface without any Z-fighting @TheOnlyAaron. Something has definitely changed @colin have you tried in SketchUp 2020?

I would like to request that this be looked into and have functionality restored to the one we experienced in previous versions as described in the original post.

Thank you.

Definitely not the case since I’ve been using it successfully since 2016 at least without having to stand off or see any z fighting.

Thanks this does work by placing it on a raw face geometry inside the component.

1 Like