threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

material.ts 705B

11 miesięcy temu
12345678910111213
  1. import {MeshPhysicalMaterial} from 'threepipe'
  2. // todo see blender gltf exporter and convert to js. structure is the same
  3. // https://github.com/KhronosGroup/glTF-Blender-IO/blob/ed5100ab6c40472b7c3254fddfe0dd0d76d60644/addons/io_scene_gltf2/blender/exp/material/materials.py#L60
  4. export function createMaterial(mat: any) {
  5. const material = new MeshPhysicalMaterial()
  6. material.color.setRGB(mat.r, mat.g, mat.b)
  7. material.roughness = mat.roughness !== undefined ? mat.roughness : 0.4
  8. material.metalness = mat.metallic !== undefined ? mat.metallic : 0.0
  9. material.opacity = mat.alpha !== undefined ? mat.alpha : 0.0
  10. material.transparent = material.opacity < 1.0
  11. return material
  12. }