[AI Collaboration] Learning English through AI-Driven 3D Modeling: Modeling a Guinea Pig with Spatial Logic

Learning English through AI-Driven 3D Modeling: Modeling a Guinea Pig with Spatial Logic

The Story

Reconstructing a guinea pig's unique, rounded silhouette requires a deep understanding of spatial logic. By analyzing a reference photo, Gemini generated a Python script that translates a living creature into a series of mathematical instructions for Blender. This process allows us to study professional English terms used in 3D development while seeing them applied to a tangible, "cute" result.

Guinea Pig Reference

Reference Image

Guinea Pig 3D Model

3D Model Render


AI's Explanation

  1. Symmetry and Offsets: "To create the eyes and ears efficiently, I used a loop to mirror the components across the X-axis, ensuring perfect symmetry while maintaining individual location data."
  2. Material Assignment: "The guinea pig features a multi-colored coat. I iterated through the mesh polygons to assign different material indices, creating the characteristic white stripe on the brown fur."
  3. Attribute Adjustment: "For the eyes, I lowered the roughness and increased the specular value to achieve a realistic, 'glossy' look that contrasts with the matte body."

Key Words and Phrases

iterate

To perform a process repeatedly, often to apply changes to every individual part of a group (like polygons in a mesh).

Context: "I iterated through the mesh polygons to assign different material indices."

specular

Relating to or having the properties of a mirror; in 3D, it controls the brightness of highlights on a surface.

Context: "Increased the specular value to achieve a realistic, 'glossy' look."

loop

A programming structure that repeats a sequence of instructions; used here to mirror components across an axis with consistent logic.

Context: "I used a loop to mirror the components across the X-axis."

Script Preview

Copy and paste the code below into Blender's Text Editor to generate your own 3D guinea pig.

Python
import bpy
import math

def create_soft_mat(name, color, roughness=1.0, specular=0.0):
    mat = bpy.data.materials.new(name=name)
    mat.use_nodes = True
    bsdf = mat.node_tree.nodes.get("Principled BSDF")
    if bsdf:
        bsdf.inputs['Base Color'].default_value = color
        bsdf.inputs['Roughness'].default_value = roughness
        if 'Specular IOR Level' in bsdf.inputs:
            bsdf.inputs['Specular IOR Level'].default_value = specular
    return mat

def run():
    # Delete all
    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete()

    # 1. Body
    bpy.ops.mesh.primitive_uv_sphere_add(segments=128, ring_count=64, radius=1.0)
    body = bpy.context.active_object
    body.name = "GP_Body"
    body.scale = (1.1, 1.35, 0.95)
    bpy.ops.object.transform_apply(scale=True)
    
    brown_mat = create_soft_mat("CaramelBrown", (0.55, 0.3, 0.1, 1.0))
    white_mat = create_soft_mat("SnowWhite", (0.95, 0.95, 0.95, 1.0))
    body.data.materials.append(brown_mat)
    body.data.materials.append(white_mat)

    for poly in body.data.polygons:
        c = poly.center
        is_nose_stripe = (abs(c.x) < 0.16) and (c.y < -0.4) and (c.z > -0.2)
        is_back_band = (0.25 < c.y < 0.55)
        poly.material_index = 1 if (is_nose_stripe or is_back_band) else 0

    bpy.ops.object.shade_smooth()

    # 2. Eyes
    eye_mat = create_soft_mat("ShinyButtonEye", (0.01, 0.01, 0.01, 1.0), roughness=0.1, specular=1.0)
    for side in [-1, 1]:
        side_name = "L" if side > 0 else "R"
        bpy.ops.mesh.primitive_uv_sphere_add(radius=0.11, location=(0.55 * side, -1.05, 0.25))
        eye = bpy.context.active_object
        eye.name = f"GP_Eye_{side_name}"
        eye.data.materials.append(eye_mat)
        eye.parent = body

    # 3. Ears
    for side in [-1, 1]:
        side_name = "L" if side > 0 else "R"
        bpy.ops.mesh.primitive_uv_sphere_add(radius=0.18, location=(0.6 * side, -0.4, 0.75))
        ear = bpy.context.active_object
        ear.name = f"GP_Ear_{side_name}"
        ear.scale = (0.8, 0.2, 0.9)
        ear.rotation_euler = (0.3, 0.4 * side, 0)
        ear.data.materials.append(brown_mat)
        ear.parent = body

    # 4. Nose
    pink_mat = create_soft_mat("NosePink", (0.9, 0.65, 0.65, 1.0))
    bpy.ops.mesh.primitive_uv_sphere_add(radius=0.07, location=(0, -1.35, -0.05))
    nose = bpy.context.active_object
    nose.name = "GP_Nose"
    nose.data.materials.append(pink_mat)
    nose.parent = body

    # 5. Feet
    for y_p in [-0.65, 0.65]:
        for x_s in [-0.5, 0.5]:
            front_back = "Front" if y_p < 0 else "Back"
            left_right = "L" if x_s > 0 else "R"
            
            bpy.ops.mesh.primitive_uv_sphere_add(radius=0.17, location=(x_s, y_p, -0.78))
            foot = bpy.context.active_object
            foot.name = f"GP_Foot_{front_back}_{left_right}"
            foot.scale = (1.0, 1.1, 0.4)
            foot.data.materials.append(pink_mat)
            foot.parent = body

    # 6. Whiskers
    whisker_mat = create_soft_mat("WhiskerGray", (0.8, 0.8, 0.8, 1.0), roughness=0.5)
    for side in [-1, 1]:
        side_label = "L" if side > 0 else "R"
        for i in range(3):
            bpy.ops.mesh.primitive_cylinder_add(radius=0.005, depth=1.1, location=(0.35 * side, -1.2, 0.0))
            whisker = bpy.context.active_object
            whisker.name = f"GP_Whisker_{side_label}_{i+1}"
            angle_offset = (i - 1) * 0.25
            whisker.rotation_euler = (0.1, math.pi / 2 + (0.3 * side), angle_offset)
            whisker.data.materials.append(whisker_mat)
            whisker.parent = body

run()

Comments

Popular posts from this blog

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

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

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