Test the three.js maket of Embung Sukamaju on villagers’ phones: camera, light, taps, frame time. 16 levels, right in the browser.
What the levels ask
Ms. Citra is putting a 3D model of Embung Sukamaju, the village reservoir, on the village site. Tonight the neighbourhood head opens it on his phone. The scene, the camera and the pump house are ready, but the model box on the site is still empty. Complete the line after renderer.setSize in maket.js.
Mr. Tono is waiting to see the pump house that will water his fields. The canvas is on the page, but all it shows is sky. A new camera in three.js stands at (0, 0, 0) and faces -z, and the pump house stands at that same point. Choose the camera’s position in maket.js.
The model is complete, from the gate at the front to the kiosks at the back. Mr. Bayu, the village treasurer, wants to see all of it before the budget is passed. The camera stands high in front of the embung. Choose the last number of PerspectiveCamera in maket.js: the furthest the camera still draws.
Mr. Dodi asks why the gazebo roofs on the model look like stickers: all four sides are one colour. Ms. Citra wants the model faceted and lit by the morning sun from the east, the +x direction. Choose the material for buatEmbung and the light that goes into the scene.
Mr. Karim knows the dry-season wind in Sukamaju comes from the east, and on the model east is +x. The windmill’s blades face +z now. Turn the windmill a quarter turn in maket.js so its blades face the wind.
Ms. Wulan asks for a fourth gazebo at the front right for the village health post. Ms. Citra builds its posts and floor first, then the roof on its own, then moves the gazebo to its spot. On the phone the roof does not come along. Choose where the roof is attached.
Mr. Jaya is going to fit a garden lamp above the front post of gazebo 3. His plan gives the lamp’s point in world coordinates: (-2.88, 1.36, 2.42). The lamp is a child of gazebo 3, which has been moved and turned 30 degrees. Choose how to fill in the lamp’s position.
Mr. Harun always watches videos with his phone on its side, and tonight he turns it sideways in front of the model. The canvas does widen, but the embung stretches sideways with it. Complete the last line of the resize handler in maket.js.
The site now names the part that is tapped, and Rara taps three parts. The model box does not start at the screen’s corner: there is a header above it and a margin to its left. Fill in the finger point’s x and y in the coordinates the raycaster uses.
The windmill on the model turns now, three radians a second like the real pump windmill. Mrs. Yanti watches it on her old phone, which draws 60 frames a second. Bagas opens the same model on his new phone, which draws 120. Fill in the turning line in the loop of maket.js.
Grandma Marni gets dizzy watching things that keep spinning, and on her phone she has turned on the reduce motion setting. Mr. Piksel opens the model on his phone without it. Choose the value of diam in maket.js: the windmill stops for Grandma Marni and keeps turning for Mr. Piksel.
Dina opens the model on her new phone. Its screen has three physical pixels for every CSS pixel (devicePixelRatio 3), and the model canvas is 144 x 176 CSS pixels. Choose the renderer’s pixel ratio: the model is sharp, without making the phone draw pixels no eye can tell apart.