이 글은 생성AI, LLM, AI Agent와 그래픽, 디자인, 미디어아트에 관한 자료를 정리한 것이다. 관련 도구 및 예제는 다음 링크에 자세히 설명하였으니 참고한다.
프롬프트에서 생성된 그래픽스 예시
Blender LLM 기반 그래픽 모델링 관련 자료
LLM, ollama, Blender python library 등을 이용하면, 프롬프트를 입력해, 3차원 모델을 자동 생성할 수 있다. 다음은 관련 예시를 보여준다. 
Prompt: Create 100 cubes. The y position of each cube follows the cosine function along the x-axis with random color.
이를 이용해 다음과 같은 GPT 에이전트가 구현된다. 
상세한 동작 메커니즘은 다음 링크를 참고한다.
LLM과 컴퓨터 그래픽스
앞에서 사용한 방법과 동일하게, OpenGL, processing.org 등 3차원 가시화 도구를 이용해 실시간으로 프롬프트를 통해 컴퓨터 그래픽스 장면을 생성할 수 있다. 다음은 프롬프트를 통해 생성된 그래픽스를 보여준다. 
생성된 그래픽스 코드는 다음과 같다. 
from p5 import *
import pandas as pd
# Load the dataset
data = pd.read_csv('input.csv')
def setup():
  size(720, 400)
  no_stroke()
def draw_cone(size_x, size_y, position):
  with push_matrix():
    translate(*position)
    cone(size_x, size_y)
def draw():
  background(20, 100, 24)
  lights()
  rotate_x(frame_count * 0.01)
  # rotate_y(frame_count * 0.01)
  blinn_phong_material()
  interval = 200
  for i, row in data.iterrows():
    x = (i % 3) * interval - interval
    y = 0
    z = (i // 3) * interval - interval
    draw_cone(row['energy'], row['temperature'], (x, y, z))
  locX = mouse_x - width/2
  locY = mouse_y - height/2
  light_specular(0, 0, 255)
  point_light(360, 360*1.5, 360, locX, locY, 400)
if __name__ == '__main__':
  run(mode='P3D')
LLM과 사운드 엔지니어링
동일한 원리로 사운드를 개발할 수 있다. 다음은 LLM을 통해 생성된 사운드 코드를 실행한 결과이다. 
사운드 생성 예
생성된 코드는 다음과 같다.
from psonic import *
import time
from threading import Thread, Condition
set_server_parameter_from_log("127.0.0.1")
def play_mozart(condition):
  while True:
    with condition:
      condition.notifyAll() # Message to threads      
    beat = 0.33
    melody = [
      E5, E5, F5, G5, G5, F5, E5, D5, C5, C5, D5, E5, E5, D5, D5,
      E5, E5, F5, G5, G5, F5, E5, D5, C5, C5, D5, E5, D5, C5, C5
    ]
    # Drum beat pattern
    def play_beat():
      sample(DRUM_HEAVY_KICK, amp=1.5)  # Strong kick drum
      sample(ELEC_CHIME, amp=1.2)  # Electric guitar sample
      sample(BD_ZOME, amp=1.5)
      sleep(beat / 2)
      sample(DRUM_CYMBAL_CLOSED, amp=1.2)  # Closed cymbal
      sample(ELEC_CHIME, amp=0.6)  
      sample(BD_ZOME, amp=0.6)
      sleep(beat / 2)
      sample(DRUM_SNARE_HARD, amp=1.3)  # Strong snare
      sample(ELEC_CHIME, amp=1.2)   
      sample(BD_ZOME, amp=1.3)
      sleep(beat / 2)
      sample(DRUM_CYMBAL_CLOSED, amp=1.2)
      sample(ELEC_CHIME, amp=0.6)  
      sample(BD_ZOME, amp=0.6)
      sleep(beat / 2)
    # Melody, Beat Channel Play 
    for note in melody:
      play(note, amp=1.0) # , release=0.2)  # Melody
      play_beat()  # Beat Pattern
condition = Condition()
mozart_thread = Thread(name='producer', target=play_mozart, args=(condition,))
mozart_thread.start()
input("Press Enter to continue...")
LLM과 피지컬 컴퓨팅
피지컬 컴퓨팅에 많이 사용되는 아두이노 등을 이용해, 프롬프트로 명령을 주면, 임베딩 컴퓨터가 명령을 실행할 수 있는 코드를 LLM이 생성해, 모터, 조명과 같은 액추에이터를 동작시킬 수 있다. 다음은 그 예를 보여준다. 
참고로, 아두이노의 경우, .ino 코드 파일을 실시간으로 컴파일해 아두이노보드로 전송하는 cli 도구가 설치 시 포함되어 있다. 이를 이용해, 컴파일 에이전트를 구현할 수 있다. 
Ollama와 오픈소스 LLM 이용한 건축 이미지 프롬프트 역공학
말이 어렵지만, 사실 멀티모달을 지원하는 llama3.2-vision과 같은 모델이 저렴하게 공개되고 있는 상황이라, 이를 이용하면 쉽게 프롬프트 키워드 역공학해서, 얻은 프롬프트로 이미지를 생성할 수 있다. 
올라마(ollama) 설치 후 이미지를 준비하고, 다음을 실행한다.
ollama run llama3.2-vision
그리고, image 명령을 이용해 해당 파일 경로를 입력하고 설명하라 한다. 이후, 이 설명을 미드저니 프롬프트 키워드로 변경해 달라 하고, 텍스트-이미지 서비스에 역공학된 프롬프트를 입력하면 된다. 다음은 그 결과이다. 
레퍼런스
이 주제와 관련된 레퍼런스는 다음과 같다.
AI 에이전트
- Can I install Pandas (or other modules) into Blender's Python? - Coding / Python Support - Blender Artists Community
 - The Best Ollama Models for Developers and Programmers | by Ramesh kannan s | Dec, 2024 | Medium
 - Best LLM Model for coding : r/LocalLLaMA
 - codellama:7b
 - Comparing multi-agent frameworks
 - CrewAI
 
그래픽 모델링
사운드 엔지니어링
- Music + Coding = Sonic PI. I love music. I love listening to it… | by Derick Castillo | Medium
 - Python-sonic: Programming Music with Python, Sonic Pi and Supercollider
 - sonic-pi: Code. Music. Live.
 - Sonic Pi - The Live Coding Music Synth for Everyone
 - Python DSP module
 - csound: Main repository for Csound
 - librosa
 - Python audio and music signal processing library
 - Link sonic pi to Python - Support, Help & Resources - in_thread
 - Python Sound Synthesis Libraries | Restackio
 
피지컬 컴퓨팅
- AI-Assisted Arduino Programming. The rapid advancement of Large Language… | by LM Po | Medium
 - M5 board
 - Using Llama 3 to control Home Assistant - Configuration / Voice Assistant - Home Assistant Community
 - Using Llama 3 to Control Home Assistant | fixtSE
 - Programming Arduino with Python - DEV Community
 - Compile & Upload Arduino Code with Python | Tinker Assist Blog
 
올라마 및 LLM
댓글 없음:
댓글 쓰기