Files
999/scripts/render_sacred_13_organic_gold.py
T

176 lines
7.1 KiB
Python

import math
import numpy as np
from PIL import Image, ImageDraw, ImageFilter
SIZE = 1024
CENTER = SIZE / 2.0
# 1. Base image: deep seamless cosmic background
bg = Image.new('RGBA', (SIZE, SIZE), (2, 4, 14, 255))
bdraw = ImageDraw.Draw(bg)
# Starfield
np.random.seed(108)
for _ in range(450):
x = np.random.randint(0, SIZE)
y = np.random.randint(0, SIZE)
br = np.random.randint(140, 255)
sz = np.random.choice([1, 1, 2, 2, 3], p=[0.65, 0.25, 0.07, 0.02, 0.01])
bdraw.ellipse([x, y, x + sz, y + sz], fill=(br, br, 255, int(br * 0.9)))
# Warm cosmic nebula aura behind star
neb = Image.new('RGBA', (SIZE, SIZE), (0, 0, 0, 0))
ndraw = ImageDraw.Draw(neb)
ndraw.ellipse([140, 120, 880, 860], fill=(30, 20, 55, 95))
ndraw.ellipse([240, 240, 780, 780], fill=(55, 38, 18, 75))
neb = neb.filter(ImageFilter.GaussianBlur(90))
bg = Image.alpha_composite(bg, neb)
# 2. EXACT 13-POINTED STAR (ПЛАВНЫЕ ИЗОГНУТЫЕ ЛЕПЕСТКИ/ЛУЧИ ВМЕСТО ПРЯМЫХ ЛИНИЙ)
N_POINTS = 13
R_TIP = SIZE * 0.465
R_INNER = SIZE * 0.285
R_MEDALLION = SIZE * 0.26
R_CORE = SIZE * 0.095
start_angle = -math.pi / 2.0 # 12 o'clock
# Palette: Soft warm golden glow
GOLD_WHITE = (255, 252, 220, 255)
GOLD_LIGHT = (255, 225, 110, 240)
GOLD_WARM = (235, 175, 45, 200)
GOLD_GLOW = (210, 140, 20, 80)
star_layer = Image.new('RGBA', (SIZE, SIZE), (0, 0, 0, 0))
sdraw = ImageDraw.Draw(star_layer)
# Create smooth curved Bézier petal rays for all 13 points
def bezier_point(p0, p1, p2, t):
x = (1 - t)**2 * p0[0] + 2 * (1 - t) * t * p1[0] + t**2 * p2[0]
y = (1 - t)**2 * p0[1] + 2 * (1 - t) * t * p2[1] + t**2 * p2[1]
return (x, y)
for i in range(N_POINTS):
ang_tip = start_angle + i * (2.0 * math.pi / N_POINTS)
ang_val_l = ang_tip - (math.pi / N_POINTS)
ang_val_r = ang_tip + (math.pi / N_POINTS)
p_tip = (CENTER + R_TIP * math.cos(ang_tip), CENTER + R_TIP * math.sin(ang_tip))
p_val_l = (CENTER + R_INNER * math.cos(ang_val_l), CENTER + R_INNER * math.sin(ang_val_l))
p_val_r = (CENTER + R_INNER * math.cos(ang_val_r), CENTER + R_INNER * math.sin(ang_val_r))
# Smooth curved left side of ray
curve_left = []
# Control point bowed slightly inward for graceful lotus/flame petal silhouette
ctrl_r = (R_TIP + R_INNER) * 0.48
ctrl_ang_l = (ang_tip + ang_val_l) * 0.5 + 0.02
p_ctrl_l = (CENTER + ctrl_r * math.cos(ctrl_ang_l), CENTER + ctrl_r * math.sin(ctrl_ang_l))
for s in range(30):
t = s / 29.0
x = (1 - t)**2 * p_val_l[0] + 2 * (1 - t) * t * p_ctrl_l[0] + t**2 * p_tip[0]
y = (1 - t)**2 * p_val_l[1] + 2 * (1 - t) * t * p_ctrl_l[1] + t**2 * p_tip[1]
curve_left.append((x, y))
# Smooth curved right side of ray
curve_right = []
ctrl_ang_r = (ang_tip + ang_val_r) * 0.5 - 0.02
p_ctrl_r = (CENTER + ctrl_r * math.cos(ctrl_ang_r), CENTER + ctrl_r * math.sin(ctrl_ang_r))
for s in range(30):
t = s / 29.0
x = (1 - t)**2 * p_tip[0] + 2 * (1 - t) * t * p_ctrl_r[0] + t**2 * p_val_r[0]
y = (1 - t)**2 * p_tip[1] + 2 * (1 - t) * t * p_ctrl_r[1] + t**2 * p_val_r[1]
curve_right.append((x, y))
ray_poly = [ (CENTER, CENTER) ] + curve_left + curve_right
# Translucent warm amber backing
sdraw.polygon(ray_poly, fill=(45, 30, 10, 110))
# Glowing smooth strokes
for pts, col, w in [(curve_left, GOLD_GLOW, 6), (curve_left, GOLD_WARM, 3), (curve_left, GOLD_LIGHT, 1),
(curve_right, GOLD_GLOW, 6), (curve_right, GOLD_WARM, 3), (curve_right, GOLD_LIGHT, 1)]:
for p in range(len(pts) - 1):
sdraw.line([pts[p], pts[p+1]], fill=col, width=w)
# Soft curved spine line to tip
spine_pts = []
for s in range(25):
t = s / 24.0
# subtle organic curve
cur_r = R_INNER * 0.9 + t * (R_TIP - R_INNER * 0.9)
cur_a = ang_tip + math.sin(t * math.pi) * 0.03
spine_pts.append((CENTER + cur_r * math.cos(cur_a), CENTER + cur_r * math.sin(cur_a)))
for p in range(len(spine_pts) - 1):
sdraw.line([spine_pts[p], spine_pts[p+1]], fill=GOLD_WHITE, width=2)
# Sparkle at tip
sdraw.ellipse([p_tip[0]-3, p_tip[1]-3, p_tip[0]+3, p_tip[1]+3], fill=GOLD_WHITE)
# 3. Inner Medallion: Smooth ring
med_layer = Image.new('RGBA', (SIZE, SIZE), (0, 0, 0, 0))
mdraw = ImageDraw.Draw(med_layer)
# Dark glass
mdraw.ellipse([CENTER - R_MEDALLION, CENTER - R_MEDALLION, CENTER + R_MEDALLION, CENTER + R_MEDALLION], fill=(7, 9, 22, 245))
# Smooth double golden ring
mdraw.ellipse([CENTER - R_MEDALLION, CENTER - R_MEDALLION, CENTER + R_MEDALLION, CENTER + R_MEDALLION], outline=GOLD_WARM, width=3)
mdraw.ellipse([CENTER - R_MEDALLION + 5, CENTER - R_MEDALLION + 5, CENTER + R_MEDALLION - 5, CENTER + R_MEDALLION - 5], outline=GOLD_LIGHT, width=1)
# 4. CHROME TRISKELION: ОРГАНИЧЕСКИЕ ПЛАВНЫЕ ХВОСТИКИ ДЕВЯТОК
# Center ring:
mdraw.ellipse([CENTER - R_CORE, CENTER - R_CORE, CENTER + R_CORE, CENTER + R_CORE], fill=(3, 5, 14, 255), outline=GOLD_WARM, width=4)
mdraw.ellipse([CENTER - R_CORE + 4, CENTER - R_CORE + 4, CENTER + R_CORE - 4, CENTER + R_CORE - 4], outline=GOLD_WHITE, width=1)
# 3 smooth sweeping golden ribbon tails
for k in range(3):
rot = start_angle + k * (2.0 * math.pi / 3.0)
# Outer curve and inner curve of graceful golden feather/wave
outer_pts = []
inner_pts = []
steps = 60
for s in range(steps + 1):
t = s / float(steps)
# Smooth ease-in-out curve
t_curv = 0.5 * (1.0 - math.cos(t * math.pi))
cr = R_CORE + t_curv * (R_MEDALLION - R_CORE - 8)
ca = rot + t * 1.45
bx = CENTER + cr * math.cos(ca)
by = CENTER + cr * math.sin(ca)
outer_pts.append((bx, by))
# Soft variable width ribbon (tapers to a delicate sharp tip)
thick = math.sin(t * math.pi) * 16.0
ir = max(R_CORE, cr - thick)
inner_ang = ca + (thick / (cr + 1e-4)) * 0.5
ix = CENTER + ir * math.cos(inner_ang)
iy = CENTER + ir * math.sin(inner_ang)
inner_pts.append((ix, iy))
ribbon_poly = outer_pts + inner_pts[::-1]
# Luminous warm gold ribbon fill
mdraw.polygon(ribbon_poly, fill=(230, 165, 30, 130))
# Smooth continuous contour lines
for p in range(len(outer_pts) - 1):
mdraw.line([outer_pts[p], outer_pts[p+1]], fill=GOLD_GLOW, width=5)
mdraw.line([outer_pts[p], outer_pts[p+1]], fill=GOLD_WHITE, width=2)
for p in range(len(inner_pts) - 1):
mdraw.line([inner_pts[p], inner_pts[p+1]], fill=GOLD_WARM, width=2)
# Central photon droplet spark
mdraw.ellipse([CENTER - 3, CENTER - 3, CENTER + 3, CENTER + 3], fill=(255, 255, 255, 245))
# Composite and apply warm luminous optical bloom
comp = Image.alpha_composite(bg, star_layer)
comp = Image.alpha_composite(comp, med_layer)
bloom = comp.filter(ImageFilter.GaussianBlur(8))
final_img = Image.blend(comp, bloom, 0.28)
out_file = '/home/alexives/.gemini/antigravity-ide/brain/4ff924d9-3d7f-4202-9066-3ac5c3088b8e/star_13_organic_golden_flow.png'
final_img.save(out_file, 'PNG')
print("Rendered ORGANIC GOLD 13-pointed star to", out_file)