# ListPlot3D: combine VertexColors and RegionFunction

I've found that RegionFunction and VertexColors don't work together.

Example:

data = Flatten[
Table[ {x/100, y/100, Sin[2 Pi x/100] Cos[2 Pi y/100]}, {x,
100}, {y, 100}], 1];
colorvals = (Sqrt[2] N[Norm[#[[1 ;; 2]] - {1, 1}/2]] & /@ data);
ListPlot3D[data, VertexColors -> Hue /@ colorvals]


Adding RegionFunction suppresses the colors..

ListPlot3D[data,
VertexColors -> colors,
RegionFunction -> Function[{x, y, z}, Norm[{x, y}] < 1]]


Any work-around?

My actual data is not on a regular grid, and the region is not convex, if that matters.

Edit: I should have said, my actual color data is already tabular, there is no analytic function to work with as in the example.

Edit: in case anyone comes across this for discrete color values, create an interpolating function:

int = Interpolation[Transpose[{data[[All, ;; 2]], colorvals}],
InterpolationOrder -> 1];


then use ColorFunction -> (Hue[int[#1, #2]] &) in @paw's answer (This will likely generate some extrapolation warnings, so use Quiet )

• Indeed, if you look at the InputForm[] of the second plot, no Hue[] objects can be found; thus, the explicit color setting is being ignored in that case. – J. M.'s ennui Oct 26 '15 at 17:57

You can use ColorFunctionto get around this issue.
ListPlot3D[data,