[yt-users] Monochrome & transparent isosurfaces

Matthew Turk matthewturk at gmail.com
Wed Dec 3 16:18:39 PST 2014


Hi Adam,

On Wed, Dec 3, 2014 at 11:46 AM, Adam Ginsburg
<adam.g.ginsburg at gmail.com> wrote:
> 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).

This is awesome -- truly awesome.

>
>     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?

I think this might be the best way *as is*, but not forever.  It
should be possible to feed in to the export_obj function the colors
you want.  Alternately, you *can* define a field that's all ones just
by using the field "ones" which already exists.

>
> 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.

I've had this before too, and not understood it.  I'm not 100% sure
why it gives this error, since I think the files are well-formed.

>
>
> Thanks,
> --
> Adam Ginsburg
> Fellow, European Southern Observatory
> http://www.adamgginsburg.com/
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org




More information about the yt-users mailing list