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

How to rewrite gltfjsx generated jsx file to separate geometry and material #257

Open
shunmian opened this issue Apr 24, 2024 · 1 comment

Comments

@shunmian
Copy link

I have generated jsx file by gltfjsx with following result

export function Model(props) {
  const { nodes, materials } = useGLTF('./models/Common/Model.glb')
  return (
    <group {...props} dispose={null}>
      <mesh castShadow geometry={nodes.001.geometry} material={materials.001} />
    </group>
  )
}

Is it possible to rewrite above jsx into something like below?

export function Model(props) {
  const { nodes, materials } = useGLTF('./models/Common/Model.glb')
  return (
    <group {...props} dispose={null}>
      <mesh>
        <SomeGeometry buffer={nodes.001.geometry} />
        <SomeMaterial buffer={materials.001}
      </mesh>
    </group>
  )
}

Anyone can help?

@jo-chemla
Copy link

The ability to explode meshes geometry and materials in the component tree has been requested in this thread

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

No branches or pull requests

2 participants