Example from three.js but how to implement using SceneKit?

隐身守侯 提交于 2019-12-11 01:51:01

问题


Example of goal:

I see three.js has this example.

It's simply a 3D Cube with many Spheres on its surface.

How can I do something like this using SceneKit?


回答1:


You could use an array of points, on planes, and place spheres at those locations.

Each plane divide by 10 in both directions (X and Y) and then make six of these planes and rotate them into the cube face positions.

I think performance is probably going to suck, though. This is a lot of polygons, for each of these spheres. Let's imagine each sphere has 200 tris. That's 100x 6x 200 = 1.2 million triangles.

Probably better to use circular textures on quads, placed facing the camera, at each of these 600 points. Then it's only 1200 triangles.


Cheats way to do this:

Create a SCNBox with the number of vertices desired in x, y & z axis.

Then use it as a particle emitter shape, and assign emittance to each vertex at a rate that makes them always appear at these locations, using a small circle texture, and the "look at camera" mode of placard presentation.

here is that cheat, done with particles:



来源:https://stackoverflow.com/questions/41807844/example-from-three-js-but-how-to-implement-using-scenekit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!