[yt-users] Porting .ply files to Blender with colors?

Jill Naiman jnaiman at gmail.com
Mon Feb 25 12:45:39 PST 2013


Hi Matt,

On Mon, Feb 25, 2013 at 6:59 AM, Matthew Turk <matthewturk at gmail.com> wrote:

> Hi Jill,
>
> On Mon, Feb 25, 2013 at 6:32 AM, Matthew Turk <matthewturk at gmail.com>
> wrote:
> > On Mon, Feb 25, 2013 at 1:43 AM, Jill P. Naiman <jnaiman at ucolick.org>
> wrote:
> >> Hi Matt,
> >>
> >> I've tried a few different things with PLY files and no luck.
>  Actually, I'm
> >> not 100% sure if Blender really likes PLY files anyway - you can't even
> >> export color easily in PLY format in Blender.  So, I've given up on PLY
> and
> >> have hacked together a bit of a messy OBJ exporter:
> >> http://paste.yt-project.org/show/3205/
> >
> > This looks nice.  We should incorporate this, or a modified version,
> > into the AMRSurface object.  We used to have a .obj file format
> > exporter, but I (incorrectly, it seems) thought the PLY format, which
> > can be in binary and is thus much smaller, had feature parity.  Would
> > you be up for making this a bit more general, and then adding it to
> > the AMRSurface object?
> >
>

I would be up for making a general version, perhaps even with the correct
"face" coloring, but given that I'm pretty new to python and yt (... and
Blender... and OBJ formatting...) it might not be very pretty, but it will
at least work.  Hope that is ok.

As far as PLY for Blender, I think it can in theory work, but it would
require some updates to the PLY importer/exporter in there, and just
outputting things to OBJ seemed like the path of least resistance.  Plus,
the current Blender PLY importer seems to require float, not binary
formatting, and I'm not sure how easily that can be changed.

Also, I couldn't seem to get transparencies to change in sketchfab using
PLY (with the code you posted a bit ago, not sure you had success), and
having not attempted it, I'm sure it will be easier with OBJ formatting :)


> >>
> >> I'm probably doing the colors wrong, since there's likely a nicer way
> to get
> >> actual "face" values then just taking the value at 1/3 of the vertex
> values,
> >> but it worked, so I didn't mess with it too much.
> >
> > There is a simpler way, but honestly it's pretty non-intuitive and I
> > think the face/vertex sampling in the AMRSurface is a bit clunky.  If
> > you do:
> >
> > surf.get_data(field, "face")
> >
> > it will sample at the faces rather than the vertices.  This is also
> > the default behavior for getting data through the dict-like method:
> >
> > surf[field]
> >
> > which should be face sampled.
> >
> >>
> >> A few other things: (1) in theory, this can set transparencies, but I
> >> haven't got that working as of yet, (2) the default specular (ambient?)
> >> color settings make for a bit of a washed-out view in sketchfab:
> >> http://skfb.ly/54jged0b, (3) the .mtl file is a bit too long since I'm
> >> essentially setting each face as a different material, when one would
> just
> >> like to use 1 material per color and set all the faces with that color
> on a
> >> specific surface plot to that material, but I haven't got that bit
> working
> >> well either.
> >
> > (2) Is this something that can be controlled by the materials editor
> > on Sketchfab?
>
>
In theory, yes, but you have 255 colors per surface, and I think you would
have to change the transparency of each of the 255 by hand.  It looks like
there is a way to group sets of materials in OBJ files, but I'm not sure if
sketchfab supports applying transparency changes to groups of materials
instead of individual materials.


> Quick followup -- by changing the "Rendering Options" to "Shadeless" I
> was able to see things a bit better on Sketchfab.
>
>
It seems that turning off the ambient and specular color is all that is
required to make the sketchfab upload look good w/o having to mess with it:
http://skfb.ly/54jhe10b   Besides, if you want to do something silly like
make it super shiny, I think you need shading turned on :)



> -Matt
>
> > (3) Ah, interesting.  One could do just 255 materials, for instance,
> > and then that is now the colormap.
> >
> > This is definitely very interesting, and would be a huge upgrade for
> > our Sketchfab / Blender / etc capabilities.  Thank you for sharing all
> > of this!
> >
> > -Matt
> >
> >>
> >> Thanks for the info, and please let me know if any of that doesn't make
> >> sense.
> >> -Jill
> >>
> >>
> >> _______________________________________________
> >> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130225/319661fd/attachment.html>


More information about the yt-users mailing list