Controlling shading on coordinate-based geometry
hcyl.wrl

	

#VRML V2.0 utf8
#
#  hcyl.wrl
#  Half-cylinder crease-angle demo
#	by David. R. Nadeau
#
#  Illustrate the how the crease angle value affects the smoothness
#  of shading on a half-cylinder.  The left half-cylinder has a crease
#  angle of 0.0, causing faceted shading.  The right half-cylinder has
#  a crease angle of 1.571 (90 degrees), causing smooth shading.  Both
#  half-cylinders have *exactly* the same number of coordinates and
#  faces, but the smooth shaded one looks better!
#

WorldInfo {
    title "Half-cylinder crease angle demo"
    info [ "Copyright (c) 1997, David R. Nadeau" ]
}
Viewpoint {
    position 0.0 0.5 4.0
    description "Entry view"
}
NavigationInfo {
    type [ "EXAMINE", "ANY" ]
}

Transform {
    translation -1.0 0.0 0.0
    children [
	Shape {
	    appearance DEF White Appearance {
		material Material { }
	    }
	    geometry IndexedFaceSet {
		solid FALSE
		creaseAngle 0.0
		coord DEF Coord Coordinate {
		    point [
			-0.50  0.00  1.00,
			 0.50  0.00  1.00,
			-0.50  0.38  0.92,
			 0.50  0.38  0.92,
			-0.50  0.71  0.71,
			 0.50  0.71  0.71,
			-0.50  0.92  0.38,
			 0.50  0.92  0.38,
			-0.50  1.00  0.00,
			 0.50  1.00  0.00,
			-0.50  0.92 -0.38,
			 0.50  0.92 -0.38,
			-0.50  0.71 -0.71,
			 0.50  0.71 -0.71,
			-0.50  0.38 -0.92,
			 0.50  0.38 -0.92,
			-0.50  0.00 -1.00,
			 0.50  0.00 -1.00,
		    ]
		}
		coordIndex [
		    0, 1, 3, 2, -1,
		    2, 3, 5, 4, -1,
		    4, 5, 7, 6, -1,
		    6, 7, 9, 8, -1,
		    8, 9, 11, 10, -1,
		    10, 11, 13, 12, -1,
		    12, 13, 15, 14, -1,
		    14, 15, 17, 16, -1,
		]
	    }
	}
    ]
}

Transform {
    translation 1.0 0.0 0.0
    children [
	Shape {
	    appearance USE White
	    geometry IndexedFaceSet {
		solid FALSE
		creaseAngle 1.571
		coord USE Coord
		coordIndex [
		    0, 1, 3, 2, -1,
		    2, 3, 5, 4, -1,
		    4, 5, 7, 6, -1,
		    6, 7, 9, 8, -1,
		    8, 9, 11, 10, -1,
		    10, 11, 13, 12, -1,
		    12, 13, 15, 14, -1,
		    14, 15, 17, 16, -1,
		]
	    }
	}
    ]
}