Learning English through AI-Driven 3D Modeling: Crafting a Puppy

Learning English through AI-Driven 3D Modeling: Crafting a Puppy

The Story

The golden retriever puppy is beloved for its soft features and playful energy. Translating this organic warmth into a 3D model involves simplifying complex fur into smooth, inviting shapes. By using a Python script in Blender, we can build a "stylized" version of the puppy that captures its essence through geometric primitives. This project provides an excellent opportunity to learn the English terminology used to describe object structures and refined scene organization within Blender's 3D viewport.

Reference photo of a golden retriever puppy
Reference Image
3D puppy model created with Python script
3D Model Render

AI's Explanation

  1. Refined Organization: "I utilized a dedicated Collection to keep the Outliner clean, ensuring all puppy parts are grouped together for better project management."
  2. Surface Smoothing: "To achieve a polished, toy-like look, I applied Shade Smooth and a Subdivision Surface modifier to all mesh primitives."
  3. Centralized Parameters: "By defining Constants for colors and names, the script becomes highly adaptable, allowing for quick adjustments to the puppy's appearance."

Key Words and Phrases

Collection

A container used to organize objects within a Blender scene. It acts like a folder, making it easier to select or hide related parts of a model.

Context: "I moved all objects into a specific Collection for organization."

Shade Smooth

A display mode that interpolates light across an object's faces to make it appear curved and continuous rather than flat and faceted.

Context: "I executed Shade Smooth to give the puppy a soft, organic surface."

Constants

Variables defined at the beginning of a script that do not change. They serve as a single point of control for settings like color or naming conventions.

Context: "I defined the puppy's fur color as a Constant in the script."

Script Preview

Copy the code below into Blender's Text Editor to generate your own Stylized Puppy model.

Python
import bpy
import math

def create_refined_puppy():
    """
    Generates a stylized puppy model with clean structure, 
    organized collections, and configurable parameters.
    """
    
    # --- CONFIGURATION / CONSTANTS ---
    COLLECTION_NAME = "Stylized_Puppy"
    
    COLORS = {
        'BODY': (0.8, 0.55, 0.3, 1.0),   # Warm Golden Tan
        'EYE':  (0.01, 0.01, 0.01, 1.0), # Deep Black
        'NOSE': (0.1, 0.05, 0.02, 1.0)   # Dark Brown
    }

    # --- INITIALIZATION ---
    if bpy.context.mode != 'OBJECT':
        bpy.ops.object.mode_set(mode='OBJECT')
        
    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete()

    if COLLECTION_NAME not in bpy.data.collections:
        new_col = bpy.data.collections.new(COLLECTION_NAME)
        bpy.context.scene.collection.children.link(new_col)
    
    target_col = bpy.data.collections[COLLECTION_NAME]

    # --- HELPER FUNCTIONS ---
    def create_material(name, color):
        mat = bpy.data.materials.new(name=name)
        mat.use_nodes = True
        nodes = mat.node_tree.nodes
        bsdf = nodes.get("Principled BSDF")
        if bsdf:
            bsdf.inputs['Base Color'].default_value = color
            bsdf.inputs['Roughness'].default_value = 0.3
        return mat

    def finalize_object(obj, material):
        obj.data.materials.append(material)
        for col in obj.users_collection:
            col.objects.unlink(obj)
        target_col.objects.link(obj)
        
        bpy.context.view_layer.objects.active = obj
        bpy.ops.object.shade_smooth()
        
        subsurf = obj.modifiers.new(name="Subdivision", type='SUBSURF')
        subsurf.levels = 2

    def add_part(type, name, loc, scale, rot=(0, 0, 0), mat=None):
        if type == 'SPHERE':
            bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=loc, rotation=rot)
        elif type == 'CYLINDER':
            bpy.ops.mesh.primitive_cylinder_add(radius=1, depth=2, location=loc, rotation=rot)
        elif type == 'CUBE':
            bpy.ops.mesh.primitive_cube_add(location=loc, rotation=rot)
            
        obj = bpy.context.active_object
        obj.name = name
        obj.scale = scale
        if mat:
            finalize_object(obj, mat)
        return obj

    # --- ASSET CREATION ---
    mat_body = create_material("Mat_Puppy_Body", COLORS['BODY'])
    mat_eye  = create_material("Mat_Puppy_Eye",  COLORS['EYE'])
    mat_nose = create_material("Mat_Puppy_Nose", COLORS['NOSE'])

    # 1. Body Construction
    add_part('SPHERE', "Body_Front", (0, 0, 1.5),   (1.2, 1.2, 1.2), mat=mat_body)
    add_part('SPHERE', "Body_Mid",   (0, 1.2, 1.4), (1.0, 1.0, 1.0), mat=mat_body)
    add_part('SPHERE', "Body_Back",  (0, 2.4, 1.5), (1.1, 1.1, 1.1), mat=mat_body)

    # 2. Head and Facial Features
    add_part('SPHERE', "Head",      (0, -0.8, 2.8), (1.1, 1.1, 1.1), mat=mat_body)
    add_part('SPHERE', "Snout",     (0, -1.8, 2.6), (0.5, 0.5, 0.4), mat=mat_body)
    add_part('SPHERE', "Nose_Tip",  (0, -2.25, 2.7), (0.15, 0.15, 0.15), mat=mat_nose)
    
    # Eyes
    add_part('SPHERE', "Eye_L", (-0.4, -1.65, 3.1), (0.12, 0.12, 0.12), mat=mat_eye)
    add_part('SPHERE', "Eye_R", (0.4, -1.65, 3.1),  (0.12, 0.12, 0.12), mat=mat_eye)
    
    # Ears
    for side in [-1, 1]:
        rot_y = 0.5 * side
        add_part('CUBE', f"Ear_{'L' if side < 0 else 'R'}", 
                 (1.1 * side, -0.6, 3.0), (0.1, 0.6, 0.4), rot=(0.3, rot_y, 0), mat=mat_body)

    # 3. Limbs (Legs and Paws)
    leg_positions = [(-0.8, 0.2), (0.8, 0.2), (-0.8, 2.2), (0.8, 2.2)]
    for i, (x, y) in enumerate(leg_positions):
        add_part('CYLINDER', f"Leg_{i}", (x, y, 0.7), (0.25, 0.25, 0.7), mat=mat_body)
        add_part('SPHERE',   f"Paw_{i}", (x, y - 0.1, 0.1), (0.35, 0.35, 0.3), mat=mat_body)

    # 4. Tail
    add_part('CYLINDER', "Tail", (0, 3.2, 2.3), (0.15, 0.15, 0.6), 
             rot=(math.radians(-45), 0, 0), mat=mat_body)

if __name__ == "__main__":
    create_refined_puppy()

Comments

Popular posts from this blog

シャキシャキ美味しい!スナップエンドウ、英語でどう言う?

[AI & Seasonal English]: 半夏生編 -「半夏生」で日本の美しい暦と英語を学ぼう!

[AI & Seasonal English] 【スパイス香る】ドイツのクリスマスパン「シュトーレン(Stollen)」の歴史と「しっとり感」を語る英語