AI形状内绘画:在特定几何轮廓中生成图像的有趣约束创作方法
有一次刷Instagram看到一张让我停下来放大看的图——整个画面是一个完美的圆形,圆形里面是一座森林小镇、有木屋、有小溪、有星空。圆形外面是纯黑色。这种"把世界装进一个形状里"的视觉冲击力很强。我试着用AI复现这个效果——上来就写"a forest inside a circle",AI给我返回了一张方形的森林图,圆形是后来PS上去的——完全不是那么回事。折腾了十几轮才搞明白:让AI在形状"内部"生成图像,需要用"裁剪/遮罩/约束边界的描述"来暗示——不能靠它自觉。这篇把"形状约束绘画"的几种实现路径从头捋一遍。
圆形构图的天然吸引力——为什么"圆"是最受欢迎的形状约束
人类的眼睛天然被圆形吸引——因为视野本身就是椭圆形的、虹膜是圆形的、太阳和月亮是圆形的。把画面约束在圆形内会立即创造一种"通过舷窗看世界"的窥视感和集中感。
圆形约束Prompt——"a circular composition——the image is contained entirely within a perfect circle centered in the frame, the area outside the circle is pure black (or a solid dark color), inside the circle is a miniature world——a cozy cottage nestled in an autumn forest, warm light glowing from the cottage windows, the trees inside the circle are in full fall color, the circular boundary acts as a window or portal into this small world, the transition at the circular edge is crisp and clean——the image does not spill beyond the boundary, the overall effect is of a snow globe or a looking-glass portal"。让AI遵守圆形边界的技巧——使用"vignette"(暗角)作为过渡,"a strong circular vignette that fades to pure black at the edges——the vignette creates a natural circular frame around the central image"。
圆形约束最适合表现"窥视""微观世界""望远镜视野""水晶球预言"等主题。圆形的内向性(所有视线汇聚到圆心)天然适合做一个视觉的"中心焦点"——所以把画面最重要的元素放在圆心偏上的位置(黄金分割在圆内的映射),让视觉重量感平衡。关于圆形构图的更多分析见AI场景构图绘画。
文字形状约束——在字母和汉字内"装"世界
把图像装进文字/字母的轮廓里——这是标志设计和海报设计的经典手法。AI做文字形状约束的核心思路是:用"In the shape of the letter X"或"formed by the silhouette of the character"来指示AI把画面内容组织成一个字符的轮廓。
字母约束Prompt——"the image is composed in the shape of the letter 'O'——the letter itself is formed by a ring of dense green forest, the trees and foliage curve around to create the circular shape of the O, the hollow center of the O is a patch of bright blue sky, the letter reads clearly as an 'O' when viewed from a distance but reveals itself as a forest upon closer inspection, the surrounding area outside the letter is a neutral light background"。汉字约束——"the image is arranged within the silhouette of the Chinese character '山' (mountain)——the three vertical strokes of the character are formed by three towering mountain peaks, the horizontal base stroke is formed by a continuous ridge line, waterfalls cascade down the mountain-peaks, mist wraps around the middle heights, the character shape is visible in the overall composition but the individual elements are natural landscape features, the image works both as a landscape painting and as a typographic design"。
文字形状约束在AI里的成功率取决于字母/字符的复杂度——简单几何形状的字母(O、I、T、L)成功率高,复杂曲线字母(S、G、R)容易走样。汉字的成功率取决于笔画密度——笔画少的字(山、人、大、天)效果好,笔画多的字(繁、體、龍)AI几乎没法准确约束。关于AI文字相关的更多技巧见AI文字设计教程。
自然界形状——树叶、水滴、云朵的有机轮廓
几何形状(圆、方、三角)是"硬边约束",而自然形状(树叶、水滴、火焰、云朵)是"软边约束"——软边约束更难让AI精确遵守,但视觉效果更有机、更自然。实现软边约束的策略不是"画一个树叶然后把图塞进去",而是"让画面元素的排列自然地呈现为树叶的轮廓"。
树叶形状约束Prompt——"the entire composition is arranged to form the silhouette of a single large leaf——the central vein of the leaf is a winding river that runs from the stem to the tip, the lateral veins are smaller streams branching off the main river, the green tissue of the leaf is formed by dense forest canopy, the serrated edge of the leaf is created by the irregular treeline against a pale sky background, the leaf shape is subtle——it emerges from the landscape naturally rather than being an obvious cutout, the image works as a landscape first and a leaf shape second"。水滴形状——"the image is contained within a teardrop shape——the rounded bottom of the teardrop holds a tiny coral reef ecosystem with colorful fish and sea anemones, the pointed top of the teardrop tapers into a single drop of water falling upward, the teardrop boundary is suggested by the edge of the water itself——the marine world naturally stops where the water ends, the overall feeling is of a world contained in a single drop of ocean"。
自然形状约束的关键——不要让形状边界看起来像"用剪刀剪出来的"。理想的自然形状约束应该是"你第一眼看是一幅正常风景,第二眼才发现——等等,这幅风景的形状是一片叶子"。这种"延迟发现"的惊喜感是自然形状约束在视觉艺术中的核心魅力。参考MoMA的现代平面设计藏品,大量作品使用了这种"隐蔽形状"的手法。
多形状组合与正负形——在约束中玩出视觉双关
形状约束的进阶玩法是"正负形"——一个形状的正空间是一个画面,负空间(留白区域)形成另一个形状或另一个画面。例如:两个面对面的侧脸剪影(正形)——中间的留白形成了一个花瓶(负形),这被称为"鲁宾花瓶"效应。
正负形Prompt——"a figure-ground composition——the positive space is the silhouette of two faces in profile facing each other, each face silhouette contains a different miniature world——the left face contains a daytime city skyline, the right face contains a nighttime starry sky, the negative space between the two faces forms the shape of a candle flame——the flame is made of empty white space defined by the inner contours of the two faces, the image works on two levels——first as two faces, then as a candle"。正负形在AI里实现的难度较高——因为需要AI同时控制两个"相互依赖"的形状。提高成功率的方法:降低复杂度(只用简单的几何正负形,比如圆+方)、使用高对比度(黑白)来明确边界、以及分步生成(先生成正形再Inpainting负形)。关于正负形设计原理见Smashing Magazine的平面设计教程。
常见问题
AI不遵守我指定的形状边界——图总是跑出圆形/三角形外面,怎么强制约束?
AI不会"看到"一个外部叠加的形状蒙版——它只理解Prompt里的文字描述。强制约束的三招组合:第一,在Prompt开头明确声明——"this is a circular composition contained entirely within a circle"。第二,描述边界外的内容——"the area outside the circle is solid black with no image content whatsoever"。第三,使用负向提示——"no image content outside the circular boundary, the circle is a hard edge not a soft fade, the composition is cropped to a perfect circle not a square"。如果工具支持ControlNet——使用Canny模式,给一张纯圆形的边缘参考图作为硬约束。
形状内画面太拥挤——怎么在有限的形状空间里保持视觉呼吸感?
形状约束天然限制了画面空间——所以留白比自由构图更重要。策略:形状内只放1-2个主要元素,其余区域留给"空气"。圆形约束的留白布局——"inside the circle, the composition is minimal——a single tree occupies the center-right portion of the circle, the left portion is open sky, the bottom portion is a simple ground line, at least 40% of the circular area is empty space, the emptiness allows the shape constraint to feel like a deliberate design choice rather than a cramped container"。记住——形状约束的目标是"让形状成为画面的一部分"而不是"把画面硬塞进形状里"。
怎么让形状内外的过渡看起来不突兀——而不是"画了一个形状然后用PS的蒙版裁切"?
突兀感来源于"硬边"——形状内外之间的过渡是像素级的锐利边界。改成"软过渡"有几种方式。第一种是"暗角过渡"——"a gradual darkening vignette that softly fades the image to black at the circular boundary——the transition zone is about 10-15% of the radius, this creates a soft circular frame"。第二种是"元素越界"——故意让形状内的一两个小元素"越界"到形状外,"a single branch from the tree inside the circle extends just slightly beyond the circular boundary——this small violation of the constraint makes the overall constraint feel more organic"。第三种是"纹理边界"——边界不是完美的几何线,而是由画面自然元素的边缘形成的——"the edge of the circular composition is not a perfect geometric line——it is suggested by the outer edge of a wreath of leaves and flowers that forms the circular frame"。