How does Sketchup decide which face is the front one?

sketchup
color
reversed_faces

#1

If I’m coloring in a bunch of faces with the paint bucket tool, it seems somewhat random which side of a face is designated as interior and which is designated as exterior.

I can be coloring a bunch of adjacent triangles (that triangulate some surface), without moving the model at all, and it will decide that some particular triangle or group of them are reversed from their neighbors. This seems really illogical.

In my opinion it would make sense if the side of the face that the user is looking at when applying the color were always designated as the front. But Sketchup does it some other way. Is there any logic or any way to predict which side will be designated as front?


#2

The front face is based on how the geometry was created. It does not change (front to back) based on how you are viewing the model. One thing you may try tis to select connected geometry, right click and choose Orient faces. If you have a good model with connected faces, this will orient all the faces to that all front faces are facing the same way.


#3

Keep in mind that faces have no thickness so even for something representing glass, you need to add thickness (with Push/Pull or other methods) so that the back faces are on the inside of the 3D volume.


#4

@TheOnlyAaron Okay, thanks for explaining. But where do I choose the geometry? That is, where do I find a menu in which I select “connected geometry?”


#5

Also, can anyone explain how Sketchup chooses (by default, without modifying geometry or anything) which face it will call the front?

Let me give an example of what I mean. This is a bit technical but probably necessary to talk about what’s going on so bare with me please.

Example:

I open a new document, delete the man, and then draw 17 polygons parallel to each other evenly spaced apart. There are parallelograms on the bottom and top and all the rest are hexagons. They are evenly spaced apart and all symmetric about the same vertical axis. I draw them in such a way that my lines are all created with the same orientation: going clockwise when viewed from the bottom.

Then I check out how their fronts and backs have been designated. Counting up from the bottom, polygons number 1, 3, 4, 6, 7, 8, and 10 have their fronts on the bottom while polygons number 2, 5, 9, and 11 through 17 have their faces on the top.

What sort of algorithm decided this? Is it just random?


#6

It isn’t random, it uses the ‘winding order’, or the order in which the vertices were created. i.e. Clockwise means reverse-face, Anti-Clockwise means front-face (or it may be the other way around.
If Sketchup sees that the edge joins an existing face, it will use the orientation of that face.


#7

Connected geometry isn’t a menu option, it just means geometry that is connected to the part you’re operating on. Any other faces that are connected to the one you’re telling to Orient Faces will switch themselves if needed, to match the one you chose.


#8

But what about when you draw many not connected polygons, why are most reversed and some not? For a moment it looked like ones below ground level were not reverse, but then one of them below ground was reversed.


#9

@colin Yeah, that is confusing me too. Actually the ground level is in the center at face number 9. So below ground level we have 2 facing down and 6 facing up. Then from the ground up we have 8 facing down and 1 facing up. It must be based on something else…

As far as the connected geometry, yeah I am drawing connected polygons. For instance, take 4 points that are not quite coplanar. If I draw lines connecting 3 of them, I’ll get a triangle. Then if I close in the other edges, I get another triangle and it is not necessarily oriented continuously with the first.

The second issue is more problematic to me, but I included that other example just to illustrate more weirdness.


#10

But I imported all my vertices simultaneously from a CSV file, then I connected my vertices in the same winding order throughout, specifically they were all drawn clockwise (when viewed from the bottom).


#11

Triple click will select all connected geometry.


#12

Yes, but how does this help? We’re talking about how to have front/back faces designated in a consistent way, rather than having to go in and edit them manually.


#13

If you have the normals in the import, or can calculate the expected normal from the winding order, you could flip the face in code…

						if normal != nil
							dot = face.normal.dot normal
							if dot < 0.0
								face.reverse!
							end
						end

#14

I don’t have normals in the import. I just imported a list of points that I plotted using the Point Gadget extension. It seems that people are saying the program does one thing, but mine is doing something else. Unless anybody has a better idea, I think this is a glitch, possible related to the program’s relationship with my operating system. I’m using a Macbook running OS10.11.


#15

I would recommend keeping this simple. Turn on the Monochrome FAce Style (from the View menu) as you create faces. If one pops up as gray (or whatever your back face color is set to), just right-click and Reverse Face.


#16

Yeah, that’s basically what I end up doing. But I guess I really have 2 questions. One is how to get my faces oriented correctly in the easiest way. The other is, why does Sketchup do these weird things changing face orientation?

I’m still on my trial period of the software, so I’m hoping to build some intuition about how it works. When I feel like it’s doing weird random annoying stuff it doesn’t exactly make me want to drop the $700!


#17

The way that SketchUp orients faces is very intelligent, if you are building up in a way that it expects geometry to be built. In your case (if I remember correctly is connecting a series of points together), SketchUp does not know what is the inside or outside of the surfaces, so it may not be correct.

Fortunately, right-click and Reverse Face is easy (or you can assign a shortcut key), or, if you end up with a “solid” model, you can use Orient Faces.


#18

Yeah, what I’m doing is importing a big set of vertices, then manually connecting them with lines in a certain way. Sometimes I need to do this by making isolated faces to be connected later. It sounds like that is what confuses the program.


#19

Is the import a topology mesh? In that case all the surfaces just need to be orientated ‘up’, I could send you a small script for that.
As I understand it, the importer is not creating the faces for you, only importing the points?
If you do indeed have points representing a triangle, it should be a simple exercise to write an importer to create the faces. Can you send a sample file of what you are importing?


#20

A follow up question to make sure I’m getting it right…

So the orientation of the faces is decided by 1. the orientation of neighboring faces in a connected geometry, and 2. the order in which the vertices were entered. Is that more or less right?

What seems odd to me is that it would go by the order the vertices were entered in, instead of the order the lines were entered in. In my case, the vertices are imported. It seems that this does not mean they all are entered simultaneously, but rather there are probably some tiny sub-microsecond-differences between their arrival time. And this is messing with the orientation.

If instead the face orientation were based on the order of lines, my faces should be oriented consistently, since I have been careful about that. From my perspective, the orientation of an n-dimensional cell should be determined by an ordering on the (n-1)-dimensional skeleton. For instance, if orientation of lines mattered, it would make sense to have them point toward the terminal point. Then, since orientation of faces matters, I feel it would make sense for them to be face away in the counterclockwise direction from line-making, where possible.

I’m interested in your comments. Thanks!