1.0.10 • Published 2 years ago

@unitywear/garment-preview v1.0.10

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Adding new models

1. Finding a model

2. Simplifying polygons and converting to GLTF

Use Blender to reduce polygon count and export as GLTF

  1. Hit wrench icon on model to access modifiers
  2. Add the Decimate modifer to reduce polygon account
  3. Export
    • Make sure scale is 1
    • Object is close to origin
    • Modifiers are all applied

References 1. Export GTFs with blender 2. Reducing polygon count in Blender

3. GLTF to JSX components

4. Adding a canvas texture

interface IModel{
skinRef: React.RefObject<HTMLCanvasElement>
}

export default function Model(props: IModel) {
  ...
  return (
    ...
      <mesh>
        <meshStandardMaterial>
            <canvasTexture attach="map" image={props.skinRef?.current}/>
        </meshStandardMaterial>
      </mesh>
  )
}