Here I color the 747 model via the VertexColors
option to GraphicsComplex
.
jet = Import["ExampleData/747.3ds.gz"];
(* Function to change color of GraphicsComplex *)
newcolor[gcomplex_, colfun_] := Module[{
pts = First@gcomplex,
data = gcomplex[[2]],
vcol},
(* Remove old RGBColor stuff in data part of the graphics complex *)
data = DeleteCases[data, RGBColor[_]];
(* Introduce vertex colors according to colfun *)
vcol = colfun /@ pts;
(* Return a new GraphicsComplex with VertexColors *)
GraphicsComplex[pts, data, VertexColors -> vcol]
]
(* Find range of z values *)
{zmin, zmax} = {Min@#, Max@#} &@(Last /@
Flatten[Cases[jet, GraphicsComplex[__], Infinity][[All, 1]], 1]);
(* Color function that maps {x,y,z} to color *)
cf = ColorData["GreenBrownTerrain"][Rescale[Last@#, {zmin, zmax}]^2] &
(* Change all GraphicsComplex objects *)
jet /. gc_GraphicsComplex :> newcolor[gc, cf]
There are some visible artefacts in the coloring, but at least it's something.
Comment if there's some part you'd like me to explain further.
Here's the before/after for ExampleData[{"Geometry3D","Phobos"}]
Import["ExampleData/747.3ds.gz"]
it returns aGraphics3D
$\endgroup$jet = Import["ExampleData/747.3ds.gz"]; {jet[[0]], jet[[1]]}
$\endgroup$GraphicsComplex
objects:Graphics3D[{EdgeForm[], Table[jet[[1, 2, i]] /. RGBColor[_] -> ColorData[1][i], {i, 1, 7}]}]
Kind of annoying structure to change color of. $\endgroup$