Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export Options for Mesh Colours and Double-Sided #79

Open
jjsolly opened this issue Jun 15, 2022 · 1 comment
Open

Export Options for Mesh Colours and Double-Sided #79

jjsolly opened this issue Jun 15, 2022 · 1 comment

Comments

@jjsolly
Copy link

jjsolly commented Jun 15, 2022

Thanks for creating a really useful tool!

A couple of queries:

  • I really like the option to export meshes with the display colour if no material assigned to the object. This is really handy. However I also have some meshes where I'd like to export the vertex colours IF they are assigned. Would it be possible to have the behaviour so that if both "use display colour for objects with no material set" AND "export vertex colours" are ticked then meshes with vertex colours are exported with them while those with no vertex colours are given the display colour? If this is too niche a use case then please ignore me.
  • Would it be possible to have an option to export open meshes so they are double-sided? For a simple floor plane object it's handy to limit face count in the model by having it double-sided?

Thanks again for a great tool!

@jrz371
Copy link
Collaborator

jrz371 commented Aug 1, 2022

In order to support the display color when no material is assigned a gltf material with the display color is created.

if(material == null && options.UseDisplayColorForUnsetMaterials)
{
Color4f objectColor = GetObjectColor(rhinoObject);
return CreateSolidColorMaterial(objectColor);
}
else if(material == null)

Vertex colors are always written if they exist and the option is enabled

private bool ExportVertexColors(Mesh rhinoMesh)
{
return rhinoMesh.VertexColors.Count > 0 && options.ExportVertexColors;
}

I'm guessing whatever renderer you're using is defaulting to the material instead of vertex colors. I can add an extra check to only create a material from the display color if no vertex colors are present.

It looks like doubleSided triangles are supported.
https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#double-sided

I'll see how best to wire this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants