better basic example

This commit is contained in:
Vysyr committed 2026-11-01 00:07:02 +01:00
1 parent 1530b74d04
commit 934067f154
9 files changed
+129 -11

No files matched your search

+16 -9
View File
@@ -7,22 +7,28 @@ import math
from ue_workshop import Scene, Sequence, Renderer, camera, lighting, materials
from ue_workshop.paths import PROJECT
REIMPORT = False # True po zmianie modelu w Blenderze; False uzywa assetu z UE
REIMPORT = True # True po zmianie modelu w Blenderze; False uzywa assetu z UE
SKY = True # True: niebo i slonce; False: ciemne studio z trzema swiatlami
# 1. SCENA. Zmien model, kolor podlogi i swiatla.
# 1. SCENA. Zmien model, podloge i swiatla.
scene = Scene("Basics")
character = scene.model(
PROJECT / "source_assets/character/character_custom.blend",
name="CustomCharacter", height=200, reimport=REIMPORT,
)
floor = materials.color("Floor", (0.07, 0.08, 0.11))
scene.primitive("Cube", name="Floor", location=(0, 0, -10), scale=(20, 20, 0.2), material=floor)
lighting.studio(scene)
# tiling=40: tekstura powtorzona 40 razy na kazdej krawedzi podlogi (200 x 200 m).
floor = materials.texture_set("TiledFloor", base_color="source_assets/textures/floor_tiles.png", tiling=40)
scene.primitive("Cube", name="Floor", location=(0, 0, -10), scale=(200, 200, 0.2), material=floor)
if SKY:
# Zachod slonca: dodaj sun_angle=5. Mocniejsza mgla: fog=0.05.
lighting.environment(scene, sun_intensity=1500, fog=0.01)
else:
lighting.studio(scene)
# 2. KAMERA. Jednostki: centymetry; FOV w stopniach.
radius = 550
height = 260
target = (0, 0, 100)
height = 140 # nisko, zeby w kadrze byl horyzont
target = (0, 0, 110)
cam = camera.create(scene, location=(radius, 0, height), target=target, fov=45)
# 3. ANIMACJA. 192 klatki przy 24 FPS = 8 sekund.
@@ -37,7 +43,8 @@ for frame in range(shot.frames):
shot.transform_key(cam, frame, location=(x, y, height), rotation=(0, pitch, angle + 180))
shot.save()
# 4. RENDER. Najpierw obejrzyj scene w Sequencerze.
renderer = Renderer(width=1280, height=720, samples=4, warmup=16, mp4=True)
# 4. RENDER. Najpierw obejrzyj scene w Sequencerze. Muzyke uslyszysz dopiero w MP4.
renderer = Renderer(width=1280, height=720, samples=4, warmup=16, mp4=True,
audio="source_assets/audio/basics_music.wav")
# renderer.render(shot)
# Zamiast filmu: renderer.render(shot, single_frame=96)