[yt-users] Monochrome & transparent isosurfaces
Adam Ginsburg
adam.g.ginsburg at gmail.com
Wed Dec 3 09:46:00 PST 2014
Hi folks,
I'm trying to use the isosurface tools (export_sketchfab &
export_obj; http://yt-project.org/doc/visualizing/sketchfab.html) to
make renderings of multiple line species from ALMA data cubes. I'm
doing this using both the yt-fits interface and spectral-cube
(spectral-cube.rtfd.org).
I've had some success in getting multicolored and transparent
contours to show up (e.g.,
https://sketchfab.com/models/8cddb94df8024c28ab3e4e5a43c2b069), but I
still don't have complete control over the colors. To make that
model, I created pure red/green/blue colormaps and added them to the
colormap registry, e.g.:
blue = mpl.colors.LinearSegmentedColormap('blue', {'red':[(0,0,0),(1,1,1)],
'green':[(0,0,0),(1,1,1)],
'blue':[(0,1,1),(1,1,1)]})
from yt.visualization._colormap_data import color_map_luts
color_map_luts['blue'] = blue(np.linspace(0,1,256)).T
but that was fairly awkward, and the contours are still showing up
white-ish. I think this is because I have set the color_field to the
flux_field (I only have one field to work with!):
surf = dataset.surface(dataset.all_data(),
dataset.field_list[0],
level)
surf.export_obj(filename, transparency=transparency,
color_field=dataset.field_list[0],
color_map='blue',
plot_index=jj)
but I can't figure out an alternative way to specify color, except
perhaps to define a dummy field that is all 1 - which I also don't
know how to do, but I'm sure I could figure it out. Is there a better
way, though?
Also, when I try importing my meshes into MeshLab, I get the error:
Error details: Some materials definitions were not found, a default
white material is used where no material was available
and then the contours all show up as gray and opaque, even if I change
"render->color" to "per face" as suggested in the docs. But, I've
never used MeshLab before, so I might just be misusing the program.
Thanks,
--
Adam Ginsburg
Fellow, European Southern Observatory
http://www.adamgginsburg.com/
More information about the yt-users
mailing list