How does Sketchup decide which face is the front one?

sketchup
color
reversed_faces

#21
  1. is correct. 2. I’m not sure about.
    But there is an unfortunate edge case - if the face is created on the ground plane, then the face will be orientated down. I believe this was a decision made in the early days of Google SketchUp, or maybe predating Google, where it was assumed that any geometry created on the ground plane would then be pulled upwards.

Imported vertices cannot be entered simultaneously, they must be added sequentially. So they will always be added in the same order as specified in your file.


#22

Assuming you are importing topology (did you see my earlier question?) this script will orientate all faces within a selected group so that they are facing up. If the imported mesh isn’t grouped, you will need to group it first.
Paste into a suitably named. rb file in your plugins folder.

require 'sketchup.rb'

class OrientateUp

	def OrientateUp::orientate(group)
		normal = [0,0,1]
		group.entities.each { |e|
			if e.class == Sketchup::Face
				
				face = e
				dot = face.normal.dot normal
				if dot < 0.0
					face.reverse!
				end
			end
		}
	end
	 
	# this function returns true if the menu item should be displayed
	def OrientateUp::validate_entity
		sel=Sketchup.active_model.selection
		if sel == nil
			return false
		end
		if sel.length != 1
			return false
		end
		if sel[0].class == Sketchup::Group
			return true
		end
		return false
	end

	def OrientateUp::execute
		Sketchup.active_model.start_operation "Orientate Faces Up",true ,false ,false
		OrientateUp.orientate(Sketchup.active_model.selection[0])
		Sketchup.active_model.commit_operation
		# refresh the display
		Sketchup.active_model.active_view.invalidate
	end
	 
end

unless file_loaded?(__FILE__)
	UI.add_context_menu_handler do |menu|
		submenu = menu.add_submenu("&Face Orientation")
		submenu.add_item("Orientate Up") { OrientateUp.execute() }
	end
end

file_loaded(__FILE__)


#23

Okay thanks, but for my purposes, just reversing edges manually as I need is probably the simplest solution.

My imported file is nothing other than a list of points. It contains no additional information about normals, or anything else geometric or topological.

The bottom line here I think its that Sketchup is made for making models of things that might really exist, physically, especially architecture. But I am using it to make models of objects from abstract math, and the intuitive flow of the program just isn’t that well suited to that. I am probably better off using Mathematica.


#24

SketchUp automatically creates new faces oriented to match adjacent existing faces. If you start from points in space and draw all triangles (except the first obviously) right next to an existing triangle their orientation should match. As long as hat you are drawing is oriantable Right Click > Orient Faces should also work.

Some people have mentioned winding order in this thread. While winding order is used internally to define the polygons I don’t think it’s exposed to the user. At least the orientation of adjacent faces has higher priority.

Also when drawing a face with no adjacent faces on the X Y plane it is always oriented downwards (what I would call upside down). I’m not sure why but I would guess it is to create some contrast between the face and the white background which I think was default in the first SU versions.


#25

There are two different situations:

  • importing vertices > creating faces (either manually or by using a script)
  • manually creating faces with one of SketchUp’s native tools.

This is what I found out years ago as to face orientation: FaceOrient.skp (386.3 KB)

In short for stand alone faces:

  • looking down (along negative blue): drawing clockwise or counterclockwise: back face is always up
  • looking north or south (along green): drawing clockwise means facing the back face / drawing counterclockwise means facing the front face
  • looking east or west (along red): drawing clockwise means facing the back face / drawing counterclockwise means facing the front face (as with looking north)

Creating connected faces: the orientation depends on adjacent existing faces.

For (complex) solids don’t be bothered too much. ‘Orient Faces’ will correct the orientation by just a few clicks in the end.

For reversing individual faces assign ‘Reverse Face’ to a shortcut key. Hover with a tool that highlights faces (for instance ‘Push/Pull’) over these faces and apply (hit) that shortcut key to reverse.


#26

(To make things very short:)
Drawing in any plane, whether R/B, G/B and R/G:

  • clockwise means facing the back face
  • counterclockwise means facing the front face

Move the origin up or down and the rules above do apply for the R/G planes.

The only exception is drawing in the ground plane: back is always up.


#27

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.