first examples
This commit is contained in:
parent
a01a7a7acc
commit
2219e943da
33 changed files with 785 additions and 6 deletions
BIN
assets/fonts/FrederickatheGreat-Regular.ttf
Normal file
BIN
assets/fonts/FrederickatheGreat-Regular.ttf
Normal file
Binary file not shown.
34
assets/fonts/FrederickatheGreat-Regular.ttf.import
Normal file
34
assets/fonts/FrederickatheGreat-Regular.ttf.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://d268g1dy6fv6t"
|
||||
path="res://.godot/imported/FrederickatheGreat-Regular.ttf-166829227649c2cb29d6beb8d2e6fca9.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/FrederickatheGreat-Regular.ttf"
|
||||
dest_files=["res://.godot/imported/FrederickatheGreat-Regular.ttf-166829227649c2cb29d6beb8d2e6fca9.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
94
assets/fonts/OFL.txt
Normal file
94
assets/fonts/OFL.txt
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
Copyright (c) 2011, Tart Workshop (a DBA of Font Diner, Inc) (www.fontdiner.com),
|
||||
with Reserved Font Name "Fredericka the Great".
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
BIN
assets/models/kenney.nl/Textures/colormap.png
Normal file
BIN
assets/models/kenney.nl/Textures/colormap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
35
assets/models/kenney.nl/Textures/colormap.png.import
Normal file
35
assets/models/kenney.nl/Textures/colormap.png.import
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://gs4r6ybeb02j"
|
||||
path.s3tc="res://.godot/imported/colormap.png-4c5fbca8c57b71f446d305ac75a47fe1.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/models/kenney.nl/Textures/colormap.png"
|
||||
dest_files=["res://.godot/imported/colormap.png-4c5fbca8c57b71f446d305ac75a47fe1.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
assets/models/kenney.nl/column.glb
Normal file
BIN
assets/models/kenney.nl/column.glb
Normal file
Binary file not shown.
36
assets/models/kenney.nl/column.glb.import
Normal file
36
assets/models/kenney.nl/column.glb.import
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://rtbkmc0lc26v"
|
||||
path="res://.godot/imported/column.glb-8e1f5348eacaaff577a3d64d5e35451f.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/models/kenney.nl/column.glb"
|
||||
dest_files=["res://.godot/imported/column.glb-8e1f5348eacaaff577a3d64d5e35451f.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.2
|
||||
nodes/import_as_skeleton_bones=false
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
29
entities/plinth/plinth.gd
Normal file
29
entities/plinth/plinth.gd
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
@tool
|
||||
extends StaticBody3D
|
||||
|
||||
@onready var exhibit_title: Label3D = $ExhibitTitle
|
||||
@onready var exhibit_number: Label3D = $ExhibitNumber
|
||||
|
||||
@export var prefix: String:
|
||||
get:
|
||||
return prefix
|
||||
set(value):
|
||||
prefix = value
|
||||
set_label3d()
|
||||
|
||||
@export var title: String:
|
||||
get:
|
||||
return title
|
||||
set(value):
|
||||
title = value
|
||||
set_label3d()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
set_label3d()
|
||||
|
||||
func set_label3d():
|
||||
if exhibit_title and exhibit_number:
|
||||
if not prefix.is_empty() and not title.is_empty():
|
||||
exhibit_title.text = title
|
||||
exhibit_number.text = prefix
|
||||
42
entities/plinth/plinth.tscn
Normal file
42
entities/plinth/plinth.tscn
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://bn6vxev7totc8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://rtbkmc0lc26v" path="res://assets/models/kenney.nl/column.glb" id="1_4464o"]
|
||||
[ext_resource type="Script" path="res://entities/plinth/plinth.gd" id="1_c0mgr"]
|
||||
[ext_resource type="FontFile" uid="uid://d268g1dy6fv6t" path="res://assets/fonts/FrederickatheGreat-Regular.ttf" id="2_kx7w3"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_aq2yi"]
|
||||
size = Vector3(0.91626, 1.34576, 0.744141)
|
||||
|
||||
[node name="Plinth" type="StaticBody3D"]
|
||||
script = ExtResource("1_c0mgr")
|
||||
prefix = "000"
|
||||
title = "Title"
|
||||
|
||||
[node name="PlinthModel" parent="." instance=ExtResource("1_4464o")]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1, 0, 0, 0, 1.2, 0, 0, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.672333, 0)
|
||||
shape = SubResource("BoxShape3D_aq2yi")
|
||||
|
||||
[node name="ExhibitTitle" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, 0, 1.21637, 0.378944)
|
||||
pixel_size = 0.0006
|
||||
modulate = Color(0.5475, 0.6015, 0.75, 1)
|
||||
outline_modulate = Color(0.152941, 0.176471, 0.25098, 1)
|
||||
text = "Title"
|
||||
font = ExtResource("2_kx7w3")
|
||||
font_size = 128
|
||||
autowrap_mode = 2
|
||||
width = 1200.0
|
||||
|
||||
[node name="ExhibitNumber" type="Label3D" parent="."]
|
||||
transform = Transform3D(0.777146, 0, -0.62932, 0, 1, 0, 0.62932, 0, 0.777146, -0.403741, 1.28391, 0.32542)
|
||||
pixel_size = 0.0004
|
||||
modulate = Color(0.5475, 0.6015, 0.75, 1)
|
||||
outline_modulate = Color(0.152941, 0.176471, 0.25098, 1)
|
||||
text = "000"
|
||||
font = ExtResource("2_kx7w3")
|
||||
font_size = 128
|
||||
autowrap_mode = 2
|
||||
width = 1200.0
|
||||
52
entities/viewer/viewer.gd
Normal file
52
entities/viewer/viewer.gd
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
@export var rotation_speed: float = 0.002
|
||||
|
||||
|
||||
const SPEED = 5.0
|
||||
const JUMP_VELOCITY = 4.5
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if Input.is_action_pressed("ui_cancel"):
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
if event is InputEventMouseButton and event.button_index == 1 and event.is_pressed():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
if event is InputEventMouseMotion:
|
||||
handle_motion(event)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var input_dir := Input.get_vector("left", "right", "front", "back")
|
||||
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
if direction:
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
|
||||
func handle_motion(event: InputEventMouseMotion) -> void:
|
||||
if not Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
return
|
||||
|
||||
$Camera3D.rotation.x -= event.relative.y * rotation_speed
|
||||
$Camera3D.rotation.x = clamp($Camera3D.rotation.x, deg_to_rad(-89), deg_to_rad(89))
|
||||
rotation.y -= event.relative.x * rotation_speed
|
||||
17
entities/viewer/viewer.tscn
Normal file
17
entities/viewer/viewer.tscn
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dcv8xw0aeturp"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/viewer/viewer.gd" id="1_8hs0o"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bf5le"]
|
||||
height = 1.7
|
||||
|
||||
[node name="Viewer" type="CharacterBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5)
|
||||
script = ExtResource("1_8hs0o")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.7, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
||||
shape = SubResource("CapsuleShape3D_bf5le")
|
||||
|
|
@ -3,25 +3,26 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cmlsy0imwepqs"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
|
|
@ -31,7 +32,7 @@ process/normal_map_invert_y=false
|
|||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
detect_3d/compress_to=0
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
|
|
|||
143
main.tscn
Normal file
143
main.tscn
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
[gd_scene load_steps=17 format=3 uid="uid://xiyknqrsrmws"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dcv8xw0aeturp" path="res://entities/viewer/viewer.tscn" id="1_ann0f"]
|
||||
[ext_resource type="PackedScene" uid="uid://bn6vxev7totc8" path="res://entities/plinth/plinth.tscn" id="3_hl5po"]
|
||||
[ext_resource type="PackedScene" uid="uid://bm381ddsm6nv3" path="res://shaders/002_change_position/change_position.tscn" id="4_3haq7"]
|
||||
[ext_resource type="PackedScene" uid="uid://o76dbkg8478j" path="res://shaders/001_change_color/change_color.tscn" id="4_ssrg0"]
|
||||
[ext_resource type="PackedScene" uid="uid://b2nxlaom04udy" path="res://shaders/003_color_and_position/color_and_position.tscn" id="5_tv25h"]
|
||||
[ext_resource type="PackedScene" uid="uid://dcrg7uyqekgl7" path="res://shaders/004_adding_time/adding_time.tscn" id="6_sjdpt"]
|
||||
[ext_resource type="PackedScene" uid="uid://du06a3dwu2yy6" path="res://shaders/005_displacing_vertices/displacing_vertices.tscn" id="7_3a3yj"]
|
||||
[ext_resource type="PackedScene" uid="uid://5clduk3kph4t" path="res://shaders/006_variables/variables.tscn" id="8_pbwds"]
|
||||
[ext_resource type="PackedScene" uid="uid://csh1kbx37l5el" path="res://shaders/007_reflections/reflections.tscn" id="9_vxv4a"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjoxcmy6sy8lb" path="res://shaders/008_normals/normals.tscn" id="10_cqg4s"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0c1k04qmog56" path="res://shaders/000_playground/playground.tscn" id="11_u0jti"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_37bgm"]
|
||||
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
|
||||
[sub_resource type="Sky" id="Sky_osijm"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_37bgm")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_gem6o"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_osijm")
|
||||
tonemap_mode = 2
|
||||
glow_enabled = true
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_hf2y8"]
|
||||
size = Vector2(100, 20)
|
||||
|
||||
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_l71tc"]
|
||||
|
||||
[node name="Main" type="Node3D"]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_gem6o")
|
||||
|
||||
[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)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Floor" type="StaticBody3D" parent="."]
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor"]
|
||||
mesh = SubResource("PlaneMesh_hf2y8")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor"]
|
||||
shape = SubResource("WorldBoundaryShape3D_l71tc")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Viewer" parent="." instance=ExtResource("1_ann0f")]
|
||||
|
||||
[node name="Examples" type="Node3D" parent="."]
|
||||
|
||||
[node name="000Playground" type="Node3D" parent="Examples"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/000Playground" instance=ExtResource("3_hl5po")]
|
||||
title = "Playground"
|
||||
|
||||
[node name="Playground" parent="Examples/000Playground" instance=ExtResource("11_u0jti")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="001ChangeColor" type="Node3D" parent="Examples"]
|
||||
|
||||
[node name="001ChangeColor" parent="Examples/001ChangeColor" instance=ExtResource("4_ssrg0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/001ChangeColor" instance=ExtResource("3_hl5po")]
|
||||
prefix = "001"
|
||||
title = "Change Color"
|
||||
|
||||
[node name="002ChangePosition" type="Node3D" parent="Examples"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/002ChangePosition" instance=ExtResource("3_hl5po")]
|
||||
prefix = "002"
|
||||
title = "Change Position"
|
||||
|
||||
[node name="ChangePosition" parent="Examples/002ChangePosition" instance=ExtResource("4_3haq7")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="003ColorAndPosition" type="Node3D" parent="Examples"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/003ColorAndPosition" instance=ExtResource("3_hl5po")]
|
||||
prefix = "003"
|
||||
title = "Color and Position"
|
||||
|
||||
[node name="ColorAndPosition" parent="Examples/003ColorAndPosition" instance=ExtResource("5_tv25h")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="004AddingTime" type="Node3D" parent="Examples"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/004AddingTime" instance=ExtResource("3_hl5po")]
|
||||
prefix = "004"
|
||||
title = "Adding Time"
|
||||
|
||||
[node name="AddingTime" parent="Examples/004AddingTime" instance=ExtResource("6_sjdpt")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="005DisplacingVertices" type="Node3D" parent="Examples"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/005DisplacingVertices" instance=ExtResource("3_hl5po")]
|
||||
prefix = "005"
|
||||
title = "Displacing Vertices"
|
||||
|
||||
[node name="DisplacingVertices" parent="Examples/005DisplacingVertices" instance=ExtResource("7_3a3yj")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="006Variables" type="Node3D" parent="Examples"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/006Variables" instance=ExtResource("3_hl5po")]
|
||||
prefix = "006"
|
||||
title = "Variables"
|
||||
|
||||
[node name="Variables" parent="Examples/006Variables" instance=ExtResource("8_pbwds")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="007Reflections" type="Node3D" parent="Examples"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 0, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/007Reflections" instance=ExtResource("3_hl5po")]
|
||||
prefix = "007"
|
||||
title = "Reflections"
|
||||
|
||||
[node name="Reflections" parent="Examples/007Reflections" instance=ExtResource("9_vxv4a")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="008Normals" type="Node3D" parent="Examples"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0)
|
||||
|
||||
[node name="Plinth" parent="Examples/008Normals" instance=ExtResource("3_hl5po")]
|
||||
prefix = "008"
|
||||
title = "Normals"
|
||||
|
||||
[node name="Normals" parent="Examples/008Normals" instance=ExtResource("10_cqg4s")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
|
@ -11,5 +11,29 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="godot-learning-shaders"
|
||||
run/main_scene="res://main.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[input]
|
||||
|
||||
left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
front={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
back={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
|
|
|||
16
shaders/000_playground/playground.gd
Normal file
16
shaders/000_playground/playground.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
@tool
|
||||
extends Node3D
|
||||
|
||||
@export var my_variable: float = 1.0:
|
||||
set(value):
|
||||
my_variable = value
|
||||
shader_material.set_shader_parameter("my_variable", value)
|
||||
|
||||
@onready var shader_material = $MeshInstance3D.mesh.material
|
||||
|
||||
func _ready() -> void:
|
||||
print(shader_material)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
13
shaders/000_playground/playground.gdshader
Normal file
13
shaders/000_playground/playground.gdshader
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
shader_type spatial;
|
||||
|
||||
uniform float my_variable = 0.0;
|
||||
|
||||
void vertex() {
|
||||
VERTEX.y += my_variable;
|
||||
// Called for every vertex the material is visible on.
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = NORMAL;
|
||||
// Called for every pixel the material is visible on.
|
||||
}
|
||||
18
shaders/000_playground/playground.tscn
Normal file
18
shaders/000_playground/playground.tscn
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://c0c1k04qmog56"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/000_playground/playground.gdshader" id="1_0fhw0"]
|
||||
[ext_resource type="Script" path="res://shaders/000_playground/playground.gd" id="1_08keh"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h8cto"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_0fhw0")
|
||||
shader_parameter/my_variable = 1.0
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_6preo"]
|
||||
material = SubResource("ShaderMaterial_h8cto")
|
||||
|
||||
[node name="Playground" type="Node3D"]
|
||||
script = ExtResource("1_08keh")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_6preo")
|
||||
5
shaders/001_change_color/change_color.gdshader
Normal file
5
shaders/001_change_color/change_color.gdshader
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
shader_type spatial;
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = vec3(0.1, 0.2, 0.6);
|
||||
}
|
||||
15
shaders/001_change_color/change_color.tscn
Normal file
15
shaders/001_change_color/change_color.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://o76dbkg8478j"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/001_change_color/change_color.gdshader" id="1_d0kbx"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yrrhw"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_d0kbx")
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_16ni7"]
|
||||
material = SubResource("ShaderMaterial_yrrhw")
|
||||
|
||||
[node name="ChangeColor" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_16ni7")
|
||||
5
shaders/002_change_position/change_position.gdshader
Normal file
5
shaders/002_change_position/change_position.gdshader
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
shader_type spatial;
|
||||
|
||||
void vertex() {
|
||||
VERTEX.y += 0.5;
|
||||
}
|
||||
15
shaders/002_change_position/change_position.tscn
Normal file
15
shaders/002_change_position/change_position.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bm381ddsm6nv3"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/002_change_position/change_position.gdshader" id="1_milct"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_q2e1w"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_milct")
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_f3uhw"]
|
||||
material = SubResource("ShaderMaterial_q2e1w")
|
||||
|
||||
[node name="ChangePosition" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_f3uhw")
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
shader_type spatial;
|
||||
|
||||
void vertex() {
|
||||
VERTEX.y += 0.5;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = vec3(0.1, 0.2, 0.6);
|
||||
}
|
||||
15
shaders/003_color_and_position/color_and_position.tscn
Normal file
15
shaders/003_color_and_position/color_and_position.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://b2nxlaom04udy"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/003_color_and_position/color_and_position.gdshader" id="1_igsbe"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_r8oyo"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_igsbe")
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_5deb6"]
|
||||
material = SubResource("ShaderMaterial_r8oyo")
|
||||
|
||||
[node name="ColorAndPosition" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_5deb6")
|
||||
9
shaders/004_adding_time/adding_time.gdshader
Normal file
9
shaders/004_adding_time/adding_time.gdshader
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
shader_type spatial;
|
||||
|
||||
void vertex() {
|
||||
VERTEX.y += 0.5 + sin(TIME * 3.0) * 0.35;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = vec3(0.1, 0.2, 0.6);
|
||||
}
|
||||
15
shaders/004_adding_time/adding_time.tscn
Normal file
15
shaders/004_adding_time/adding_time.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dcrg7uyqekgl7"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/004_adding_time/adding_time.gdshader" id="1_ejoc4"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5gyar"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_ejoc4")
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_xljse"]
|
||||
material = SubResource("ShaderMaterial_5gyar")
|
||||
|
||||
[node name="AddingTime" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_xljse")
|
||||
12
shaders/005_displacing_vertices/displacing_vertices.gdshader
Normal file
12
shaders/005_displacing_vertices/displacing_vertices.gdshader
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
shader_type spatial;
|
||||
|
||||
uniform float waves = 3.0;
|
||||
|
||||
void vertex() {
|
||||
// Changing the waves parameter changes how warped the sphere is
|
||||
VERTEX.y += 0.5 + sin(VERTEX.x * waves + TIME * 4.0) * 0.35;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = vec3(0.1, 0.2, 0.6);
|
||||
}
|
||||
16
shaders/005_displacing_vertices/displacing_vertices.tscn
Normal file
16
shaders/005_displacing_vertices/displacing_vertices.tscn
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://du06a3dwu2yy6"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/005_displacing_vertices/displacing_vertices.gdshader" id="1_7mier"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_c46ul"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_7mier")
|
||||
shader_parameter/waves = 3.0
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_l7vfg"]
|
||||
material = SubResource("ShaderMaterial_c46ul")
|
||||
|
||||
[node name="DisplacingVertices" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_l7vfg")
|
||||
25
shaders/006_variables/variables.gdshader
Normal file
25
shaders/006_variables/variables.gdshader
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
shader_type spatial;
|
||||
|
||||
/**
|
||||
* This is a documentation comment.
|
||||
* These lines will appear in the inspector when hovering over the shader parameters
|
||||
* You can use [b]BBCode[/b] [i]formatting[/i] in the comment.
|
||||
* The Offset From Ground shifts the model up and down.
|
||||
*/
|
||||
uniform float offset_from_ground = 0.5;
|
||||
|
||||
/**
|
||||
* This parameter influcenes the amount of waves
|
||||
*/
|
||||
uniform float waves = 8.0;
|
||||
uniform float speed = 2.0;
|
||||
uniform float wave_height = 0.5;
|
||||
|
||||
void vertex() {
|
||||
// Changing the waves parameter changes how warped the sphere is
|
||||
VERTEX.y += offset_from_ground + sin(VERTEX.x * waves + TIME * speed) * wave_height;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = vec3(0.1, 0.2, 0.6);
|
||||
}
|
||||
19
shaders/006_variables/variables.tscn
Normal file
19
shaders/006_variables/variables.tscn
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://5clduk3kph4t"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/006_variables/variables.gdshader" id="1_gh1k7"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u3tcf"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_gh1k7")
|
||||
shader_parameter/offset_from_ground = 0.5
|
||||
shader_parameter/waves = 8.0
|
||||
shader_parameter/speed = 2.0
|
||||
shader_parameter/wave_height = 0.5
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_sctja"]
|
||||
material = SubResource("ShaderMaterial_u3tcf")
|
||||
|
||||
[node name="Variables" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_sctja")
|
||||
17
shaders/007_reflections/reflections.gdshader
Normal file
17
shaders/007_reflections/reflections.gdshader
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
shader_type spatial;
|
||||
|
||||
uniform float offset_from_ground = 0.5;
|
||||
uniform float waves = 8.0;
|
||||
uniform float speed = 2.0;
|
||||
uniform float wave_height = 0.5;
|
||||
|
||||
void vertex() {
|
||||
// Changing the waves parameter changes how warped the sphere is
|
||||
VERTEX.y += offset_from_ground + sin(VERTEX.x * waves + TIME * speed) * wave_height;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = vec3(0.8, 0.5, 0.0);
|
||||
METALLIC = 1.0;
|
||||
ROUGHNESS = 0.1;
|
||||
}
|
||||
19
shaders/007_reflections/reflections.tscn
Normal file
19
shaders/007_reflections/reflections.tscn
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://csh1kbx37l5el"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/007_reflections/reflections.gdshader" id="1_jqhug"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vldik"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_jqhug")
|
||||
shader_parameter/offset_from_ground = 0.5
|
||||
shader_parameter/waves = 8.0
|
||||
shader_parameter/speed = 2.0
|
||||
shader_parameter/wave_height = 0.5
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_ww17y"]
|
||||
material = SubResource("ShaderMaterial_vldik")
|
||||
|
||||
[node name="Reflections" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_ww17y")
|
||||
14
shaders/008_normals/normals.gdshader
Normal file
14
shaders/008_normals/normals.gdshader
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
shader_type spatial;
|
||||
|
||||
// To send data from the vertex to the fragment (or light) processor function,
|
||||
// varyings are used. They are set for every primitive vertex in the vertex processor,
|
||||
// and the value is interpolated for every pixel in the fragment processor.
|
||||
varying vec3 color;
|
||||
|
||||
void vertex() {
|
||||
color = NORMAL;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = color;
|
||||
}
|
||||
15
shaders/008_normals/normals.tscn
Normal file
15
shaders/008_normals/normals.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bjoxcmy6sy8lb"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/008_normals/normals.gdshader" id="1_bpfbn"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ktxik"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_bpfbn")
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_288vy"]
|
||||
material = SubResource("ShaderMaterial_ktxik")
|
||||
|
||||
[node name="Normals" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_288vy")
|
||||
Loading…
Add table
Add a link
Reference in a new issue