Loading images with noise distortion.
This commit is contained in:
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
||||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
/android/
|
||||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Imagine Composer
|
||||||
|
|
||||||
|
A tool for creating dreamy imaginations from artwork, for use in the blind exploration game Blind Nature.
|
||||||
22
content/imagine.gdshader
Normal file
22
content/imagine.gdshader
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform sampler2D ripples: repeat_enable;
|
||||||
|
uniform float warp;
|
||||||
|
uniform float time_scale = 0.1f;
|
||||||
|
|
||||||
|
vec3 hmap_normal(sampler2D hmap, vec2 uv) {
|
||||||
|
float eps = 0.01f;
|
||||||
|
float z = texture(hmap, uv).z;
|
||||||
|
return normalize(vec3(
|
||||||
|
(texture(hmap, uv + vec2(eps, 0)).z - z) / eps,
|
||||||
|
(texture(hmap, uv + vec2(0, eps)).z - z) / eps,
|
||||||
|
-1
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
//vec3 normal = texture(ripples, UV + vec2(TIME * time_scale, 0)).xyz;
|
||||||
|
vec3 normal = hmap_normal(ripples, UV + vec2(TIME * time_scale, 0));
|
||||||
|
vec4 col = texture(TEXTURE, UV + normal.xy * warp).rgba;
|
||||||
|
COLOR.rgb = col.rgb;
|
||||||
|
}
|
||||||
1
content/imagine.gdshader.uid
Normal file
1
content/imagine.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cutdjeuxu188p
|
||||||
27
content/mat_imagine.tres
Normal file
27
content/mat_imagine.tres
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
[gd_resource type="ShaderMaterial" load_steps=4 format=3 uid="uid://wr6g6bhw2fyj"]
|
||||||
|
|
||||||
|
[ext_resource type="Shader" uid="uid://cutdjeuxu188p" path="res://content/imagine.gdshader" id="1_74fhu"]
|
||||||
|
|
||||||
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_74fhu"]
|
||||||
|
noise_type = 0
|
||||||
|
frequency = 0.0018
|
||||||
|
cellular_distance_function = 1
|
||||||
|
domain_warp_type = 2
|
||||||
|
domain_warp_amplitude = 3.36
|
||||||
|
domain_warp_fractal_type = 2
|
||||||
|
|
||||||
|
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_74fhu"]
|
||||||
|
width = 1280
|
||||||
|
height = 720
|
||||||
|
noise = SubResource("FastNoiseLite_74fhu")
|
||||||
|
seamless = true
|
||||||
|
invert = true
|
||||||
|
in_3d_space = true
|
||||||
|
normalize = false
|
||||||
|
bump_strength = 32.0
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
shader = ExtResource("1_74fhu")
|
||||||
|
shader_parameter/ripples = SubResource("NoiseTexture2D_74fhu")
|
||||||
|
shader_parameter/warp = 0.005
|
||||||
|
shader_parameter/time_scale = 0.035
|
||||||
1
icon.svg
Normal file
1
icon.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 995 B |
43
icon.svg.import
Normal file
43
icon.svg.import
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dldw5nkqr0djl"
|
||||||
|
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://icon.svg"
|
||||||
|
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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=1
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
28
project.godot
Normal file
28
project.godot
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="Imagine Composer"
|
||||||
|
run/main_scene="uid://b8c8qe2xi5m24"
|
||||||
|
config/features=PackedStringArray("4.5", "GL Compatibility")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/viewport_width=1280
|
||||||
|
window/size/viewport_height=720
|
||||||
|
window/stretch/mode="canvas_items"
|
||||||
|
window/stretch/aspect="expand"
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
renderer/rendering_method.mobile="gl_compatibility"
|
||||||
19
run/main.gd
Normal file
19
run/main.gd
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
%LoadImageButton.pressed.connect(show_image_load_dialog)
|
||||||
|
%LoadImageDialog.file_selected.connect(load_image)
|
||||||
|
|
||||||
|
func show_image_load_dialog():
|
||||||
|
%LoadImageDialog.visible = true
|
||||||
|
|
||||||
|
func load_image(path: String) -> bool:
|
||||||
|
var image = Image.load_from_file(path)
|
||||||
|
if image == null:
|
||||||
|
return false
|
||||||
|
|
||||||
|
var tex = ImageTexture.create_from_image(image)
|
||||||
|
%PreviewImage.texture = tex
|
||||||
|
%LoadImageButton.text = path.get_file()
|
||||||
|
return true
|
||||||
1
run/main.gd.uid
Normal file
1
run/main.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://g3xgdtvbtg2f
|
||||||
136
run/main.tscn
Normal file
136
run/main.tscn
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://b8c8qe2xi5m24"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dldw5nkqr0djl" path="res://icon.svg" id="1_4u770"]
|
||||||
|
[ext_resource type="Script" uid="uid://g3xgdtvbtg2f" path="res://run/main.gd" id="1_t8dga"]
|
||||||
|
[ext_resource type="Material" uid="uid://wr6g6bhw2fyj" path="res://content/mat_imagine.tres" id="2_vt7r5"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_t8dga"]
|
||||||
|
bg_color = Color(0.1003897, 0.10924364, 0.113670714, 1)
|
||||||
|
|
||||||
|
[node name="Main" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_t8dga")
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="LoadImageDialog" type="FileDialog" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
oversampling_override = 1.0
|
||||||
|
title = "Open a File"
|
||||||
|
dialog_hide_on_ok = true
|
||||||
|
file_mode = 0
|
||||||
|
access = 2
|
||||||
|
filters = PackedStringArray("*.png")
|
||||||
|
use_native_dialog = true
|
||||||
|
hidden_files_toggle_enabled = false
|
||||||
|
file_filter_toggle_enabled = false
|
||||||
|
file_sort_options_enabled = false
|
||||||
|
folder_creation_enabled = false
|
||||||
|
favorites_enabled = false
|
||||||
|
|
||||||
|
[node name="MainSplit" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="PreviewSide" type="MarginContainer" parent="MainSplit"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_stretch_ratio = 3.0
|
||||||
|
theme_override_constants/margin_left = 8
|
||||||
|
theme_override_constants/margin_top = 8
|
||||||
|
theme_override_constants/margin_right = 8
|
||||||
|
theme_override_constants/margin_bottom = 8
|
||||||
|
|
||||||
|
[node name="PreviewWindow" type="AspectRatioContainer" parent="MainSplit/PreviewSide"]
|
||||||
|
layout_mode = 2
|
||||||
|
ratio = 1.7778
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="MainSplit/PreviewSide/PreviewWindow"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_t8dga")
|
||||||
|
|
||||||
|
[node name="PreviewImage" type="TextureRect" parent="MainSplit/PreviewSide/PreviewWindow/Panel"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
material = ExtResource("2_vt7r5")
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("1_4u770")
|
||||||
|
expand_mode = 1
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="ControlSide" type="PanelContainer" parent="MainSplit"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="MainSplit/ControlSide"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 4
|
||||||
|
theme_override_constants/margin_top = 4
|
||||||
|
theme_override_constants/margin_right = 4
|
||||||
|
theme_override_constants/margin_bottom = 4
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MainSplit/ControlSide/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TitleLabel" type="Label" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 50)
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Imagine Composer"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="FileContainer" type="FoldableContainer" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
title = "File"
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="LoadImageButton" type="Button" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Load Image"
|
||||||
|
|
||||||
|
[node name="LoadFXButton" type="Button" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Load FX"
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="SaveFXButton" type="Button" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Save FX"
|
||||||
|
|
||||||
|
[node name="SaveFXAsButton" type="Button" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Save FX As"
|
||||||
|
|
||||||
|
[node name="FX Container" type="FoldableContainer" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
title = "Effects"
|
||||||
Reference in New Issue
Block a user