Three.jsImproving realism and free movement in an existing Three.js scene without breaking its math
When a simulation already teaches something, the visuals are the easy part to change and the math is the part that must not move. This is the approach I use.
1. Freeze the math first
Move the learning math into plain functions with no Three.js inside them, such as height(x, z), slope(x, z), the optimizer and the scoring. Record their outputs for a fixed set of inputs as a regression check. Every visual change is tested against the same numbers, so a better picture can never quietly change an answer.
2. Let the visuals read from the math
The terrain mesh, the walking path and the camera all sample the same height function the lessons use. A more realistic mountain is a denser grid, normals from the real gradient, and materials that follow slope. The picture becomes a lesson aid instead of a second model that can drift from the numbers.
3. Realism in the order that pays off
- Image-based lighting: an environment map through PMREM, sRGB output and ACES tone mapping.
- Shadows fitted to the play area, and fog or atmosphere for depth and scale.
- PBR materials, with small shader additions through onBeforeCompile where a texture would be heavy.
- Then the artist's GLB models, compressed with Draco or Meshopt and KTX2 textures, loaded lazily.
4. Free movement that stays correct
A third-person controller with velocity and damping, standing exactly where the height function says; a damped follow camera with collision; keyboard, drag and an on-screen joystick for tablets. Actions are explicit: in Sky World, walking into a portal no longer launches a game; a deliberate button does.
5. Fast on a school tablet
Merge static meshes per material, instance repeated objects, cache geometry, limit shadow casters, cap the pixel ratio and load heavy scenes on demand. The frame rate is checked on a low-end device before release.
6. Ship without breaking what works
Small changes behind a flag, tested on staging against the recorded math outputs, then released. Existing progress is migrated, never reset. That is how Sky World moved to full 3D while every student kept what they had earned.
AI, without the billAI-generated content on a zero AI budget
A tutorial center cannot justify a monthly AI bill, but writing lessons and quizzes at three levels every week buries teachers. Generation runs through one automation endpoint on a free plan, tuned to use as few credits per lesson as possible. Every prompt carries two hard rules: stay at the students' grade level, and use only what is in the source text, with no invented facts. If the endpoint is ever unavailable, the same screen hands the teacher a ready prompt for ChatGPT or Gemini. The feature never depends on one provider.
Adaptive learningSeven versions of every question
My first adaptive quiz let teachers pick each student's version. A teacher with forty students cannot make forty choices every quiz, and the point is to react to how a child is answering now. So the teacher only triggers the quiz; each item is written in seven versions, and the system chooses per student, per item, live. The rule that does not bend: the same number of items and the same points for everyone. Adaptive cannot mean unfair.
Learning designRead-aloud that teaches itself out of a job
A child who always hears the text learns to listen, not to read. The answer is scaffolding that fades: in Guided mode the child tries first, help appears when they struggle and shrinks as they improve. Teachers set it per grade. Because stories switch between Filipino and English, read-aloud detects each text's language and keeps one voice for the whole story.
ReliabilityThe bug that quietly ate six months of settings
Grade levels and courses would sometimes vanish. On every page load there is a moment before the database answers when lists look empty. Six admin actions fell back to the built-in defaults when a list looked empty, and an admin click in that split second saved the short default list over the real one. The fix was one rule: no admin action runs until the real data has arrived. An empty list and a list that has not loaded yet are not the same thing.
ReliabilityWhen the browser itself blocks your database
Some students could not save their work: a browser's tracking prevention was blocking the database connection. Asking every family to change a setting is not an answer for a product. The app now notices a stalled save and retries through a separate route the browser does not block, with a throttle so retries cannot pile up. The students who need it never know it exists.
Parent communicationTexts parents actually read
Parents do not read email, and Messenger only allows business messages within a day of the last reply. Reminders moved to SMS. Then texts started disappearing: carriers silently block messages with words like "password" or "code", which is exactly what a welcome text contains. Sign-in details now go out as short labels. One relay handles every message type, the system decides when to send, and the automation writes the wording, so a full front office of reminders and weekly reports runs with no one at the desk.
Client work · SunnytailA deposit is part of the booking, not a follow-up
In most small businesses the booking happens in one place and the payment proof arrives later, as a screenshot someone matches by hand. For Sunnytail, the deposit lives inside the booking flow. The customer pays by QR and uploads the receipt, and the system reads it before the owner sees the booking. The owner still taps to confirm, because that is how this client runs the business. Automation should take the checking off a person's plate, not take the decision away from them.