va3c / GHvA3C

Grasshopper plugin to export three.json files that can be loaded by the vA3C viewer
http://va3c.github.io/viewer/grasshopper2.html
20 stars 27 forks source link

Mesh with colored vertices component #4

Open bhowes-tt opened 9 years ago

bhowes-tt commented 9 years ago

Take a mesh with color data (and optional attribute names and values) and output a json representation of the mesh and a list of all necessary materials for the compiler to consume.

bhowes-tt commented 9 years ago

I don't think I'll be able to sort his out for 0.2. The component is blocked out and populates a [colors] array on the mesh object ... but this isn't enough for the json parser.

Option 1 - We hack it ourselves on the viewer side by looping over the geometry after it is parsed (and the json containing the color data that was ignored) and in the scene and populating face vertex colors based on the mesh's colors array (this is the road I went down ... felt sloppy and I never really got it to work).

Option 2- we figure out how to assign vertex colors using the three.json 3 rules for face data. See here: https://github.com/mrdoob/three.js/wiki/JSON-Model-format-3 It looks like we can assign vertex colors, face colors, and materials (as well as quads) by setting a type. We have always just been setting 0 ... which is a triangle. I don't know if I forgot that from the hackathon or just never knew ... but the Three.js json loader is set up to test for these types. This seems like the robust solution.

theo-armour commented 9 years ago

See my response to issue #3

https://github.com/va3c/GHvA3C/issues/3

On Thu, Nov 13, 2014 at 12:06 PM, Ben Howes notifications@github.com wrote:

I don't think I'll be able to sort his out for 0.2. The component is blocked out and populates a [colors] array on the mesh object ... but this isn't enough for the json parser.

Option 1 - We hack it ourselves on the viewer side by looping over the geometry after it is parsed (and the json containing the color data that was ignored) and in the scene and populating face vertex colors based on the mesh's colors array (this is the road I went down ... felt sloppy and I never really got it to work).

Option 2- we figure out how to assign vertex colors using the three.json 3 rules for face data. See here: https://github.com/mrdoob/three.js/wiki/JSON-Model-format-3 It looks like we can assign vertex colors, face colors, and materials (as well as quads) by setting a type. We have always just been setting 0 ... which is a triangle. I don't know if I forgot that from the hackathon or just never knew ... but the Three.js json loader is set up to test for these types. This seems like the robust solution.

— Reply to this email directly or view it on GitHub https://github.com/va3c/GHvA3C/issues/4#issuecomment-62957151.