# RegionPlot3D of MeshRegion with VertexColor-like behavior

I regularly use the VertexColors option with GraphicsComplex[] to render images of objects with certain attributes at the vertices.

For example,

Graphics3D[{EdgeForm[None],
GraphicsComplex[PolyhedronData["Cuboctahedron", "VertexCoordinates"],
Polygon[PolyhedronData["Cuboctahedron", "FaceIndices"]],
VertexColors ->
Table[{Opacity[Random[]],
Glow[Hue[Random[]]]}, {PolyhedronData["Cuboctahedron",
"VertexCount"]}]]},
Boxed -> False, Lighting -> None]


gives something like:

I have been experimenting with MeshRegions for a few things (Somewhat related to this question: Differential Geometry on a MeshRegion) since they allow me to attach attributes to the vertices in a more generic manner.

Sadly, RegionPlot3D[] doesn't seem to respect or use the MeshCellStyle directive:

bmr = BoundaryMeshRegion[
PolyhedronData["Cuboctahedron", "VertexCoordinates"],
Polygon[PolyhedronData["Cuboctahedron", "FaceIndices"]],
MeshCellStyle -> {0 -> {PointSize[Large], Black},
1 -> {Dashed, Thick, Blue}, 2 -> Opacity[0.5, Green]}]


but...

RegionPlot3D[bmr, Boxed -> False]


It isn't precisely clear to me what is available to RegionPlot3D[region] from the supplied region at render time. Any thoughts here?

(nb- I realize I could use the BoundaryMeshRegion[] output (bmr above) and just use Show[] to get the various camera angles, etc that I need. Like

Show[bmr, ViewPoint -> Front, Lighting -> {{"Directional", White, {1, - 2, 3}}}]]


but I suppose I'd like to understand a little bit about how RegionPlot3D[] does what it does with respect to MeshRegions a little better)

• I would guess that mathematically RegionPlot3D uses only the region defined by the mesh region and programmatically that means it uses only the polygons of the boundary. Compare First@Show@bmr and First@RegionPlot3D@bmr. – Michael E2 May 7 '15 at 15:01
• You can post-process the RegionPlot3D output to add VertexColors to Polygons:, e.g. rp=RegionPlot3D[bmr, Boxed -> False,Lighting -> "Neutral"]; rp /. Polygon[x_]:> ( Polygon[#,VertexColors->(RandomColor[Hue[_, 1, 1,RandomReal[{.5,1}]], Length@#, ColorSpace -> "RGB"] )] &/@x) – kglr May 7 '15 at 17:13
• Ah- also a good idea. I'm interested in the 'general solution' to this (if possible) since it would be cool to attach a bunch of qualia to the vertices / faces in the region and have the renderer be able to do things with that stuff 'on the fly' (I've been doing that with RenderMan shaders for eons, but would like to be able to do that in MMa, of course, GLSL shaders would be nice to add to MMa at some point too :) – flip May 7 '15 at 20:14

Coloring vertices can be colored by adding VertexColors after RegionPlot:
rplot = RegionPlot3D[bmr, Boxed -> False];