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