Skip to content

Commit

Permalink
Add light rotation setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ydeltastar committed Nov 13, 2024
1 parent c735980 commit 637a30d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) ydeltastar.
Copyright (c) 2024 ydeltastar.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
1 change: 1 addition & 0 deletions addons/scene_texture/SceneRender.gd
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func update_from_texture(texture:SceneTexture):
main_light.light_energy = texture.light_energy
main_light.light_angular_distance = texture.light_angular_distance
main_light.shadow_enabled = texture.light_shadow
main_light.global_rotation = texture.light_rotation

var world: World3D = texture.world_3d
if not is_instance_valid(world):
Expand Down
10 changes: 8 additions & 2 deletions addons/scene_texture/SceneTexture.gd
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var camera_rotation = Vector3(deg_to_rad(-40), deg_to_rad(-25), 0):
light_color = value
_queue_update()

@export var light_energy: float = 1.0:
@export var light_energy: float = 2.5:
set(value):
light_energy = value
_queue_update()
Expand All @@ -142,12 +142,18 @@ var light_angular_distance: float = 0:
light_shadow = value
_queue_update()

@export_custom(PROPERTY_HINT_RANGE, "-360,360,0.1,radians_as_degrees")
var light_rotation = Vector3(deg_to_rad(-60), deg_to_rad(60), 0):
set(value):
light_rotation = value
_queue_update()

@export_group("Render", "render_")
## Automatically request bake when settings change.
## [br][br]
## [b]Note:[/b] Changes to [Environment] and [CameraAttributes] can't be automatically catch so they require calling [method bake] manually.
@export var render_auto_bake = true
## Use [ProjectSetting]'s `rendering/global_illumination/sdfgi/frames_to_converge` to render multiple
## Use [ProjectSettings] [b]rendering/global_illumination/sdfgi/frames_to_converge[/b] to render multiple
## times so SDFGI stabilizes. Can slow down rendering significantly; use only when SDFGI is enabled.
@export var render_use_frames_to_converge = false

Expand Down
1 change: 1 addition & 0 deletions addons/scene_texture/editor/scene_texture_preview.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ size_flags_vertical = 3
script = ExtResource("1_m1d30")

[node name="VBoxContainer" type="VBoxContainer" parent="."]
visible = false
layout_mode = 2
size_flags_horizontal = 3
alignment = 1
Expand Down
23 changes: 16 additions & 7 deletions demo/main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ script = ExtResource("1_oi2nq")
width = 96
height = 96
scene = ExtResource("3_ppkn1")
render_method = 1
render_method = 0
transparent_bg = true
scene_position = Vector3(0, 0, 0)
scene_rotation = Vector3(0, 0, 0)
Expand All @@ -26,9 +26,10 @@ camera_distance = 2.28
camera_position = Vector3(0, 0.72, 0)
camera_rotation = Vector3(-0.523599, -0.436332, 0)
light_color = Color(1, 1, 1, 1)
light_energy = 1.0
light_energy = 2.5
light_angular_distance = 0.0
light_shadow = false
light_rotation = Vector3(-1.0472, 1.0472, 0)
render_auto_bake = true
render_use_frames_to_converge = false

Expand All @@ -51,6 +52,7 @@ light_color = Color(1, 1, 1, 1)
light_energy = 1.0
light_angular_distance = 0.0
light_shadow = false
light_rotation = Vector3(-1.0472, 1.0472, 0)
render_auto_bake = true
render_use_frames_to_converge = false

Expand All @@ -73,6 +75,7 @@ light_color = Color(1, 1, 1, 1)
light_energy = 1.0
light_angular_distance = 0.0
light_shadow = false
light_rotation = Vector3(-1.0472, 1.0472, 0)
render_auto_bake = true
render_use_frames_to_converge = false

Expand All @@ -92,9 +95,10 @@ camera_distance = 1.245
camera_position = Vector3(0.05, -0.01, 0)
camera_rotation = Vector3(-0.523599, -0.436332, 0)
light_color = Color(1, 1, 1, 1)
light_energy = 3.015
light_energy = 2.5
light_angular_distance = 0.0
light_shadow = false
light_rotation = Vector3(-1.0472, 0.476475, 0)
render_auto_bake = true
render_use_frames_to_converge = false

Expand All @@ -112,11 +116,12 @@ scene_rotation = Vector3(0, 0.71384, 0)
scene_scale = Vector3(1, 1, 1)
camera_distance = 2.28
camera_position = Vector3(0, 0.72, 0)
camera_rotation = Vector3(-0.523599, -0.436332, 0)
camera_rotation = Vector3(-0.523599, 0.277507, 0)
light_color = Color(1, 1, 1, 1)
light_energy = 1.0
light_angular_distance = 0.0
light_shadow = false
light_rotation = Vector3(-1.0472, 1.0472, 0)
render_auto_bake = true
render_use_frames_to_converge = false

Expand Down Expand Up @@ -154,6 +159,7 @@ light_color = Color(1, 1, 1, 1)
light_energy = 1.0
light_angular_distance = 0.0
light_shadow = false
light_rotation = Vector3(-1.0472, 1.0472, 0)
render_auto_bake = true
render_use_frames_to_converge = false

Expand All @@ -168,7 +174,7 @@ scene_pivot = NodePath("ScenePivot")
environment = ExtResource("2_i30cj")

[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
transform = Transform3D(-0.866024, -0.433016, 0.250001, 0, 0.499998, 0.866026, -0.500003, 0.749999, -0.43301, 0, 0, 0)
shadow_enabled = true
shadow_blur = 0.0
directional_shadow_blend_splits = true
Expand All @@ -184,9 +190,12 @@ grow_vertical = 2

[node name="CenterContainer" type="CenterContainer" parent="Control"]
layout_mode = 1
anchors_preset = 9
anchor_bottom = 1.0
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_top = -240.5
offset_right = 276.0
offset_bottom = 240.5
grow_vertical = 2

[node name="GridContainer" type="GridContainer" parent="Control/CenterContainer"]
Expand Down

0 comments on commit 637a30d

Please sign in to comment.