自己拖滑块
3D代码画的草地(DialKit 调参)打开 →Mia 的小贴士
- 300 个滑块别从头翻,先动这三组:镜头(拉远一点、放低一点)、草叶(草长、粗细)、光照(亮度、暖一点)。我主要就动了这几个。
- 想看我调完的样子:先下载上面那个设置文件,再点面板最底下的「导入设置」选它。玩乱了点「全部恢复默认」回到 Codex 给的默认值。
- 把「显示草」关掉,能看到草底下那层地形,一个个小山包都在。
- 一次画二十多万根草,挺吃显卡;手机上能玩,旧手机会卡,面板点右上角的小图标打开。
四轮提示词
全程用的是 Codex(GPT-6.1 Sol,推理 xhigh),四轮在同一个对话里接着说。我手上有一段草地录像当参考,你换成自己拍的就行。
Here's a video of grass: grass.mp4 in this folder (frame.jpg is attached as one frame from it). Take the video, turn this into a shader. I want the shader running in the web, and I want you to be as meticulous as you can. Be very pixel perfect. Grab all the colors. Make sure that you're using the same hex codes. Understand each part of the image and then try to recreate that. Deliver one self-contained index.html in this folder (WebGL, no network). Portrait, same framing as the video. It should fill the window on desktop and on phones.
Mia 的小贴士
- 这句是反面教材:它会把你的录像直接贴进网页、再扭一扭,看着一模一样,但什么都调不了。想要「代码画的」,就得在提示词里说出来。
I asked an AI coding agent to turn a video of grass into a shader that runs on the web. My prompt was: "Take the video, turn this into a shader. I want the shader running in the web, and I want you to be as meticulous as you can. Be very pixel perfect. Grab all the colors. Make sure that you're using the same hex codes. Understand each part of the image and then try to recreate that." Image A is a frame of the real video. Image B is what the agent gave me. Its summary: "Self-contained, offline WebGL using the reference texture, video-derived wind, and responsive fullscreen framing. Offscreen checks confirmed exact initial-frame colors." It looks the same because it's basically my video frame pasted in and wobbled. That's not what I wanted: I wanted grass made by code, every blade drawn by the shader, so I can change the wind, the blade length, the light. Why is the other agent not understanding what I'm trying to get to? What exactly should I explain to it, so the next version gets close to the real thing? Keep it practical, I'll paste your answer straight to it.
Rebuild this as procedural grass rendered in the browser. The video is a visual reference for a scene whose individual grass blades are generated by code. The previous version preserved the photograph and distorted it. That misses the central requirement. Construction requirements: - Every visible grass blade must come from procedural geometry or procedural surface intersection calculations. - Instanced curved blade/ribbon geometry rendered with vertex and fragment shaders is acceptable. Choose a practical GPU approach; a single fullscreen fragment shader is optional. - Do not use video frames, grass photographs, image-generated grass, or prerecorded footage as runtime textures, backgrounds, billboards, color maps, or animation. - Procedural mathematical noise is fine. - The finished scene must render and animate with all reference media removed. Study the reference before implementing. Identify its camera angle, framing, tuft arrangement, blade curvature, density, color variation, lighting direction, and shadow structure. The visual features to reproduce are: - Dense, irregular mounds of long, extremely fine grass, with overlapping tufts and deep shaded gaps. - Blades that emerge from rooted clusters, arch over, and drape along coherent local directions. - Variation within and between tufts: length, curvature, orientation, thickness, and color. Avoid obvious repeated clusters. - Layered detail: large mound shapes, smaller bundles, and individual fine strands. - Green, olive, yellow-green, and occasional dry strands, with bright sunlit edges and dark tuft interiors. Match those relationships and the reference camera first. Sampling hex codes alone will not reproduce the appearance: the visible colors also depend on illumination, shadow, blade orientation, and light passing through thin leaves. Use measured reference colors to inform material and lighting choices. Implement wind as blade deformation: - Keep roots anchored. - Increase bending toward blade tips while approximately preserving blade length. - Combine broad traveling gusts with smaller, locally varied motion. - Give neighboring blades correlated motion without making every tuft move identically. Provide controls for wind strength, direction, gust speed, blade length, density, and light direction/intensity. These controls must change the underlying grass or lighting calculations. Work in stages: 1. Match the static camera, tuft masses, blade shapes, and density. 2. Match lighting, shadows, translucency, and color variation. 3. Add wind and controls. 4. Compare screenshots against the reference and correct the largest visible differences. Verify the result: - Freeze wind: the static grass should still resemble the reference. - Change blade length: actual blade shapes and silhouettes must change. - Rotate the light: illumination and shadowing must respond. - Show an additional camera angle or close-up that demonstrates individual blades and depth. - Remove the source media and confirm the app still works. Deliver the implementation and a concise account of remaining visual differences and measured performance. Prioritize believable grass structure and lighting before polishing the interface.
Mia 的小贴士
- 第 2 轮这段不是我写的,是另一个 AI 看了两张截图以后替我写的。说不清哪里不对的时候,这招很好用:把「想要的」和「它做的」并排丢给另一个 AI,问它该怎么讲。
This is a photo of dense ornamental grass growing in mounds. Render a topographical map of the underlying structure: the ground surface hidden beneath the grass, as if all the grass were removed. Show the little hills and hollows exactly where the mounds and gaps are in this photo, from the same camera angle and framing, as a bare clay terrain with thin contour lines. No grass, no text.
Look at the video again. The grass isn't growing on a flat layer. Underneath it, the ground is little hills and hollows: every mound in the video is a hill with grass on top, and the dark gaps are the low ground between them. I had an image model render a topographical map of the structure under the grass: topo.png in this folder (attached). Same camera, same framing as the video, the grass removed. Build the terrain from this map first: high where the map is high, low where it's low, in the same places. Then grow the grass on top of it, rooted on the terrain, so the mounds and gaps line up with the video. You can load topo.png at runtime as a height map, but don't draw the image itself. Everything you can see should stay procedural.
I can tell when the grass looks off, but going back and forth with you in chat doesn't work for that. Let's expose the underlying structure so I can tune it myself. DialKit (Josh Puckett's library for live parameter controls) is in ./vendor/dialkit: browser.global.js and styles.css, plain JavaScript, works offline (see its README.md). Put a DialKit panel on the page and wire every value that changes how the grass looks or moves to a dial, toggle or color control, grouped in folders. Include a toggle that turns the grass off so I can look at the terrain on its own. Replace the old controls with this panel. It has to work on a phone too: touch works, and the panel can collapse so it doesn't cover the grass. Also tell me: how many grass blades are there right now, and how much do their lengths actually vary?
Mia 的小贴士
- DialKit 是 Josh Puckett 做的调参面板,npm 上叫 dialkit,MIT 许可。不想装也行,直接说「把影响外观的参数都做成滑块」,大多数 AI 都会给你做一个。
- 后三轮它每轮都闷头干了半个多小时,别以为卡住了。














