Hello
I add Sphere in my scene, but it’s not completely rounded ! how can increase more detail of Sphere ?
Hi @JANGOZ,
You should either import your own custom sphere as an external model, or procedurally create a mesh in code. Check this post on the subject, it does it for a box, but similarly you can do it for a sphere:
1 Like
Thanks, this is works !
import custom sphere from external model or create a mesh in code, which one is better ?
Which one is better in size and resource (CPU,GPU) usage ?
let sphereEntity = new pc.Entity();
sphereEntity.name = 'SphereName';
var sphere = pc.createSphere(this.app.graphicsDevice, {
latitudeBands: 500,
longitudeBands: 500,
radius: 1
});
const material = new pc.StandardMaterial();
const meshInstance = new pc.MeshInstance(sphere, material);
sphereEntity.addComponent('render', {
meshInstances: [meshInstance],
});
// Add the sphere entity to the scene
this.app.root.addChild(sphereEntity);
If you generate it procedurally, then you don’t need to download a model, so one less http call, I suppose. CPU/GPU side would be same.
2 Likes
I thought if it was created with code, it would take more resources for the gpu to do it and it might run slow on mobile.
So I was wrong