-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils_example.py
46 lines (34 loc) · 960 Bytes
/
utils_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Example script which creates a simple scene.
To run, execute
blender --background --python ./utils_example.py
in shell.o
"""
import bpy
import os
import sys
import importlib
from utils import *
import HDRI.hdri as hdri
clear_scene()
tower = import_mesh("assets/STL samples/Eiffel_tower.STL")
myScene = bpy.context.scene
myCamera = OrbitCam()
myCamera.set_distance(6)
myRenderer = Renderer(myCamera.camera)
myRenderer.set_final_render(
file_path = bpy.path.relpath("result.png"),
animation = False,
use_transparent_bg = False,
num_samples = 32
)
myCamera.rotate_z(150)
myCamera.rotate_x(30)
hdri.initialize_world_texture()
path = bpy.path.abspath(os.getcwd() + "/" + "assets/HDRIs/green_point_park_2k.hdr")
hdri.set_background_image(path)
hdri.pan_background_vertical(10)
hdri.pan_background_horizontal(-20)
export_blend(os.path.abspath(os.getcwd() + "/renders/export.blend"))
myRenderer.render()
print(myCamera.get_location())