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

Material System #598

Open
gumyr opened this issue Mar 22, 2024 · 3 comments
Open

Material System #598

gumyr opened this issue Mar 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@gumyr
Copy link
Owner

gumyr commented Mar 22, 2024

Currently the material attribute of a shape is defined as a user defined string. Materials could be enhanced by creating a data structure that would contain two types of information:

  • Physical Properties Attributes like: density, strength, stiffness
  • Physically Based Rendering (PBR) Attributes that impact the appearance of a material when rendered, such as: ambient, diffuse, specular, and emmissive colors, shininess, transparency, etc.

Material properties would then be defined for a wide range of materials such as ABS, 2024 T3 Aluminum, Delrin, 316 Stainless Steel, etc. so the user could just assign a material to their part.

The physical properties could be used when calculating part mass or stiffness while the PBR parameters would be used when rendering the material though a viewer or when exporting to file formats that support such information such as glTF or 3MF.

The OCCT XDE (eXtended Data Exchange) document (used when generating many of the export file formats) only supports storing a material label so additional information would need to be added by directly enhancing the exporters. For example, the export_gltf function would need to edit the generated JSON file as follows:

  • Modify/Add to the Materials Array: Add a new object to the materials array in the JSON structure, as shown in the example above. If the materials array does not exist, you will need to create it. Each object within the materials array represents a different material.

  • Define Material Properties: Within the material object, define the properties of your material, such as name, pbrMetallicRoughness, and any additional properties like textures or normal maps if needed. The pbrMetallicRoughness object is where you define the base color, metallicity, and roughness of the material.

  • Assign the Material to Mesh Primitives: Each mesh in the glTF file contains primitives, which are the actual geometry data. To apply your material to a mesh, you need to set the material index in the primitives to match the index of your material in the materials array. For example, if your new material is the first object in the materials array, its index is 0, and you would set "material": 0 in the mesh primitive(s) you want to apply it to.

A comprehensive material system would enable users to display and analyze their parts as real world objects.

@kcleung
Copy link

kcleung commented Jan 25, 2025

Currently the material attribute of a shape is defined as a user defined string. Materials could be enhanced by creating a data structure that would contain two types of information:

  • Physical Properties Attributes like: density, strength, stiffness
  • Physically Based Rendering (PBR) Attributes that impact the appearance of a material when rendered, such as: ambient, diffuse, specular, and emmissive colors, shininess, transparency, etc.

Material properties would then be defined for a wide range of materials such as ABS, 2024 T3 Aluminum, Delrin, 316 Stainless Steel, etc. so the user could just assign a material to their part.

The physical properties could be used when calculating part mass or stiffness while the PBR parameters would be used when rendering the material though a viewer or when exporting to file formats that support such information such as glTF or 3MF.

The OCCT XDE (eXtended Data Exchange) document (used when generating many of the export file formats) only supports storing a material label so additional information would need to be added by directly enhancing the exporters. For example, the export_gltf function would need to edit the generated JSON file as follows:

  • Modify/Add to the Materials Array: Add a new object to the materials array in the JSON structure, as shown in the example above. If the materials array does not exist, you will need to create it. Each object within the materials array represents a different material.
  • Define Material Properties: Within the material object, define the properties of your material, such as name, pbrMetallicRoughness, and any additional properties like textures or normal maps if needed. The pbrMetallicRoughness object is where you define the base color, metallicity, and roughness of the material.
  • Assign the Material to Mesh Primitives: Each mesh in the glTF file contains primitives, which are the actual geometry data. To apply your material to a mesh, you need to set the material index in the primitives to match the index of your material in the materials array. For example, if your new material is the first object in the materials array, its index is 0, and you would set "material": 0 in the mesh primitive(s) you want to apply it to.

A comprehensive material system would enable users to display and analyze their parts as real world objects.

Currently, are there any standard tables used in the industry, and other major CAD/CAM software that cover physical properties and physical-based rendering?

Would it be a good idea to adopt the format of standard tables such as matweb.com or ASM International?

@kcleung
Copy link

kcleung commented Jan 25, 2025

Or the Materials Project, which has API for querying data about a given material:

https://next-gen.materialsproject.org/api

Then each function can consult specific fields for that material according to its needs

@gumyr
Copy link
Owner Author

gumyr commented Jan 27, 2025

The Materials Project seems to be designed for chemistry/physics and doesn't seem to have a simple way to query metals like 5052 Aluminum which is common in the manufacturing industry. In addition, an API Key is required to access the data which makes seamless use by build123d users quite problematic. Having an option for the user to provide their own key and query such that build123d could look up the data and use it seems like a good thing to do though.

There are industry standards for material naming and data (like Unified Numbering System A95052 for 5052 Aluminum) which could be used as a optional material descriptor to ensure consistency.

Therefore, it seems like build123d needs its own DB of materials - maybe starting with the most common materials used in 3D printing, CNC machining and laser cutting - something like:

Plastics:

  • ABS
  • PLA
  • PETG
  • Nylon
  • Polycarbonate
  • Delrin (POM)

Metals:

  • Aluminum 6061
  • Aluminum 5052
  • Stainless Steel 304
  • Stainless Steel 316
  • Mild Steel
  • Brass
  • Copper

Woods:

  • Plywood
  • MDF
  • Balsa

Composites:

  • Carbon Fiber Reinforced Polymer
  • Glass Fiber Reinforced Polymer

A JSON file could be used to store the data; how about something like this (will rendering data added eventually)?

material_library.json

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

No branches or pull requests

2 participants