July 2018
Beginner to intermediate
374 pages
8h 54m
English
What is a space simulation without stars? Stars in 3D games are pretty interesting. It would be a lot of work on the computer to simulate stars by generating 500 sphere meshes and moving them really far away. Instead of that, 3D programmers use a special material to create one shape with a lot of points in it. To make it easy on the computer, this points material only shows the points in the shape instead of smoothly covering the entire shape like regular materials.
Below the Moon code, start by creating the cover and shape for our star points.
| | var cover = new THREE.PointsMaterial({color: 'white', size: 15}); |
| | var shape = new THREE.Geometry(); |
The PointsMaterial is similar to other materials that we’ve seen—we can ...
Read now
Unlock full access