Simulating Real Brush Strokes with Code: A Technical Breakdown of Painting Without Diffusion Models

    Diffusion models dominate AI image generation, but a new approach takes a different path: instead of denoising an image in one step, an intelligent coding model writes programs that simulate real brush strokes on a virtual canvas, completing a painting stroke by stroke. This article breaks down the technical architecture behind this method, including physical modeling of brushes and paint, human-like stroke planning, visual feedback loops, artist persona design, and the cloud infrastructure needed to run such a system.

    Simulating Real Brush Strokes with Code: Painting Without Diffusion Models

    In today’s AI image generation landscape, diffusion-based approaches are overwhelmingly dominant. These tools reconstruct an image by progressively refining random noise and output the final result directly. However, this “one-shot” generation method lacks a genuine physical painting process and cannot capture the artist’s thinking and corrections at the canvas. Recently, an unconventional “AI image creation” technique has drawn attention in the technical community: instead of relying on any traditional generative image model, an intelligent coding model writes code that simulates the movement of a real brush on a virtual canvas, completing the painting stroke by stroke. This approach not only tests the model’s complex programming abilities but also demonstrates the potential of large language models in physical simulation and spatial planning.

    1. Code-Driven Virtual Canvas and Physical Simulation

    Unlike diffusion models, this code-based painting approach makes the “painting process” itself the core. The coding model does not directly generate pixel matrices; instead, it writes a program of over a thousand lines. This program is essentially a painting simulation engine that must precisely control the physical interactions between the brush, the paint, and the canvas.

    1. Medium abstraction and physical modeling: At the code level, brushes, paint, and canvas are no longer simple pixel points but objects with physical properties. For example, paint has wetness, viscosity, and opacity; canvas has texture and absorbency; brushes have width, hardness, and shape. When the virtual brush touches the canvas, the code must calculate how paint spreads through the canvas texture, how wet paints blend, and how colors shift as they dry.
    2. Decomposing an image into massive stroke instructions: A photorealistic artwork may require hundreds of thousands or even millions of simulated strokes. The model must break down its vision of the entire picture into massive numbers of independent stroke instructions, each containing parameters such as coordinates, pressure, color code, and brush type. For example, when painting a shopping cart in a parking lot, the model planned and executed roughly 700,000 simulated strokes, producing code between 1,000 and 2,000 lines.

    2. Human-Like Stroke Planning and Dynamic Adjustment

    Real artistic creation is never mechanical reproduction. A human painter’s arm naturally trembles while drawing, and this imperfection is what gives a work its vitality. This technique cleverly introduces human-like mechanisms at the code level.

    1. Simulating physiological limitations in code: When drawing a stroke, the model deliberately introduces pixel-level path wobble. For example, in one pass painting birds against a sunrise, the first stroke used a specific color code, a brush width of 90 pixels, and 5 slightly wobbling path points. The model explained that this wobble of about 7 pixels was intentional, because even a human arm cannot draw a perfectly straight line. This abstraction and simulation of human physiology brings digital artwork visually closer to traditional art.
    2. Irreversible strokes: To reproduce the real painting experience as faithfully as possible, the model operates under the rule that “a stroke cannot be undone once it lands on the canvas.” This means the model must have strong forward-planning ability: before outputting the coordinates of each stroke, it must predict how that stroke will blend with the existing image—once executed, the result is final.

    3. Visual Feedback and Self-Correction Loop

    Artistic creation is a continuous process of observation and correction. Traditional generative models, once an image is produced, typically can only regenerate via prompt modification. The code-based simulation approach, by contrast, builds a closed loop of visual feedback and self-correction.

    1. Reading dynamic canvas state: Across multiple rounds of painting, the model does not blindly output code. It continuously “observes” the canvas by converting the rendering engine’s current state into data or descriptions it can understand, allowing it to perceive the picture’s real-time progress.
    2. Feedback-driven correction strategy: When the model detects a problem in the current painting (for example, a bird’s back painted too thin, or lines looking messy), it does not modify already-generated code. Instead, it plans new strokes to cover and correct the issue. This vision-based self-correction mechanism makes the model’s creative process much closer to a human painter’s real “paint and adjust” workflow, and greatly improves the refinement of the final result.

    4. Building Independent Artistic Style Through Persona Design

    To prevent the model from merely becoming a “parrot” of existing artists’ styles, this approach introduces a more sophisticated artist-persona construction mechanism.

    1. Fictional backstories and stable styles: The model is asked to design its own artist persona with a fictional background and a consistent creative style. By injecting a “backstory,” the distribution of its initial painting parameters and its stroke preferences change, allowing it to develop a relatively independent artistic style and avoiding the limitations that come from imitating existing styles too closely.
    2. Text feedback for fine-tuning: On top of the persona setting, creators can guide the model to adjust brush parameters and painting engine logic through text feedback. This interaction connects natural language, artistic concepts, and low-level code parameters, offering a new paradigm for personalized digital art.

    5. Engineering Practice and Cloud Architecture Support

    Landing such a complex code-based painting system in production requires powerful underlying compute and a well-designed engineering architecture. Developers need not only to train a language model with strong spatial understanding and physical simulation capabilities, but also to build a high-performance rendering engine.

    At the cloud architecture level, such applications can take advantage of widely adopted cloud-native capabilities. For example, since rendering is typically compute-intensive, elastic compute instances from a cloud provider (such as Baidu AI Cloud) can be used to run the simulation engine of several thousand lines of code, allocating compute on demand. Because the painting process generates massive amounts of intermediate states and simulated frames, this data can be stored efficiently in object storage services. Meanwhile, combined with logging services and monitoring/alerting mechanisms, developers can track the execution status of the model-generated code in real time, ensuring the stability of the self-correction loop. This end-to-cloud collaboration provides a solid foundation for combining complex AI programming with graphics rendering.

    Conclusion

    Simulating real brush strokes with code represents a significant technical exploration in AI image generation. It steps outside the diffusion model’s inherent framework of directly generating pixels, deeply integrating physical simulation, spatial planning, closed-loop feedback, and LLM programming capabilities. This not only provides artists with new tools that offer a greater sense of process and control, but also gives developers a highly valuable reference paradigm for complex programming, physics engine design, and extending LLM applications.