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

primitive object not displaying correctly on multi view? #1930

Open
DDman1984 opened this issue Apr 19, 2024 · 1 comment
Open

primitive object not displaying correctly on multi view? #1930

DDman1984 opened this issue Apr 19, 2024 · 1 comment
Labels
question Further information is requested

Comments

@DDman1984
Copy link

HI ,
I try to implement split view like view-skissor
but I find a strange thing ....
if I replece code to

image

the model only display on right bottom view....

image

why?
the View unsupport primitive object multi display?

pls, help me~thx

@DDman1984 DDman1984 added the question Further information is requested label Apr 19, 2024
@neursh
Copy link

neursh commented May 11, 2024

From my experience, so this might not be the actual reason.

Let say you have two pieces of drawing paper, the scene is the whole paper.

Then when you put one on top, you can only see that one that you put on top.

So when displaying GLTF models using primitive and set the model's scene to object, you're asking three to put the whole scene of that first loaded object, just like the drawing paper scenarios.

This also explains why when we're editing or adding new changes in one of them, it will display the latest edited primitive, because now that object is the latest added object after hot reload.

Components in three doesn't have scene to it, think of it like a pencil for you to draw on the drawing paper.

Adding components to the scene doesn't affect the scene overall.

For example, I'll use this code:

<Canvas eventSource={document.getElementById("root")} className="canvas">
  <OrbitControls />
  <Environment preset="city" />
  <Soda key={1} scale={3} position={[0, 0, 0]} />
  <Soda key={2} scale={3} position={[1, 1, 1]} />
</Canvas>

This is what I got after changing <Soda> component to use primitive:
image

And when I change the second one to anything, causing it to reload, its scene will be on top, making the first one disappear:
image

And this is what I got using the example code provided:
image

The second one works because it's using actual mesh of the object, instead of the whole scene of the object.

Finally, one of them is primitive:
image

FYI, you can convert your object to reusable JSX component using gltfjsx, try out the official demo here.

After that, your View scene should work as intended!

I don't know much about three, so I would love to see someone correct me 🥲.

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

No branches or pull requests

2 participants