├── icon.png ├── screenshot.png ├── assets ├── .DS_Store ├── free3d.com │ └── 75-low-poly-buildings │ │ ├── buildings.meshlib │ │ └── low poly buildings.obj.import └── hdriheaven.com │ ├── kloofendal_48d_partly_cloudy_1k.hdr │ └── kloofendal_48d_partly_cloudy_1k.hdr.import ├── .gitignore ├── .gitattributes ├── default_env.tres ├── scenes └── ground │ └── Ground.tscn ├── addons └── camera360 │ ├── PanoramaFromCubeMap.tscn │ ├── PanoramaFromCubeMap.gdshader │ ├── CubeCam.tscn │ ├── PanoramaFromCubeMap.gd │ └── CubeCam.gd ├── project.godot ├── Main.gd ├── icon.png.import ├── screenshot.png.import ├── README.md ├── LICENSE └── Main.tscn /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BastiaanOlij/godot_camera_360/HEAD/icon.png -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BastiaanOlij/godot_camera_360/HEAD/screenshot.png -------------------------------------------------------------------------------- /assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BastiaanOlij/godot_camera_360/HEAD/assets/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.os 3 | .import/ 4 | *.dblite 5 | *.exp 6 | *.lib 7 | *.TMP 8 | logs 9 | Thumbs.db 10 | .godot 11 | .DS_Store -------------------------------------------------------------------------------- /assets/free3d.com/75-low-poly-buildings/buildings.meshlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BastiaanOlij/godot_camera_360/HEAD/assets/free3d.com/75-low-poly-buildings/buildings.meshlib -------------------------------------------------------------------------------- /assets/hdriheaven.com/kloofendal_48d_partly_cloudy_1k.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BastiaanOlij/godot_camera_360/HEAD/assets/hdriheaven.com/kloofendal_48d_partly_cloudy_1k.hdr -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.gd eol=lf 2 | *.tscn eol=lf 3 | *.cfg eol=lf 4 | *.godot eol=lf 5 | *.tres eol=lf 6 | *.import eol=lf 7 | *.materials eol=lf 8 | *.gltf eol=lf 9 | *.shader eol=lf 10 | -------------------------------------------------------------------------------- /default_env.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Environment" load_steps=2 format=3 uid="uid://cl60180yah3q3"] 2 | 3 | [sub_resource type="Sky" id="1"] 4 | 5 | [resource] 6 | background_mode = 2 7 | sky = SubResource("1") 8 | ambient_light_sky_contribution = 0.16 9 | -------------------------------------------------------------------------------- /scenes/ground/Ground.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=3 uid="uid://dakjlk33s1w3v"] 2 | 3 | [sub_resource type="PlaneMesh" id="1"] 4 | size = Vector2(4096, 4096) 5 | subdivide_width = 10 6 | subdivide_depth = 10 7 | 8 | [node name="Ground" type="MeshInstance3D"] 9 | mesh = SubResource("1") 10 | -------------------------------------------------------------------------------- /addons/camera360/PanoramaFromCubeMap.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=4 format=2] 2 | 3 | [ext_resource path="res://addons/camera360/PanoramaFromCubeMap.gdshader" type="Shader" id=1] 4 | [ext_resource path="res://addons/camera360/PanoramaFromCubeMap.gd" type="Script" id=2] 5 | 6 | [sub_resource type="ShaderMaterial" id=2] 7 | shader = ExtResource( 1 ) 8 | 9 | [node name="Panorama" type="ColorRect"] 10 | material = SubResource( 2 ) 11 | offset_right = 2048.0 12 | offset_bottom = 1024.0 13 | script = ExtResource( 2 ) 14 | __meta__ = { 15 | "_edit_use_anchors_": false 16 | } 17 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=5 10 | 11 | [application] 12 | 13 | config/name="Godot4Camera360" 14 | run/main_scene="res://Main.tscn" 15 | config/features=PackedStringArray("4.2") 16 | boot_splash/bg_color=Color(0.141176, 0.141176, 0.141176, 1) 17 | boot_splash/image="res://screenshot.png" 18 | config/icon="res://icon.png" 19 | 20 | [filesystem] 21 | 22 | import/fbx/enabled=false 23 | -------------------------------------------------------------------------------- /Main.gd: -------------------------------------------------------------------------------- 1 | extends Node3D 2 | 3 | func on_resize(): 4 | $Panorama.size = get_viewport().size; 5 | 6 | # Called when the node enters the scene tree for the first time. 7 | func _ready(): 8 | # disable 3d output on our main viewport 9 | var vp = get_viewport() 10 | vp.disable_3d = true 11 | #vp.usage = SubViewport.USAGE_2D 12 | #vp.hdr = false 13 | 14 | # bind our camera images to our panorama render 15 | $Panorama.set_from_cubemap($Path3D/PathFollow3D/CubeCam) 16 | 17 | # connect to our window resize signal 18 | get_tree().get_root().connect("size_changed", Callable(self, "on_resize")) 19 | 20 | # init our size 21 | on_resize(); 22 | 23 | # Called every frame. 'delta' is the elapsed time since the previous frame. 24 | func _process(delta): 25 | $Path3D/PathFollow3D.progress += delta 26 | 27 | pass 28 | -------------------------------------------------------------------------------- /assets/free3d.com/75-low-poly-buildings/low poly buildings.obj.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="wavefront_obj" 4 | importer_version=1 5 | type="Mesh" 6 | uid="uid://dai7n00k0ax3t" 7 | path="res://.godot/imported/low poly buildings.obj-9a26007d3e37f4eb9fb4922797812af8.mesh" 8 | 9 | [deps] 10 | 11 | files=["res://.godot/imported/low poly buildings.obj-9a26007d3e37f4eb9fb4922797812af8.mesh"] 12 | 13 | source_file="res://assets/free3d.com/75-low-poly-buildings/low poly buildings.obj" 14 | dest_files=["res://.godot/imported/low poly buildings.obj-9a26007d3e37f4eb9fb4922797812af8.mesh", "res://.godot/imported/low poly buildings.obj-9a26007d3e37f4eb9fb4922797812af8.mesh"] 15 | 16 | [params] 17 | 18 | generate_tangents=true 19 | scale_mesh=Vector3(1, 1, 1) 20 | offset_mesh=Vector3(0, 0, 0) 21 | optimize_mesh=true 22 | force_disable_mesh_compression=false 23 | -------------------------------------------------------------------------------- /icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://b3uiu0lkhsbnc" 6 | path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://icon.png" 14 | dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /screenshot.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://crhe0ruotriea" 6 | path="res://.godot/imported/screenshot.png-024a21af5d37bf0f0dd0e2bccdd149d0.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://screenshot.png" 14 | dest_files=["res://.godot/imported/screenshot.png-024a21af5d37bf0f0dd0e2bccdd149d0.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Godot 360 Camera render 2 | ======================= 3 | Updated for Godot 4.2 4 | 5 | ![Screenshot](screenshot.png) 6 | 7 | This repository contains an example implementation of rendering a scene to a cubemap and then turning that cubemap into a panoramic image. 8 | 9 | Recording the output of this would produce a 360 degree video. 10 | 11 | Currently it doesn't yet support stereoscopic rendering so there is no depth perception. 12 | 13 | License 14 | ======= 15 | The source code presented here has been made available under an MIT license. 16 | 17 | Note that some of the assets found in the asset folder fall under licenses from their respective owners: 18 | - all hdriheaven.com images are Creative Commons CC0 19 | - For the free3d buildings asset has a personal use license, please consult: https://free3d.com/3d-model/19-low-poly-buildings-974347.html 20 | 21 | About this repository 22 | --------------------- 23 | This repository was created by Bastiaan Olij a.k.a. Mux213 - Updated for 4.2 by Victor Stan 24 | -------------------------------------------------------------------------------- /assets/hdriheaven.com/kloofendal_48d_partly_cloudy_1k.hdr.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://jesvf60qixuh" 6 | path.bptc="res://.godot/imported/kloofendal_48d_partly_cloudy_1k.hdr-c90c9dc69f5ec5822b5d5a33cf2cd61a.bptc.ctex" 7 | metadata={ 8 | "imported_formats": ["s3tc_bptc"], 9 | "vram_texture": true 10 | } 11 | 12 | [deps] 13 | 14 | source_file="res://assets/hdriheaven.com/kloofendal_48d_partly_cloudy_1k.hdr" 15 | dest_files=["res://.godot/imported/kloofendal_48d_partly_cloudy_1k.hdr-c90c9dc69f5ec5822b5d5a33cf2cd61a.bptc.ctex"] 16 | 17 | [params] 18 | 19 | compress/mode=2 20 | compress/high_quality=false 21 | compress/lossy_quality=0.7 22 | compress/hdr_compression=1 23 | compress/normal_map=0 24 | compress/channel_pack=0 25 | mipmaps/generate=true 26 | mipmaps/limit=-1 27 | roughness/mode=0 28 | roughness/src_normal="" 29 | process/fix_alpha_border=true 30 | process/premult_alpha=false 31 | process/normal_map_invert_y=false 32 | process/hdr_as_srgb=false 33 | process/hdr_clamp_exposure=false 34 | process/size_limit=0 35 | detect_3d/compress_to=0 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Bastiaan Olij 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /addons/camera360/PanoramaFromCubeMap.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform sampler2D ForwardTexture; 4 | uniform sampler2D LeftTexture; 5 | uniform sampler2D BackTexture; 6 | uniform sampler2D RightTexture; 7 | uniform sampler2D TopTexture; 8 | uniform sampler2D BottomTexture; 9 | 10 | void fragment() { 11 | vec3 dir = vec3(0.0); 12 | float rot_y = UV.x * PI * 2.0; 13 | float rot_z = UV.y * PI; 14 | 15 | dir.x = sin(rot_z) * sin(rot_y); 16 | dir.y = cos(rot_z); 17 | dir.z = sin(rot_z) * cos(rot_y); 18 | 19 | vec3 abs_dir = abs(dir); 20 | if ((abs_dir.x > abs_dir.y) && (abs_dir.x > abs_dir.z)) { 21 | // X is biggest, use forward 22 | float ma = 0.5 / abs_dir.x; 23 | vec2 uv = -dir.zy * ma + 0.5; 24 | if (dir.x >= 0.0) { 25 | COLOR = texture(BackTexture, uv); 26 | } else { 27 | COLOR = texture(ForwardTexture, vec2(1.0 - uv.x, uv.y)); 28 | } 29 | } else if (abs_dir.y > abs_dir.z) { 30 | // Y is biggest 31 | float ma = 0.5 / abs_dir.y * -1.0; 32 | vec2 uv = dir.xz * ma + 0.5; 33 | if (dir.y >= 0.0) { 34 | COLOR = texture(TopTexture, uv); 35 | } else { 36 | COLOR = texture(BottomTexture, vec2(1.0 - uv.x, uv.y)); 37 | } 38 | } else { 39 | // Z is biggest 40 | float ma = 0.5 / abs_dir.z * -1.0; 41 | vec2 uv = dir.xy * ma + 0.5; 42 | if (dir.z >= 0.0) { 43 | COLOR = texture(RightTexture, vec2(1.0 - uv.x, uv.y)); 44 | } else { 45 | COLOR = texture(LeftTexture, uv); 46 | } 47 | } 48 | // COLOR = vec4(dir.x, dir.y, dir.z, 1.0); 49 | } -------------------------------------------------------------------------------- /addons/camera360/CubeCam.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=3 uid="uid://dmqfdfgg772md"] 2 | 3 | [ext_resource type="Script" path="res://addons/camera360/CubeCam.gd" id="1"] 4 | 5 | [node name="CubeCam" type="Node3D"] 6 | script = ExtResource("1") 7 | 8 | [node name="ForwardViewport" type="SubViewport" parent="."] 9 | size = Vector2i(256, 256) 10 | render_target_update_mode = 3 11 | 12 | [node name="Position" type="Node3D" parent="ForwardViewport"] 13 | 14 | [node name="Camera3D" type="Camera3D" parent="ForwardViewport/Position"] 15 | fov = 90.0 16 | 17 | [node name="LeftViewport" type="SubViewport" parent="."] 18 | render_target_update_mode = 3 19 | 20 | [node name="Position" type="Node3D" parent="LeftViewport"] 21 | 22 | [node name="Camera3D" type="Camera3D" parent="LeftViewport/Position"] 23 | transform = Transform3D(-1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 0, 0, 0) 24 | fov = 90.0 25 | 26 | [node name="BackViewport" type="SubViewport" parent="."] 27 | render_target_update_mode = 3 28 | 29 | [node name="Position" type="Node3D" parent="BackViewport"] 30 | 31 | [node name="Camera3D" type="Camera3D" parent="BackViewport/Position"] 32 | transform = Transform3D(-1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0) 33 | fov = 90.0 34 | 35 | [node name="RightViewport" type="SubViewport" parent="."] 36 | render_target_update_mode = 3 37 | 38 | [node name="Position" type="Node3D" parent="RightViewport"] 39 | 40 | [node name="Camera3D" type="Camera3D" parent="RightViewport/Position"] 41 | transform = Transform3D(1.19249e-08, 0, -1, 0, 1, 0, 1, 0, 1.19249e-08, 0, 0, 0) 42 | fov = 90.0 43 | 44 | [node name="TopViewport" type="SubViewport" parent="."] 45 | render_target_update_mode = 3 46 | 47 | [node name="Position" type="Node3D" parent="TopViewport"] 48 | 49 | [node name="Camera3D" type="Camera3D" parent="TopViewport/Position"] 50 | transform = Transform3D(-1.62921e-07, 1, -1.62921e-07, 0, -1.62921e-07, -1, -1, -1.62921e-07, 2.65431e-14, 0, 0, 0) 51 | fov = 90.0 52 | 53 | [node name="BottomViewport" type="SubViewport" parent="."] 54 | render_target_update_mode = 3 55 | 56 | [node name="Position" type="Node3D" parent="BottomViewport"] 57 | 58 | [node name="Camera3D" type="Camera3D" parent="BottomViewport/Position"] 59 | transform = Transform3D(-1.62921e-07, 1, 1.62921e-07, 0, -1.62921e-07, 1, 1, 1.62921e-07, 2.65431e-14, 0, 0, 0) 60 | fov = 90.0 61 | -------------------------------------------------------------------------------- /addons/camera360/PanoramaFromCubeMap.gd: -------------------------------------------------------------------------------- 1 | extends ColorRect 2 | 3 | @export var ForwardTexture:Texture2D : get = get_forward_texture, set = set_forward_texture 4 | @export var LeftTexture:Texture2D : get = get_left_texture, set = set_left_texture 5 | @export var BackTexture:Texture2D : get = get_back_texture, set = set_back_texture 6 | @export var RightTexture:Texture2D : get = get_right_texture, set = set_right_texture 7 | @export var TopTexture:Texture2D : get = get_top_texture, set = set_top_texture 8 | @export var BottomTexture:Texture2D : get = get_bottom_texture, set = set_bottom_texture 9 | 10 | var is_ready = false 11 | 12 | func set_from_cubemap(cubemap): 13 | set_forward_texture(cubemap.get_forward_texture()) 14 | set_left_texture(cubemap.get_left_texture()) 15 | set_back_texture(cubemap.get_back_texture()) 16 | set_right_texture(cubemap.get_right_texture()) 17 | set_top_texture(cubemap.get_top_texture()) 18 | set_bottom_texture(cubemap.get_bottom_texture()) 19 | 20 | func set_forward_texture(new_texture : Texture2D): 21 | ForwardTexture = new_texture 22 | if is_ready: 23 | material.set_shader_parameter('ForwardTexture', ForwardTexture) 24 | 25 | func get_forward_texture(): 26 | return ForwardTexture 27 | 28 | func set_left_texture(new_texture : Texture2D): 29 | LeftTexture = new_texture 30 | if is_ready: 31 | material.set_shader_parameter('LeftTexture', LeftTexture) 32 | 33 | func get_left_texture(): 34 | return LeftTexture 35 | 36 | func set_back_texture(new_texture : Texture2D): 37 | BackTexture = new_texture 38 | if is_ready: 39 | material.set_shader_parameter('BackTexture', BackTexture) 40 | 41 | func get_back_texture(): 42 | return BackTexture 43 | 44 | func set_right_texture(new_texture : Texture2D): 45 | RightTexture = new_texture 46 | if is_ready: 47 | material.set_shader_parameter('RightTexture', RightTexture) 48 | 49 | func get_right_texture(): 50 | return RightTexture 51 | 52 | func set_top_texture(new_texture : Texture2D): 53 | TopTexture = new_texture 54 | if is_ready: 55 | material.set_shader_parameter('TopTexture', TopTexture) 56 | 57 | func get_top_texture(): 58 | return TopTexture 59 | 60 | func set_bottom_texture(new_texture : Texture2D): 61 | BottomTexture = new_texture 62 | if is_ready: 63 | material.set_shader_parameter('BottomTexture', BottomTexture) 64 | 65 | func get_bottom_texture(): 66 | return BottomTexture 67 | 68 | # Called when the node enters the scene tree for the first time. 69 | func _ready(): 70 | # we are ready 71 | is_ready = true 72 | 73 | # assign textures to shader 74 | set_forward_texture(ForwardTexture) 75 | set_left_texture(LeftTexture) 76 | set_back_texture(BackTexture) 77 | set_right_texture(RightTexture) 78 | set_top_texture(TopTexture) 79 | set_bottom_texture(BottomTexture) 80 | 81 | -------------------------------------------------------------------------------- /addons/camera360/CubeCam.gd: -------------------------------------------------------------------------------- 1 | extends Node3D 2 | 3 | @export var cube_size:float = 512: get = get_cube_size, set = set_cube_size 4 | @export var shadow_atlast_size:float = 1024: get = get_shadow_atlas_size, set = set_shadow_atlas_size 5 | @export var near:float = 0.1: get = get_near, set = set_near 6 | @export var far:float = 300.0: get = get_far, set = set_far 7 | 8 | var is_ready = false 9 | 10 | func get_forward_texture(): 11 | return $ForwardViewport.get_texture() 12 | 13 | func get_left_texture(): 14 | return $LeftViewport.get_texture() 15 | 16 | func get_back_texture(): 17 | return $BackViewport.get_texture() 18 | 19 | func get_right_texture(): 20 | return $RightViewport.get_texture() 21 | 22 | func get_top_texture(): 23 | return $TopViewport.get_texture() 24 | 25 | func get_bottom_texture(): 26 | return $BottomViewport.get_texture() 27 | 28 | func set_cube_size(p_new_value): 29 | cube_size = p_new_value 30 | if is_ready: 31 | $ForwardViewport.size = Vector2(cube_size, cube_size) 32 | $LeftViewport.size = Vector2(cube_size, cube_size) 33 | $BackViewport.size = Vector2(cube_size, cube_size) 34 | $RightViewport.size = Vector2(cube_size, cube_size) 35 | $TopViewport.size = Vector2(cube_size, cube_size) 36 | $BottomViewport.size = Vector2(cube_size, cube_size) 37 | 38 | func get_cube_size(): 39 | return cube_size 40 | 41 | func set_shadow_atlas_size(p_new_value): 42 | shadow_atlast_size = p_new_value 43 | if is_ready: 44 | $ForwardViewport.positional_shadow_atlas_size = shadow_atlast_size 45 | $LeftViewport.positional_shadow_atlas_size = shadow_atlast_size 46 | $BackViewport.positional_shadow_atlas_size = shadow_atlast_size 47 | $RightViewport.positional_shadow_atlas_size = shadow_atlast_size 48 | $TopViewport.positional_shadow_atlas_size = shadow_atlast_size 49 | $BottomViewport.positional_shadow_atlas_size = shadow_atlast_size 50 | 51 | func get_shadow_atlas_size(): 52 | return shadow_atlast_size 53 | 54 | func set_near(p_new_value): 55 | near = p_new_value 56 | if is_ready: 57 | $ForwardViewport/Position/Camera3D.near = near 58 | $LeftViewport/Position/Camera3D.near = near 59 | $BackViewport/Position/Camera3D.near = near 60 | $RightViewport/Position/Camera3D.near = near 61 | $TopViewport/Position/Camera3D.near = near 62 | $BottomViewport/Position/Camera3D.near = near 63 | 64 | func get_near(): 65 | return near 66 | 67 | func set_far(p_new_value): 68 | far = p_new_value 69 | if is_ready: 70 | $ForwardViewport/Position/Camera3D.far = far 71 | $LeftViewport/Position/Camera3D.far = far 72 | $BackViewport/Position/Camera3D.far = far 73 | $RightViewport/Position/Camera3D.far = far 74 | $TopViewport/Position/Camera3D.far = far 75 | $BottomViewport/Position/Camera3D.far = far 76 | 77 | func get_far(): 78 | return far 79 | 80 | # Called when the node enters the scene tree for the first time. 81 | func _ready(): 82 | # now we're ready 83 | is_ready = true 84 | 85 | # and we can set our starting resolution 86 | set_cube_size(cube_size) 87 | set_shadow_atlas_size(shadow_atlast_size) 88 | set_near(near) 89 | set_far(far) 90 | 91 | func _process(delta): 92 | var t = global_transform 93 | $ForwardViewport/Position.global_transform = t 94 | $LeftViewport/Position.global_transform = t 95 | $BackViewport/Position.global_transform = t 96 | $RightViewport/Position.global_transform = t 97 | $TopViewport/Position.global_transform = t 98 | $BottomViewport/Position.global_transform = t 99 | -------------------------------------------------------------------------------- /Main.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=12 format=3 uid="uid://dlvi4pxkiqpl3"] 2 | 3 | [ext_resource type="MeshLibrary" uid="uid://bmotdwirpwdag" path="res://assets/free3d.com/75-low-poly-buildings/buildings.meshlib" id="1"] 4 | [ext_resource type="PackedScene" uid="uid://dakjlk33s1w3v" path="res://scenes/ground/Ground.tscn" id="2"] 5 | [ext_resource type="Texture2D" uid="uid://jesvf60qixuh" path="res://assets/hdriheaven.com/kloofendal_48d_partly_cloudy_1k.hdr" id="2_16ox1"] 6 | [ext_resource type="Script" path="res://Main.gd" id="3"] 7 | [ext_resource type="PackedScene" uid="uid://dmqfdfgg772md" path="res://addons/camera360/CubeCam.tscn" id="4"] 8 | [ext_resource type="PackedScene" path="res://addons/camera360/PanoramaFromCubeMap.tscn" id="5"] 9 | 10 | [sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_wgvl0"] 11 | panorama = ExtResource("2_16ox1") 12 | 13 | [sub_resource type="Sky" id="Sky_tjnwu"] 14 | sky_material = SubResource("PanoramaSkyMaterial_wgvl0") 15 | 16 | [sub_resource type="Environment" id="Environment_lakrl"] 17 | background_mode = 2 18 | sky = SubResource("Sky_tjnwu") 19 | 20 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6tl57"] 21 | albedo_color = Color(0.25098, 0.25098, 0.25098, 1) 22 | 23 | [sub_resource type="Curve3D" id="1"] 24 | _data = { 25 | "points": PackedVector3Array(0, 0, 0, 0, 0, 0, -0.0422177, 3.05176e-05, 4.3301, -1.23191, -0.00244141, 0.00434113, 1.23191, 0.00244141, -0.00434113, 3.37504, 3.05176e-05, 5.64269, -0.156013, 0, 0.810291, 0.156013, 0, -0.810291, 5.10689, 3.05176e-05, 3.44142, -0.539474, 0, 1.65352, 0.539474, 0, -1.65352, 5.08075, 3.05176e-05, -1.577, -0.378273, 0, 1.30411, 0.378273, 0, -1.30411, 5.10689, 3.05176e-05, -5.39309, -1.48357, 0, -0.0299287, 1.48357, 0, 0.0299287, 8.63547, 3.05176e-05, -6.96135, -1.11615, 0, -0.299583, 1.11615, 0, 0.299583, 11.772, 3.05176e-05, -5.68061, -0.32226, 0, 0.384872, 0.32226, 0, -0.384872, 13.4186, 3.05176e-05, -5.8113, -0.61014, 0, 0.191758, 0.61014, 0, -0.191758, 14.6828, 3.05176e-05, -6.96049, -0.477718, 0, -0.295379, 0.477718, 0, 0.295379, 16.7643, 3.05176e-05, -6.69997, -0.275089, 0, -0.561476, 0.275089, 0, 0.561476, 17.6529, 3.05176e-05, -5.00103, -0.18092, 0, -0.417737, 0.18092, 0, 0.417737, 18.9405, 3.05176e-05, -3.20657, 0.887787, 0, -0.900573, -0.887787, 0, 0.900573, 17.6791, 3.05176e-05, -0.270122, 0.380825, 0, -0.882054, -0.380825, 0, 0.882054, 17.1041, 3.05176e-05, 2.16068, 1.32487, 0, 0.697302, -1.32487, 0, -0.697302, 14.8351, 3.05176e-05, 2.6035, -0.622695, 0, -1.19014, 0.622695, 0, 1.19014, 13.0527, 3.05176e-05, 3.78121, 0.638926, 0, -0.582898, -0.638926, 0, 0.582898, 11.7981, 3.05176e-05, 5.84608, 0.0989494, 0, -0.84881, -0.0989494, 0, 0.84881, 10.5435, 3.05176e-05, 8.4337, 0.623008, 0, -1.13717, -0.623008, 0, 1.13717, 9.94235, 3.05176e-05, 11.9361, 0, 0, 0, 0, 0, 0, 8.97526, 3.05176e-05, 13.3214, 0.917854, 0, -0.175973, -0.917854, 0, 0.175973, 7.01494, 3.05176e-05, 14.1056, 0.946029, 0, 0.362252, -0.946029, 0, -0.362252, 3.38181, 3.05176e-05, 14.184, 0.831746, 0, 0.104496, -0.831746, 0, -0.104496, 0.74191, 3.05176e-05, 13.0078, 0.72439, 0, 0.567219, -0.72439, 0, -0.567219, -2.70825, 3.05176e-05, 12.8771, 0.180588, 0, 0.436268, -0.180588, 0, -0.436268, -4.55748, 3.05176e-05, 10.6177, 0.403054, 0, 0.915548, -0.403054, 0, -0.915548, -5.65984, 3.05176e-05, 6.24381, 0.546497, 0, 0.724075, -0.546497, 0, -0.724075, -8.46907, 3.05176e-05, 2.22554, 0.115961, 0, 0.801703, -0.115961, 0, -0.801703, -9.86473, 3.05176e-05, -0.982706, -0.0239191, 0, 0.769163, 0.0239191, 0, -0.769163, -9.15962, 3.05176e-05, -3.84463, -0.0306759, 0, 1.67352, 0.0306759, 0, -1.67352, -10.1965, 3.05176e-05, -8.69745, -1.58172, 0, -0.254117, 1.58172, 0, 0.254117, -6.21474, 3.05176e-05, -13.4258, -1.20956, 0, -0.403185, 1.20956, 0, 0.403185, -3.36142, 3.05176e-05, -11.2371, -1.23327, 0, 0.474336, 1.23327, 0, -0.474336, 1.42937, 3.05176e-05, -10.8339, 0, 0, 0, 0, 0, 0, 6.14544, 3.05176e-05, -12.8037), 26 | "tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 27 | } 28 | point_count = 34 29 | 30 | [node name="Main" type="Node3D"] 31 | script = ExtResource("3") 32 | 33 | [node name="WorldEnvironment" type="WorldEnvironment" parent="."] 34 | environment = SubResource("Environment_lakrl") 35 | 36 | [node name="Ground" parent="." instance=ExtResource("2")] 37 | cast_shadow = 0 38 | gi_mode = 0 39 | surface_material_override/0 = SubResource("StandardMaterial3D_6tl57") 40 | 41 | [node name="GridMap" type="GridMap" parent="."] 42 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.930299, 0) 43 | mesh_library = ExtResource("1") 44 | data = { 45 | "cells": PackedInt32Array(3, 0, 0, 7, 0, 1441793, 10, 0, 1441806, 12, 0, 1441793, 65516, 0, 11, 65519, 0, 7, 65523, 0, 655368, 65530, 0, 1441809, 65535, 0, 0, 1, 1, 1441804, 65526, 1, 1441801, 65528, 1, 655363, 65533, 1, 1441809, 3, 2, 7, 7, 2, 1441803, 11, 2, 1441806, 14, 2, 1048583, 65531, 2, 0, 3, 3, 1441810, 7, 3, 1441806, 65521, 3, 13, 65525, 3, 655368, 65528, 3, 1441803, 65535, 3, 0, 1, 4, 655363, 3, 4, 1441810, 9, 4, 655364, 65532, 4, 1441804, 3, 5, 1441797, 65530, 5, 1441801, 65535, 5, 1441793, 8, 6, 655368, 12, 6, 655377, 65525, 6, 655367, 65533, 6, 655368, 6, 7, 13, 65522, 7, 1048587, 65528, 7, 17, 2, 8, 7, 65533, 8, 1441799, 5, 10, 1441809, 9, 10, 1048587, 65530, 10, 1048587, 65535, 10, 1048587, 13, 65513, 1441803, 9, 65514, 1048593, 2, 65515, 1048589, 65528, 65515, 655364, 65532, 65515, 1048587, 4, 65516, 655371, 65518, 65516, 655377, 65525, 65516, 655364, 65534, 65516, 655364, 15, 65517, 655377, 18, 65518, 11, 65522, 65518, 655360, 65535, 65518, 655363, 7, 65519, 655364, 65530, 65519, 655360, 65519, 65520, 1048589, 65526, 65520, 655360, 65531, 65520, 655360, 3, 65521, 655368, 8, 65521, 655363, 12, 65521, 655364, 65517, 65521, 655367, 65521, 65521, 655368, 65525, 65522, 655368, 6, 65523, 655368, 65532, 65523, 1441793, 65535, 65523, 655365, 9, 65524, 655360, 15, 65524, 655367, 65523, 65524, 655360, 65528, 65524, 1441793, 2, 65525, 1441793, 11, 65525, 655363, 65514, 65525, 1441803, 65520, 65526, 655364, 65526, 65527, 1441793, 65533, 65527, 1441803, 4, 65528, 1441801, 8, 65528, 1441793, 15, 65528, 655373, 65516, 65528, 1441799, 65519, 65528, 655373, 65523, 65528, 655365, 65530, 65528, 1441801, 1, 65529, 1441804, 6, 65529, 655363, 19, 65529, 1048587, 65534, 65529, 1441803, 10, 65530, 1441801, 65529, 65530, 1441803, 2, 65531, 1441802, 65517, 65531, 1048593, 65521, 65531, 655368, 65535, 65531, 1441799, 6, 65532, 1441804, 12, 65532, 1441803, 65526, 65532, 1441801, 65528, 65532, 655371, 65532, 65532, 8, 7, 65533, 1441803, 15, 65533, 1441805, 65520, 65533, 1048589, 65524, 65533, 1441797, 65530, 65533, 1441804, 1, 65534, 1441802, 3, 65534, 13, 6, 65534, 655364, 10, 65534, 1441793, 65535, 65534, 8, 65528, 65535, 1441803, 65532, 65535, 13) 46 | } 47 | 48 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] 49 | transform = Transform3D(0.74003, 0.467378, -0.483646, 0, 0.719097, 0.694909, 0.672574, -0.514254, 0.532154, 0, 9.30298, 0) 50 | shadow_enabled = true 51 | 52 | [node name="Path3D" type="Path3D" parent="."] 53 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.23044, 0) 54 | curve = SubResource("1") 55 | 56 | [node name="PathFollow3D" type="PathFollow3D" parent="Path3D"] 57 | transform = Transform3D(-0.358565, 0, -0.933505, 0, 1, 0, 0.933505, 0, -0.358565, -0.0422177, 3.05176e-05, 4.3301) 58 | 59 | [node name="CubeCam" parent="Path3D/PathFollow3D" instance=ExtResource("4")] 60 | transform = Transform3D(-0.707107, 1.6263e-19, -0.707107, 1.6263e-19, 1, -2.98156e-19, 0.707107, -1.6263e-19, -0.707107, 0, 0, 0) 61 | 62 | [node name="Panorama" parent="." instance=ExtResource("5")] 63 | anchors_preset = 15 64 | anchor_right = 1.0 65 | anchor_bottom = 1.0 66 | offset_right = 0.0 67 | offset_bottom = 0.0 68 | grow_horizontal = 2 69 | grow_vertical = 2 70 | --------------------------------------------------------------------------------