-
Notifications
You must be signed in to change notification settings - Fork 84
/
scene.py
2622 lines (2223 loc) · 118 KB
/
scene.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2021 Victor Soupday
# This file is part of CC/iC Blender Tools <https://github.com/soupday/cc_blender_tools>
#
# CC/iC Blender Tools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# CC/iC Blender Tools is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CC/iC Blender Tools. If not, see <https://www.gnu.org/licenses/>.
import math
import os
import bpy
from mathutils import Vector, Quaternion, Matrix, Euler
from . import colorspace, world, meshutils, nodeutils, rigidbody, physics, modifiers, utils, vars
def add_target(name, container, location):
bpy.ops.object.empty_add(type="PLAIN_AXES", radius = 0.1,
location = location)
target = utils.get_active_object()
target.name = name
utils.set_ccic_id(target)
if container:
target.parent = container
target.matrix_parent_inverse = container.matrix_world.inverted()
return target
def set_contact_shadow(light, distance, thickness, no_jitter=False):
if utils.B420():
light.data.use_shadow = True
light.data.use_shadow_jitter = not no_jitter
else:
light.data.use_contact_shadow = True
light.data.contact_shadow_distance = distance
light.data.contact_shadow_thickness = thickness
def track_to(obj, target):
constraint = obj.constraints.new(type="TRACK_TO")
constraint.target = target
constraint.track_axis = "TRACK_NEGATIVE_Z"
constraint.up_axis = "UP_Y"
def add_light_container():
container = None
for obj in bpy.data.objects:
if obj.type == "EMPTY" and "Lighting" in obj.name and utils.has_ccic_id(obj):
container = obj
if not container:
bpy.ops.object.empty_add(type="PLAIN_AXES", radius=0.01)
container = utils.get_active_object()
container.name = "Lighting"
utils.set_ccic_id(container)
return container
def add_sun_light(name, container, location, rotation, energy, angle):
bpy.ops.object.light_add(type="SUN",
location = location, rotation = rotation)
light = utils.get_active_object()
light.name = name
light.data.name = name
utils.set_ccic_id(light)
light.data.energy = energy
light.data.angle = angle
if container:
light.parent = container
light.matrix_parent_inverse = container.matrix_world.inverted()
return light
def add_spot_light(name, container, location, rotation, energy, blend, size, distance, radius):
bpy.ops.object.light_add(type="SPOT",
location = location, rotation = rotation)
light = utils.get_active_object()
light.name = name
light.data.name = name
utils.set_ccic_id(light)
light.data.energy = energy
light.data.shadow_soft_size = radius
light.data.spot_blend = blend
light.data.spot_size = size
light.data.use_custom_distance = True
light.data.cutoff_distance = distance
if container:
light.parent = container
light.matrix_parent_inverse = container.matrix_world.inverted()
return light
def add_area_light(name, container, location, rotation, energy, size, distance):
bpy.ops.object.light_add(type="AREA",
location = location, rotation = rotation)
light = utils.get_active_object()
light.name = name
light.data.name = name
utils.set_ccic_id(light)
light.data.shape = "DISK"
light.data.size = size
light.data.energy = energy
light.data.use_custom_distance = True
light.data.cutoff_distance = distance
if container:
light.parent = container
light.matrix_parent_inverse = container.matrix_world.inverted()
return light
def add_point_light(name, container, location, rotation, energy, size):
bpy.ops.object.light_add(type="POINT",
location = location, rotation = rotation)
light = utils.get_active_object()
light.name = name
light.data.name = name
utils.set_ccic_id(light)
light.data.shadow_soft_size = size
light.data.energy = energy
if container:
light.parent = container
light.matrix_parent_inverse = container.matrix_world.inverted()
return light
def remove_all_lights(inc_camera = False):
for obj in bpy.data.objects:
if not utils.object_exists(obj):
continue
if utils.has_ccic_id(obj):
if obj.type == "LIGHT":
bpy.data.objects.remove(obj)
elif inc_camera and obj.type == "EMPTY" and "CameraTarget" in obj.name:
bpy.data.objects.remove(obj)
pass
elif obj.type == "EMPTY" and \
("KeyTarget" in obj.name or \
"FillTarget" in obj.name or \
"BackTarget" in obj.name or \
"Lighting" in obj.name):
utils.delete_object_tree(obj)
elif inc_camera and obj.type == "CAMERA":
bpy.data.objects.remove(obj)
else:
if obj.type == "LIGHT":
utils.hide(obj)
obj.hide_render = True
elif inc_camera and obj.type == "EMPTY" and "CameraTarget" in obj.name:
utils.hide(obj)
obj.hide_render = True
pass
elif obj.type == "EMPTY" and \
("KeyTarget" in obj.name or \
"FillTarget" in obj.name or \
"BackTarget" in obj.name):
utils.hide(obj)
obj.hide_render = True
elif inc_camera and obj.type == "CAMERA":
utils.hide(obj)
obj.hide_render = True
def restore_hidden_camera():
# enable the first hidden camera
for obj in bpy.data.objects:
if obj.type == "CAMERA" and not obj.visible_get():
utils.unhide(obj)
bpy.context.scene.camera = obj
return
def camera_setup(context, camera_loc, target_loc):
context = vars.get_context(context)
# find an active camera
camera = None
target = None
for obj in bpy.data.objects:
if camera is None and obj.type == "CAMERA" and utils.has_ccic_id(obj):
camera = obj
camera.location = camera_loc
if target is None and obj.type == "EMPTY" and "CameraTarget" in obj.name and utils.has_ccic_id(obj):
target = obj
target.location = target_loc
if camera is None:
bpy.ops.object.camera_add(enter_editmode=False, align='VIEW', location=camera_loc)
camera = utils.get_active_object()
camera.name = "Camera"
utils.set_ccic_id(camera)
if target is None:
target = add_target("CameraTarget", None, target_loc)
utils.unhide(camera)
utils.unhide(target)
context.scene.camera = camera
track_to(camera, target)
camera.data.lens = 80
camera.data.dof.use_dof = True
camera.data.dof.focus_object = target
camera.data.dof.aperture_fstop = 5.4
camera.data.dof.aperture_blades = 5
camera.data.dof.aperture_rotation = 0
camera.data.dof.aperture_ratio = 1
camera.data.display_size = 0.2
camera.data.show_limits = True
#camera_auto_target(camera, target)
context.scene.render.resolution_x = 1920
context.scene.render.resolution_y = 2560
context.scene.render.resolution_percentage = 100
return camera, target
def camera_auto_target(camera, target):
props = vars.props()
chr_cache = props.get_context_character_cache()
if chr_cache is None:
chr_cache = props.get_character_cache(utils.get_active_object(), None)
if chr_cache is None:
chr_cache = props.import_cache[0]
arm = chr_cache.get_armature()
if arm:
left_eye = utils.find_pose_bone(chr_cache, "CC_Base_L_Eye", "L_Eye")
right_eye = utils.find_pose_bone(chr_cache, "CC_Base_R_Eye", "R_Eye")
head = utils.find_pose_bone(chr_cache, "CC_Base_FacialBone", "FacialBone")
if left_eye is None or right_eye is None or head is None:
return
head_location = arm.matrix_world @ head.head
head_dir = (arm.matrix_world @ head.vector).normalized()
target_location = arm.matrix_world @ ((left_eye.head + right_eye.head) * 0.5)
target.location = target_location + head_dir * 0.03
camera.location = head_location + head_dir * 2
def compositor_setup(context):
context = vars.get_context(context)
context.scene.use_nodes = True
nodes = context.scene.node_tree.nodes
links = context.scene.node_tree.links
nodes.clear()
rlayers_node = nodeutils.make_shader_node(nodes, "CompositorNodeRLayers")
c_node = nodeutils.make_shader_node(nodes, "CompositorNodeComposite")
glare_node = nodeutils.make_shader_node(nodes, "CompositorNodeGlare")
lens_node = nodeutils.make_shader_node(nodes, "CompositorNodeLensdist")
rlayers_node.location = (-780,260)
c_node.location = (150,140)
glare_node.location = (-430,230)
lens_node.location = (-100,150)
glare_node.glare_type = 'FOG_GLOW'
glare_node.quality = 'HIGH'
glare_node.threshold = 0.85
lens_node.use_fit = True
nodeutils.set_node_input_value(lens_node, "Dispersion", 0.025)
nodeutils.link_nodes(links, rlayers_node, "Image", glare_node, "Image")
nodeutils.link_nodes(links, glare_node, "Image", lens_node, "Image")
nodeutils.link_nodes(links, lens_node, "Image", c_node, "Image")
shading = utils.get_view_3d_shading(context)
if shading:
shading.use_scene_world_render = True
def world_setup(context):
context = vars.get_context(context)
hide_view_extras(context, False)
world.copy_material_to_render_world(context)
def setup_scene_default(context, scene_type):
props = vars.props()
prefs = vars.prefs()
context = vars.get_context(context)
# reset brightness
props.lighting_brightness = 1.0
# store selection and mode
current_selected = context.selected_objects
current_active = utils.get_active_object()
current_mode = context.mode
shading = utils.get_view_3d_shading(context)
space_data = utils.get_view_3d_space(context)
# go to object mode
try:
if current_mode != "OBJECT":
bpy.ops.object.mode_set(mode="OBJECT")
if scene_type == "BLENDER":
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = False
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.2
context.scene.eevee.gtao_factor = 1.0
context.scene.eevee.use_bloom = False
context.scene.eevee.bloom_threshold = 0.8
context.scene.eevee.bloom_knee = 0.5
context.scene.eevee.bloom_radius = 6.5
context.scene.eevee.bloom_intensity = 0.05
context.scene.eevee.use_ssr = True
context.scene.eevee.use_ssr_refraction = True
context.scene.eevee.bokeh_max_size = 32
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "None", 0.0, 1.0)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(False)
restore_hidden_camera()
key1 = add_point_light("Light", None,
(4.076245307922363, 1.0054539442062378, 5.903861999511719),
(0.6503279805183411, 0.055217113345861435, 1.8663908243179321),
1000, 0.1)
if shading:
shading.type = 'MATERIAL'
shading.use_scene_lights = True
shading.use_scene_world = False
shading.studio_light = 'forest.exr'
shading.studiolight_rotate_z = 0
shading.studiolight_intensity = 1
shading.studiolight_background_alpha = 0
shading.studiolight_background_blur = 0
space_data.clip_start = 0.1
elif scene_type == "MATCAP":
remove_all_lights(False)
restore_hidden_camera()
if shading:
shading.type = 'SOLID'
shading.light = 'MATCAP'
shading.studio_light = 'basic_1.exr'
shading.show_cavity = True
elif scene_type == "CC3":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.25
context.scene.eevee.gtao_factor = 0.5
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.800000011920929
context.scene.eevee.bloom_knee = 0.5
context.scene.eevee.bloom_radius = 2.0
context.scene.eevee.bloom_intensity = 1.0
context.scene.eevee.use_ssr = True
context.scene.eevee.use_ssr_refraction = True
context.scene.eevee.bokeh_max_size = 32.0
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "Medium High Contrast",
1.0, 0.5)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(False)
restore_hidden_camera()
container = add_light_container()
spot_light_000 = add_spot_light("Key", container,
(-0.9423741102218628, 0.30936846137046814, 0.5819238424301147),
(-0.07044415920972824, 1.2362500429153442, 2.5432639122009277),
50.0, 1.0,
2.0943946838378906, 9.729999542236328,
1.0)
set_contact_shadow(spot_light_000, 0.05000000074505806, 0.0024999999441206455)
spot_light_000.data.color = (1.0, 0.9843137860298157, 0.9529412388801575)
spot_light_001 = add_spot_light("Back", container,
(0.12941402196884155, 1.31780207157135, 0.5352238416671753),
(-0.02363934926688671, 0.8857088685035706, 1.4288825988769531),
96.0, 1.0,
2.6179935932159424, 9.149999618530273,
0.0)
set_contact_shadow(spot_light_001, 0.05000000074505806, 0.0024999999441206455)
spot_light_001.data.color = (1.0, 1.0, 1.0)
spot_light_002 = add_spot_light("Fill", container,
(0.529399573802948, -1.2917252779006958, 0.682123064994812),
(-0.0518769733607769, 1.2371199131011963, -1.1787829399108887),
40.0, 0.32565000653266907,
1.5707961320877075, 50.0,
0.30000001192092896)
set_contact_shadow(spot_light_002, 0.05000000074505806, 0.0024999999441206455)
spot_light_002.data.color = (1.0, 0.9843137860298157, 0.9529412388801575)
sun_light_003 = add_sun_light("Dir. Light", container,
(-0.001717992126941681, -0.03369736298918724, -1.4594181776046753),
(0.8644760847091675, 0.09251046180725098, 0.19978450238704681),
0.5625,
0.009180432185530663)
set_contact_shadow(sun_light_003, 0.05000000074505806, 0.0024999999441206455)
sun_light_003.data.color = (1.0, 1.0, 1.0)
if shading:
if shading.type not in ["MATERIAL", "RENDERED"]:
shading.type = "MATERIAL"
shading.use_scene_lights = True
shading.use_scene_world = False
shading.use_scene_lights_render = True
shading.use_scene_world_render = False
shading.studio_light = "studio.exr"
shading.studiolight_rotate_z = 0
shading.studiolight_intensity = 1.0
shading.studiolight_background_alpha = 0.0
shading.studiolight_background_blur = 0.5
space_data.clip_start = 0.009999999776482582
align_to_head(context, container)
elif scene_type == "STUDIO":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.25
context.scene.eevee.gtao_factor = 0.5
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.3499999940395355
context.scene.eevee.bloom_knee = 0.5
context.scene.eevee.bloom_radius = 2.0
context.scene.eevee.bloom_intensity = 0.10000000149011612
context.scene.eevee.use_ssr = True
context.scene.eevee.use_ssr_refraction = True
context.scene.eevee.bokeh_max_size = 32.0
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "High Contrast",
0.5, 1.0)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(False)
restore_hidden_camera()
container = add_light_container()
spot_light_000 = add_spot_light("Key_cc3iid_2528", container,
(0.3071320056915283, -4.603137016296387, 1.1155518293380737),
(0.39095383882522583, 1.387536644935608, -1.1138966083526611),
400.0, 0.75,
0.75, 7.5,
0.4000000059604645)
set_contact_shadow(spot_light_000, 0.05000000074505806, 0.0024999999441206455)
spot_light_000.data.color = (1.0, 1.0, 1.0)
area_light_001 = add_area_light("Right_cc3iid_2529", container,
(2.065807819366455, 0.8457366824150085, -0.3064761161804199),
(-0.02618018537759781, 1.4189527034759521, 0.3748694360256195),
50.0, 2.0, 9.0)
set_contact_shadow(area_light_001, 0.05000000074505806, 0.0024999999441206455)
area_light_001.data.color = (1.0, 1.0, 1.0)
spot_light_002 = add_spot_light("Ear_cc3iid_2530", container,
(0.6722820401191711, 1.8733025789260864, 0.2355818748474121),
(-0.03316128998994827, 1.3578661680221558, 1.1847020387649536),
100.0, 1.0,
1.0995999574661255, 9.100000381469727,
0.5)
set_contact_shadow(spot_light_002, 0.20000000298023224, 0.20000000298023224)
spot_light_002.data.color = (1.0, 1.0, 1.0)
if shading:
if shading.type not in ["MATERIAL", "RENDERED"]:
shading.type = "MATERIAL"
shading.use_scene_lights = True
shading.use_scene_world = False
shading.use_scene_lights_render = True
shading.use_scene_world_render = False
shading.studio_light = "studio.exr"
shading.studiolight_rotate_z = 0
shading.studiolight_intensity = 0.20000000298023224
shading.studiolight_background_alpha = 0.05
shading.studiolight_background_blur = 0.5
space_data.clip_start = 0.009999999776482582
align_to_head(context, container)
# New presets
elif scene_type == "PRESET_1":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
context.scene.world.sun_threshold = 0.1
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.200
context.scene.eevee.gtao_factor = 1.000
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.800
context.scene.eevee.bloom_knee = 0.500
context.scene.eevee.bloom_radius = 6.500
context.scene.eevee.bloom_intensity = 0.050
context.scene.eevee.use_ssr = False
context.scene.eevee.use_ssr_refraction = False
context.scene.eevee.bokeh_max_size = 100.000
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "Medium Contrast",
0.000, 0.900)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(True)
restore_hidden_camera()
container = add_light_container()
area_light_001 = add_area_light("Light.002", container, (-1.051, -0.809, -0.354), (0.000, -1.266, 0.802), 35.0, 1.0, 40.0)
set_contact_shadow(area_light_001, 0.200, 0.200)
area_light_001.data.color = (1.0000, 1.0000, 1.0000)
target_001 = add_target("target_001", container, (0.000, 0.000, 0.000))
track_to(area_light_001, target_001)
spot_light_002 = add_spot_light("Light.003", container, (1.230, -1.303, -0.191), (-0.000, -1.368, 2.288), 12.0, 0.8, 1.6, 40.0, 0.1)
set_contact_shadow(spot_light_002, 0.200, 0.200)
spot_light_002.data.color = (1.0000, 1.0000, 1.0000)
track_to(spot_light_002, target_001)
area_light_003 = add_area_light("Light.001", container, (0.453, 0.974, 0.000), (0.004, -1.175, 2.927), 10.0, 1.0, 40.0)
set_contact_shadow(area_light_003, 0.200, 0.200)
area_light_003.data.color = (1.0000, 1.0000, 1.0000)
track_to(area_light_003, target_001)
if shading:
if shading.type not in ["MATERIAL", "RENDERED"]:
shading.type = "MATERIAL"
shading.use_scene_lights = True
shading.use_scene_world = False
shading.use_scene_lights_render = True
shading.use_scene_world_render = True
shading.studio_light = "studio.exr"
shading.studiolight_rotate_z = -0.7854
shading.studiolight_intensity = 1.25
shading.studiolight_background_alpha = 0.000
shading.studiolight_background_blur = 0.500
space_data.clip_start = 0.010
world.world_setup(context,
utils.get_resource_path("presets", "veranda_4k.hdr"),
(1,1,1,1),
Vector((0,0,0)), Vector((0, 0, 0)), 1.0,
1.0)
align_to_head(context, container, use_delta_rot=False)
create_backdrop(container, (0.799, 0.799, 0.799, 1.0), 0.75)
elif scene_type == "PRESET_2":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
context.scene.world.sun_threshold = 0.1
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.200
context.scene.eevee.gtao_factor = 1.000
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.800
context.scene.eevee.bloom_knee = 0.500
context.scene.eevee.bloom_radius = 6.500
context.scene.eevee.bloom_intensity = 0.050
context.scene.eevee.use_ssr = False
context.scene.eevee.use_ssr_refraction = False
context.scene.eevee.bokeh_max_size = 100.000
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "Medium Contrast",
0.000, 1.000)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(True)
restore_hidden_camera()
container = add_light_container()
area_light_001 = add_area_light("Light.002", container, (-1.051, -0.809, -0.354), (0.000, -1.266, 0.802), 35.0, 1.0, 40.0)
set_contact_shadow(area_light_001, 0.200, 0.200)
area_light_001.data.color = (1.0000, 1.0000, 1.0000)
target_001 = add_target("target_001", container, (0.000, 0.000, 0.000))
track_to(area_light_001, target_001)
spot_light_002 = add_spot_light("Light.003", container, (1.230, -1.303, -0.191), (-0.000, -1.368, 2.288), 12.0, 0.8, 1.6, 40.0, 0.1)
set_contact_shadow(spot_light_002, 0.200, 0.200)
spot_light_002.data.color = (1.0000, 1.0000, 1.0000)
track_to(spot_light_002, target_001)
area_light_003 = add_area_light("Light.001", container, (0.453, 0.974, 0.000), (0.004, -1.175, 2.927), 10.0, 1.0, 40.0)
set_contact_shadow(area_light_003, 0.200, 0.200)
area_light_003.data.color = (1.0000, 1.0000, 1.0000)
track_to(area_light_003, target_001)
if shading:
if shading.type not in ["MATERIAL", "RENDERED"]:
shading.type = "MATERIAL"
shading.use_scene_lights = True
shading.use_scene_world = False
shading.use_scene_lights_render = True
shading.use_scene_world_render = True
shading.studio_light = "studio.exr"
shading.studiolight_rotate_z = 0.000
shading.studiolight_intensity = 0.000
shading.studiolight_background_alpha = 0.000
shading.studiolight_background_blur = 0.500
space_data.clip_start = 0.010
world.world_setup(context,
"",
(0,0,0,1),
Vector((0,0,0)), Vector((0, 0, 0)), 1.0,
1.0)
align_to_head(context, container, use_delta_rot=False)
create_backdrop(container, (0.799, 0.799, 0.799, 1.0), 0.75)
elif scene_type == "PRESET_3":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
context.scene.world.sun_threshold = 0.1
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.200
context.scene.eevee.gtao_factor = 1.000
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.800
context.scene.eevee.bloom_knee = 0.500
context.scene.eevee.bloom_radius = 6.500
context.scene.eevee.bloom_intensity = 0.050
context.scene.eevee.use_ssr = False
context.scene.eevee.use_ssr_refraction = False
context.scene.eevee.bokeh_max_size = 100.000
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "Medium Contrast",
0.000, 1.000)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(True)
restore_hidden_camera()
container = add_light_container()
spot_light_001 = add_spot_light("Light.001", container, (0.546, -1.256, 0.281), (-0.000, -1.368, 2.288), 50.0, 0.8, 1.6, 40.0, 0.2)
set_contact_shadow(spot_light_001, 0.200, 0.200)
spot_light_001.data.color = (1.0000, 1.0000, 1.0000)
target_001 = add_target("target_001", container, (0.000, 0.000, 0.000))
track_to(spot_light_001, target_001)
if shading:
if shading.type not in ["MATERIAL", "RENDERED"]:
shading.type = "MATERIAL"
shading.use_scene_lights = True
shading.use_scene_world = False
shading.use_scene_lights_render = True
shading.use_scene_world_render = True
shading.studio_light = "courtyard.exr"
shading.studiolight_rotate_z = 0.1745
shading.studiolight_intensity = 1.25
shading.studiolight_background_alpha = 0.000
shading.studiolight_background_blur = 0.500
space_data.clip_start = 0.010
world.world_setup(context,
utils.get_resource_path("presets", "kiara_1_dawn_4k.hdr"),
(1,1,1,1),
Vector((0,0,0)), Vector((0, 0, -0.87266)), 1.0,
1.0)
align_to_head(context, container, use_delta_rot=False)
create_backdrop(container, (0.799, 0.799, 0.799, 1.0), 0.75)
elif scene_type == "PRESET_4":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
context.scene.world.sun_threshold = 0.1
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.200
context.scene.eevee.gtao_factor = 1.000
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.800
context.scene.eevee.bloom_knee = 0.500
context.scene.eevee.bloom_radius = 6.500
context.scene.eevee.bloom_intensity = 0.050
context.scene.eevee.use_ssr = False
context.scene.eevee.use_ssr_refraction = False
context.scene.eevee.bokeh_max_size = 100.000
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "Medium Contrast",
0.000, 1.000)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(True)
restore_hidden_camera()
container = add_light_container()
area_light_001 = add_area_light("Light.001", container, (-1.051, -0.809, -0.354), (0.000, -1.266, 0.802), 35.0, 1.0, 40.0)
set_contact_shadow(area_light_001, 0.200, 0.200)
area_light_001.data.color = (0.4760, 0.7875, 1.0000)
target_001 = add_target("target_001", container, (0.000, 0.000, 0.000))
track_to(area_light_001, target_001)
spot_light_002 = add_spot_light("Light.002", container, (1.230, -1.303, -0.191), (-0.000, -1.368, 2.288), 12.0, 0.8, 1.6, 40.0, 0.1)
set_contact_shadow(spot_light_002, 0.200, 0.200)
spot_light_002.data.color = (1.0000, 1.0000, 1.0000)
track_to(spot_light_002, target_001)
if shading:
if shading.type not in ["MATERIAL", "RENDERED"]:
shading.type = "MATERIAL"
shading.use_scene_lights = True
shading.use_scene_world = False
shading.use_scene_lights_render = True
shading.use_scene_world_render = True
shading.studio_light = "studio.exr"
shading.studiolight_rotate_z = 0.000
shading.studiolight_intensity = 0.05
shading.studiolight_background_alpha = 0.000
shading.studiolight_background_blur = 0.500
space_data.clip_start = 0.010
world.world_setup(context,
"",
(0.109461,0.104617,0.291771,1),
Vector((0,0,0)), Vector((0, 0, 0)), 1.0,
1.0)
align_to_head(context, container, use_delta_rot=False)
create_backdrop(container, (0.799, 0.799, 0.799, 1.0), 0.75)
elif scene_type == "PRESET_5":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
context.scene.world.sun_threshold = 0.1
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.200
context.scene.eevee.gtao_factor = 1.000
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.800
context.scene.eevee.bloom_knee = 0.500
context.scene.eevee.bloom_radius = 6.500
context.scene.eevee.bloom_intensity = 0.050
context.scene.eevee.use_ssr = False
context.scene.eevee.use_ssr_refraction = False
context.scene.eevee.bokeh_max_size = 100.000
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "Medium Contrast",
0.000, 1.000)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(True)
restore_hidden_camera()
container = add_light_container()
spot_light_001 = add_spot_light("Light.003", container, (1.230, -1.303, -0.191), (-0.000, -1.368, 2.288), 12.0, 0.8, 1.6, 40.0, 0.1)
set_contact_shadow(spot_light_001, 0.200, 0.200)
spot_light_001.data.color = (1.0000, 1.0000, 1.0000)
target_001 = add_target("target_001", container, (0.000, 0.000, 0.000))
track_to(spot_light_001, target_001)
area_light_002 = add_area_light("Light.001", container, (-1.051, -0.809, -0.354), (0.000, -1.266, 0.802), 55.0, 1.0, 40.0)
set_contact_shadow(area_light_002, 0.200, 0.200)
area_light_002.data.color = (0.4760, 0.7875, 1.0000)
track_to(area_light_002, target_001)
area_light_003 = add_area_light("Light.002", container, (-0.395, 0.584, 0.064), (0.000, -1.266, 0.802), 35.0, 1.0, 40.0)
set_contact_shadow(area_light_003, 0.200, 0.200)
area_light_003.data.color = (1.0000, 0.6038, 0.2462)
track_to(area_light_003, target_001)
if shading:
if shading.type not in ["MATERIAL", "RENDERED"]:
shading.type = "MATERIAL"
shading.use_scene_lights = True
shading.use_scene_world = False
shading.use_scene_lights_render = True
shading.use_scene_world_render = True
shading.studio_light = "studio.exr"
shading.studiolight_rotate_z = 0.000
shading.studiolight_intensity = 0.1
shading.studiolight_background_alpha = 0.000
shading.studiolight_background_blur = 0.500
space_data.clip_start = 0.010
world.world_setup(context,
"",
(0.107022,0.23074,0.05127,1),
Vector((0,0,0)), Vector((0, 0, 0)), 1.0,
1.0)
align_to_head(context, container, use_delta_rot=False)
create_backdrop(container, (0.799, 0.799, 0.799, 1.0), 0.75)
elif scene_type == "PRESET_6":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
context.scene.world.sun_threshold = 0.1
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.200
context.scene.eevee.gtao_factor = 1.000
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.800
context.scene.eevee.bloom_knee = 0.500
context.scene.eevee.bloom_radius = 6.500
context.scene.eevee.bloom_intensity = 0.050
context.scene.eevee.use_ssr = False
context.scene.eevee.use_ssr_refraction = False
context.scene.eevee.bokeh_max_size = 100.000
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "Medium Contrast",
0.000, 1.000)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(True)
restore_hidden_camera()
container = add_light_container()
area_light_001 = add_area_light("Light.001", container, (-0.981, -0.808, -0.343), (0.000, -1.266, 0.802), 20.0, 1.0, 40.0)
set_contact_shadow(area_light_001, 0.200, 0.200)
area_light_001.data.color = (1.0000, 0.0329, 0.8662)
target_001 = add_target("target_001", container, (0.000, 0.000, 0.000))
track_to(area_light_001, target_001)
area_light_002 = add_area_light("Light.002", container, (1.087, 0.150, 0.071), (0.000, -1.266, 0.802), 20.0, 1.0, 40.0)
set_contact_shadow(area_light_002, 0.200, 0.200)
area_light_002.data.color = (0.0194, 0.0354, 1.0000)
track_to(area_light_002, target_001)
if shading:
if shading.type not in ["MATERIAL", "RENDERED"]:
shading.type = "MATERIAL"
shading.use_scene_lights = True
shading.use_scene_world = False
shading.use_scene_lights_render = True
shading.use_scene_world_render = True
shading.studio_light = "studio.exr"
shading.studiolight_rotate_z = 0.000
shading.studiolight_intensity = 0.05
shading.studiolight_background_alpha = 0.000
shading.studiolight_background_blur = 0.500
space_data.clip_start = 0.010
world.world_setup(context,
"",
(0.0185,0.008568,0.07036,1),
Vector((0,0,0)), Vector((0, 0, 0)), 1.0,
1.0)
align_to_head(context, container, use_delta_rot=False)
create_backdrop(container, (0.799, 0.799, 0.799, 1.0), 0.75)
# Old presets
elif scene_type == "COURTYARD":
context.scene.eevee.use_taa_reprojection = True
if utils.B420():
context.scene.eevee.use_shadows = True
context.scene.eevee.use_volumetric_shadows = True
context.scene.eevee.use_raytracing = True
context.scene.eevee.ray_tracing_options.use_denoise = True
context.scene.eevee.use_shadow_jitter_viewport = True
context.scene.eevee.use_bokeh_jittered = True
context.scene.world.use_sun_shadow = True
context.scene.world.use_sun_shadow_jitter = True
else:
context.scene.eevee.use_gtao = True
context.scene.eevee.gtao_distance = 0.25
context.scene.eevee.gtao_factor = 0.5
context.scene.eevee.use_bloom = True
context.scene.eevee.bloom_threshold = 0.3499999940395355
context.scene.eevee.bloom_knee = 0.5
context.scene.eevee.bloom_radius = 2.0
context.scene.eevee.bloom_intensity = 0.10000000149011612
context.scene.eevee.use_ssr = True
context.scene.eevee.use_ssr_refraction = True
context.scene.eevee.bokeh_max_size = 32.0
view_transform = prefs.lighting_use_look if utils.B400() else "Filmic"
colorspace.set_view_settings(view_transform, "Medium High Contrast",
0.5, 0.6000000238418579)
if context.scene.cycles.transparent_max_bounces < 100:
context.scene.cycles.transparent_max_bounces = 100
remove_all_lights(False)
restore_hidden_camera()
container = add_light_container()