Dev.to WebDev 🛠 Dev 👁 0 📖 7 min read

Five Palaces, One Model: Testing Google’s Gemini 4 Hydrogen in AI Studio

Last week Google shipped Gemini 4 Hydrogen, and within hours my X timeline was nothing but 3D scenes, animations and generative art built from a single prompt. I couldn't just scroll past it, so I opened a browser tab an

Five Palaces, One Model: Testing Google’s Gemini 4 Hydrogen in AI Studio

Last week Google shipped Gemini 4 Hydrogen, and within hours my X timeline was nothing but 3D scenes, animations and generative art built from a single prompt. I couldn't just scroll past it, so I opened a browser tab and started building.

The result is Imperial Palaces: an interactive 3D world with five hand-coded (well, Hydrogen-coded) palaces, five camera views, a golden-hour/moonlit lighting switch, falling petals you can turn up to a blizzard, a synthesized koto soundtrack, and a one-click PNG snapshot.

👉 Live demo: palaces-eight.vercel.app
👉 Source: github.com/amananandrai/Palaces

Edo Sanctuary at golden hour

What is Gemini 4 Hydrogen?

Quick context if you missed the launch. Hydrogen is the fast, cheaper tier of the Gemini 4 family. It sits next to the heavier Gemini 4 Carbon and Gemini 4 Argon models and replaces the old "Flash" branding.

  • Launched: November 12, 2026
  • Built for: everyday coding and agentic workflows
  • Speed: Google says it finishes tasks about 2.5× faster than Gemini 3.8 Flash
  • Context: 1M-token context window, with four thinking levels (low, medium, high (the default) and a new xhigh)
  • Where to use it: Gemini app, Google Search, Google AI Studio, the Gemini API and Antigravity
  • API pricing: $1.50 per 1M input tokens and $7.50 per 1M output tokens

Here's the official announcement:

// Detect dark theme var iframe = document.getElementById('tweet-2120940683233984862-949'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2120940683233984862&theme=dark" }

The inspiration: X went wild

What got me to open AI Studio wasn't the benchmark chart. It was the stuff people were making.

A code-based painting. Vamsi Batchu shared artwork that looks hand-painted but is pure single-file code: no external libraries, no image generators and no embedded assets. He gave Hydrogen a reference image and asked for a range of subjects in that painterly, gouache-like style.

// Detect dark theme var iframe = document.getElementById('tweet-2121788887823778297-426'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2121788887823778297&theme=dark" }

Hydrogen vs. 3.8 Flash on the same 3D scene. Google itself boosted this one: the same animated 3D desert ranch prompt run on both models, with Hydrogen bringing the scene to life in under a minute.

// Detect dark theme var iframe = document.getElementById('tweet-2121037841287249920-693'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2121037841287249920&theme=dark" }

A 3D city on an open book. This one came from before launch, while Hydrogen was being tested anonymously on Arena. Pankaj Kumar asked it for a 3D city sitting on an open book, and the whole site was generated in under 4 minutes.

// Detect dark theme var iframe = document.getElementById('tweet-2118751781333483848-414'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2118751781333483848&theme=dark" }

And if you want the full firehose, Min Choi's roundup threads are a great rabbit hole:

// Detect dark theme var iframe = document.getElementById('tweet-2121634011676356615-784'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2121634011676356615&theme=dark" }

Attempt #1: the Gemini app (didn't go well)

My first move was the obvious one: open the Gemini app and describe the scene I wanted, a Japanese Edo-era castle in a sakura garden.

The results weren't close to what I was seeing on X. The scenes were flatter and less detailed, and iterating on them felt clunky. Part of the reason is that free users in the Gemini app get Hydrogen through automatic model selection, so you don't always know which model is answering. The app is also built for chat, not for iterating on a multi-file 3D project.

Attempt #2: Google AI Studio (this is where it clicked)

So I moved to Google AI Studio, picked Gemini 4 Hydrogen explicitly, and used its app-building mode. That changed everything:

  • I knew exactly which model and thinking level I was using.
  • The output was a real React + TypeScript + Three.js + Vite project, not a single blob of HTML.
  • I could preview it live and keep refining in place.

From one castle to five palaces

The first good version was just the Edo Sanctuary: a multi-tiered castle keep, cherry trees, an arched red taiko-bashi bridge over a stream, stone lanterns, a koi pond and a sunset mountain backdrop. From there I refined it over a few rounds:

  1. Camera presets. Instead of only free-orbiting, I asked for curated views that fly the camera smoothly to the pond, the bridge, the palace and the horizon.
  2. Time of day. A Golden Hour / Moonlit Night toggle that blends the sun, sky, hemisphere light and water reflections instead of hard-cutting.
  3. Atmosphere controls. Calm / Breeze / Flurry petal density (240 → 640 → 1,200 particles) plus a wind-strength slider.
  4. Sound. An ambient soundscape made entirely with the Web Audio API.
  5. Snapshot. Export the current view as a PNG.
  6. More palaces. Russian, Victorian, Mughal and Persian scenes, each with its own bridge, water feature and particle type.

By the end the project was roughly 12,000 lines of TypeScript, and the codebase has no image or audio files to speak of: textures, geometry and sound are all generated in code.

The tour

Five camera views

The dock at the bottom has five presets. Pick one and the camera glides there; drag the scene and you're back to free orbit.

Grand Vista: the establishing shot shown at the top of this post.

Pond View: koi swimming under lily pads, with a wooden viewing pier in the corner.

Pond View

Bridge View: the red taiko-bashi bridge over the stream.

Bridge View

Palace View: up close with the castle keep's tiered roofs and gold crests.

Palace View

Horizon View: pulled back toward the mountains and the setting sun.

Horizon View

Breeze: petals and wind

Petal density has three levels, Calm, Breeze (the default) and Flurry, and the wind slider controls how hard the petals drift. Here it is on Flurry:

Flurry petal density

The particle type changes with each palace: sakura petals in Japan, snowfall in Russia, twilight motes at the Victorian manor and blossom or desert breezes in the Mughal and Persian scenes.

Moonlit Night

One click turns golden hour into a moonlit night. The sky goes deep indigo, the stars come out, the lanterns and windows glow warm, and the moon leaves a streak of light on the pond.

Moonlit Night

The pond at night is my favorite spot in the whole project:

Moonlit koi pond

Snapshot

The Snapshot button in the top right grabs the WebGL canvas with canvas.toDataURL('image/png') and downloads it as palace-<style>-<timeOfDay>.png. This is an untouched export straight from the button:

Snapshot export

Five palaces

The top nav switches between five architectural styles, and each comes with its own setting:

Russian: Winter Terem Kremlin. Onion domes, a frozen rink, ice fishing, snowy pines and a granite bridge.

Winter Terem Kremlin

Victorian: Gothic Tudor Manor. A clock tower, a cast-iron arch bridge and a swan fountain lake.

Gothic Tudor Manor

Mughal: Diwan-i-Khas. White domes and chhatris, a stone bridge and an octagonal charbagh pool.

Diwan-i-Khas

Persian: Safavid Desert Oasis. Turquoise tile domes, a triple-arch bridge, a qanat lagoon and palms.

Safavid Desert Oasis

Zen mode

Press H (or "Hide Controls") to slide the dock away and just enjoy the view.

Zen mode

Under the hood

A few things in the generated code impressed me:

  • Procedural textures. Stone, roof tiles, plaster, the namako lattice walls and hinoki wood are all painted at runtime onto CanvasTextures, with matching bump maps.
  • Instanced foliage. Blossoms, leaves, grass blades and cattails use THREE.InstancedMesh with per-instance colors, so thousands of petals stay smooth.
  • Synthesized audio. The ambient engine builds stream water and garden wind from filtered noise, and plays koto-style plucks on a D Hirajoshi pentatonic scale. There isn't a single audio file in it.
  • Smooth transitions. Camera presets and the day/night blend are lerped inside the render loop through refs, so React doesn't re-render every frame.

Stack: React 19 · TypeScript · Three.js · Vite · Tailwind CSS · lucide-react · deployed on Vercel.

What I learned

  1. The tool matters as much as the model. The same model gave me mediocre results in the chat app and great ones in AI Studio. Choosing the model explicitly and getting a real project structure made all the difference.
  2. Get a good v1, then iterate. Hydrogen is fast enough that "make the water reflect the moon" or "add four more palaces" turns into a quick loop instead of a big ask.
  3. The demos on X are real. I went in skeptical and came out with something I'm happy to share.

Go try it, flip to Moonlit Night, crank the petals to Flurry and take a snapshot:

🏯 palaces-eight.vercel.app

If you build something with Hydrogen, drop it in the comments. I'd love to see it! ⭐ The repo is here if you want to poke at the code.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.