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

<Sampler/>'s API not clear! ( Sampler's count and instancedMesh's count ) #1139

Open
sokhuong-uon opened this issue Nov 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@sokhuong-uon
Copy link
Contributor

sokhuong-uon commented Nov 9, 2022

  • three version: 0.146.0
  • @react-three/fiber version: 8.9.1
  • @react-three/drei version: 9.40.0
  • node version: 16.16.0
  • yarn version: 1.22.19

Problem description:

  • By not providing count prop for <Sampler/>, the number of sample will be equal to:
    • the count of instancedMesh if instancedMeshCount <= 17
    • 17 if instancedMeshCount > 17
  • By providing count prop for <Sampler/>, the number of sample will be equal to min( samplerCount, instancedMeshCount ) + 1

Relevant code:

Example below will only create 4 samples

<Sampler count={3}>
        <mesh>
          <planeGeometry />
          <meshNormalMaterial />
        </mesh>

        <instancedMesh args={[undefined, undefined, 1000]}>
          <sphereGeometry args={[0.1]} />
          <meshNormalMaterial/>
        </instancedMesh>
  </Sampler>

codesandbox: https://codesandbox.io/s/sampler-behavior-vc57u6?file=/src/index.jsx

I wanted to update Sampler docs but I noticed this issue.

@sokhuong-uon sokhuong-uon added the bug Something isn't working label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant