VRMLLoader: no colors

I can’t seem to import a number of third-party models from SolidWorks into THREE.js with colors. The VRML file I export from SW does contain colors, but they are not shown in the scene. If I create a simple model in SolidWorks from scratch, everything is fine.

My quick investigation suggests that there are ways of specifying colors in VRML that VRMLLoader does not properly support. For example, does it support color specification per face? It seems to parse and add it to resulting BufferGeometry, but the object is colorless. Here’s a shortened example of one problematic VRML file:

#VRML V2.0 utf8

Shape {
	appearance Appearance {
		material Material {
		}
	}
	geometry IndexedFaceSet {
		coord Coordinate {
			point [ -0.006428 0.018390 -0.019135 0.007610 0.017604 -0.017431..... ]
		}
		colorPerVertex FALSE
		color Color {
			color [ 0.30 0.30 0.30 0.59 0.57 0.53 0.47 0.47 0.51 0.78 0.76 0.74 0.78 0.76 0.74 ]
		}
		colorIndex [ 0 0 .... ]
               coordIndex [ 0 1 2 -1 ... ]
	}
}

Author: Fantashit

1 thought on “VRMLLoader: no colors

  1. The PR should fix copper_part.wrl. wheel_65.wrl seems to render correctly:

    image

    The color definition in the geometry section defines a lot of black colors.

Comments are closed.