From my testing scale seems to work. It doesn’t create a new geometry but instances existing. I’m wondering if the normals won’t get messed up though.
Maybe the Collada format specifically forbids scaling by a factor less than 0? Scaling to negative would cause faces to be flipped because it reverses the winding order and they would need to be re-flipped when drawn to the screen. SketchUp handles this natively but it’s possibly not allowed in the Collada specification.
Just thinking out load.
@alexfevery, what strikes me as very odd is (according to your experience with both methods) that SketchUp would allow the existence two identical looking instances, even showing them as such in ‘Entity Info’ but in fact they appear to be not. The mirrored one then seems to be different from the flipped one.
I can imagine the exporter is developed to not being capable of handling flipped instances. But where does SketchUp ‘hide’ its information to distinguish between a flipped instance and a scaled (-1) instance.
It’s somewhat scary if we (the SketchUp users) aren’t aware of this, thinking they are the same.
(reset scale and scale definition is available to both the flipped and the mirrored instance)
I took a quick look at the Collada 1.4.1 specs. Transform elements include
The spec for scale says it consists of three floating point values for the scaling of the x,y,and z axes. It says nothing about restrictions on the values (such as positive or non-zero). So I have to agree with @TIG that this behavior results from the way the exporter was written, not from Collada per-se.
It’s interesting that the matrix element is a 4x4 that could be generated directly from SketchUp’s representation, the only possible issue being row vs column dominant ordering (I didn’t check whether they are the same).
I have loaded up the model in 3DS max after using the -1 scale technique and the mirrored object normals are correct. In fact everything seems fine with the model. It is the same mesh with a reflection matrix transformation applied.
Is there some difference between flipped and -1 scaled components under the hood in sketchup that would cause the collada export to be incorrect? If not should we submit this as a bug?
And if so, how would this affect using SketchUp itself? In Dynamic Components perhaps?
People have previously noticed that there may be some internal details of Transformations that are not exposed via the Ruby API or the SDK. For example, SketchUp seems to remember that a Transformation was created explicitly as an Identity vs being an Identity based on values. Speculation is that there is some undocumented optimization involved.
Regarding flip vs -1 scale, I did the following experiment: I created a component and made two copies of it. I flipped one copy along red and scaled the other copy by -1 along red. Then I compared the matrix representations of their Transformations using the Ruby API. The part of the matrix that determines scaling was identical (basically an Identity with -1 in the first element). But the experience reported here indicates that the Collada exporter does distinguish between them, which as @Wo3Dan says, suggests there is another secret internal flag.
I suppose one could quibble about whether representing the same geometry in two ways, one more efficient than the other, is a bug or just a quirk.
Perhaps something here ?
I just did an experiment myself with Collada. I created one component, made one copy that I flipped (using SketchUp’s flip command) and one that I scaled to -1 (using scale tool).
When opening the .dae file in a text editor there was 2 “component definitions”/nodes by the same name as that of mine in SU. One was referenced by the original un-flipped instance and one by both the flipped ones, regardless of how they were flipped.
I compared these two “component definitions”/nodes and their only difference was the order of the vertices of the mesh. However when manually changing the instances to all reference the same definition the face orientation didn’t change as I had expected. They seem to contain the same data, just differently formatted.
Bottom line, I think this is a quirk of the Collada exporter. It seems however that you can just manually replace the reference and purge the definition you don’t need.
My models are complex and I cannot keep track of which components have been mirrored using -1 scale vs flip. I either need a way to tell in sketchup which method was used or a plugin that converts them from flip to -1 scale in the collada export. I can’t sort through this massive collada file by hand trying to look for duplicate components.
my OpenGL app depends on being able to identify instanced components by reading the collada file. So is there really no way to make sure before I export?
My experiment suggest there is no difference in flipping and scaling to -1. They seem to be identical and it seems the collada exporter is to blame for creating unique definitioons/nodes. However both definitions in the collada file have the same name property (the component definition name). Perhaps you could write a script to clean up the collada file by changing the references and purging the unused definitions?
That’s just it, "they seem to be identical". But apparently they are not. So how is the exporter to blame? Somewhere hidden in SketchUp are the differences between both mirrored instances.
How would they not be? In my test the exporter re-used the same definition for the instance that was flipped using flip and flipped using scale -1. No difference between flip and scale -1, nothing exposed in the Ruby API and no difference in how they are handled by the exporter.
However the exporter created a separate definition for the flipped and non-flipped instances which is a behavior no one can explain.
Okay, after further testing I think I understand the problem. When you use “flip along” you are only flipping on one axis. when you use scale -1 you are flipping on 2 axis or even 3 axis
If you use “flip along” red and then “flip along” green the instancing works again.
Conversely if you do -1 scale but only on one axis instancing breaks. If you -1 scale on 2 axis instancing works again, and -1 scale on 3 axis it also works.
a possible reason instancing breaks is because when you only mirror on 1 axis it will reverse the normals. mirroring on 2 axis will keep the same normals, and mirroring on 3 axis will cause the normals to reverse again.
Perhaps since the normals are reversed when mirroring on an odd number of axis sketchup refuses to instance those components(for some reason it still instances a 3 axis scale even though it breaks the normals).
The applied matrixes are as follows:
(3rd from left) Identity(no mirror): 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1
(2nd from left) Mirror along red: 1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1
(4th from left) Mirror along red and green: -1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1
(1st from left) Mirror along red green and blue: -1,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,1
In an earlier post you said that scaling (once) by -1x did the trick for you.
What you are saying now is that you need to scale twice for the instance to work again properly (through the exporter I guess)
All I was saying is that flipping and scaling by -1x needs to lead to exactly the same mirrored result by SketchUp before the instance is handled by the (or any) exporter. It is not the task of the exporter to filter out seemingly equal mirrored instances that are achieved by different operations. Nowhere in SketchUp there is any mentioning of differences between mirrored instances due to different operations.
Earlier I was scaling on 2 axis by using the corner grabber. I hadn’t thought to try scaling on only one until recently.
Flipping twice on different axes are the geometrical equivalent of rotating 90 degrees along the third axis (given they are all perpendicular). Flip twice and the geometry isn’t mirrored, just moved.
So the exported might have treated instances of both operations the same: both operations in SketchUp that lead to mirrored instances will be made unique instances after exporting. That would indeed be something to be corrected in the exporter and would have nothing to do with in SketchUp.
Scaling in two directions at once by -1;1 or (-1,1) is like scaling in just one direction due to one value being equal to 1
The result is a mirrored selection.
See attached image and note the component’s axes of all the instances:
That is exactly what my experiment 10 days ago suggested. Out of 3 instances, one original, one flip-mirrored and one scale-mirrored two definitions were exported. One definition was used by the original and one definition was just by both the mirrored instances, regardless of how they were mirrored.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.