threepipe
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

11 месяцев назад
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. }