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.
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.
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.
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.
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. @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.)
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
Brilliant, you’ve cracked it, thanks so much
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
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…!
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 ?
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.
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.
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.