Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions hdr_output/color_sweep/color_sweep.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[gd_scene format=3 uid="uid://drlb4o61s5wsk"]

[ext_resource type="Script" uid="uid://cqjmg63jbxlns" path="res://color_sweep/colour_sweep.gd" id="1_3qbqk"]
[ext_resource type="Shader" uid="uid://upgu5h4jlibh" path="res://color_sweep/colour_sweep.gdshader" id="2_hfxc4"]

[sub_resource type="ShaderMaterial" id="ShaderMaterial_lquwl"]
shader = ExtResource("2_hfxc4")
shader_parameter/log2_min = -18.0
shader_parameter/log2_max = 5.0
shader_parameter/clip_to_max = false
shader_parameter/max_value = 10.0

[sub_resource type="QuadMesh" id="QuadMesh_7mycd"]

[node name="ColorSweep" type="Control" unique_id=784950953]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_3qbqk")

[node name="ColourSweepMesh" type="MeshInstance2D" parent="." unique_id=852978860]
unique_name_in_owner = true
material = SubResource("ShaderMaterial_lquwl")
position = Vector2(414.00003, 303)
scale = Vector2(822.00006, -528.00006)
mesh = SubResource("QuadMesh_7mycd")

[node name="Tooltip" type="Control" parent="." unique_id=1015235051]
anchors_preset = 0
offset_left = 3.0
offset_top = 39.0
offset_right = 825.0
offset_bottom = 567.0
tooltip_text = "The upper tick mark indicates
output_max_linear_value.

The other tick marks are multiples
of 0.01, 0.1, 1.0, 10.0, etc. with
the rightmost white tick mark
indicating 0.1 and the leftmost
black tick mark indicating 0.2."

[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=832456838]
layout_mode = 0
offset_top = 2.0
offset_right = 828.0
offset_bottom = 42.0
alignment = 1

[node name="Label" type="Label" parent="HBoxContainer" unique_id=873923751]
layout_mode = 2
text = "Min"

[node name="MinHSlider" type="HSlider" parent="HBoxContainer" unique_id=2106554318]
unique_name_in_owner = true
custom_minimum_size = Vector2(180, 0)
layout_mode = 2
size_flags_vertical = 4
min_value = -25.0
max_value = 10.0
step = 0.05000000000291038
value = -13.999999999359712

[node name="Label2" type="Label" parent="HBoxContainer" unique_id=473575971]
layout_mode = 2
text = "Max"

[node name="MaxHSlider" type="HSlider" parent="HBoxContainer" unique_id=1145534836]
unique_name_in_owner = true
custom_minimum_size = Vector2(180, 0)
layout_mode = 2
size_flags_vertical = 4
min_value = -25.0
max_value = 10.0
step = 0.05000000000291038
value = 5.0000000017462405

[node name="SweepMinLabel" type="Label" parent="." unique_id=648280970]
unique_name_in_owner = true
layout_mode = 0
offset_left = 4.0
offset_top = 10.0
offset_right = 301.0
offset_bottom = 33.0
text = "0.000 (0.01 nits)"

[node name="SweepMaxLabel" type="Label" parent="." unique_id=177120907]
unique_name_in_owner = true
layout_mode = 0
offset_left = 499.0
offset_top = 10.0
offset_right = 823.0
offset_bottom = 33.0
text = "32.00 (13824.00 nits)"
horizontal_alignment = 2

[connection signal="value_changed" from="HBoxContainer/MinHSlider" to="." method="_on_min_h_slider_value_changed"]
[connection signal="value_changed" from="HBoxContainer/MaxHSlider" to="." method="_on_max_h_slider_value_changed"]
24 changes: 24 additions & 0 deletions hdr_output/color_sweep/colour_sweep.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extends Control

var clip_to_max_lum: bool = false


func _process(_delta: float) -> void:
var window: Window = get_window()
var window_id = get_window().get_window_id()
var sm: ShaderMaterial = %ColourSweepMesh.material as ShaderMaterial
sm.set_shader_parameter("max_value", window.get_output_max_linear_value());
%SweepMinLabel.text = "%0.3f (%0.2f nits)" % [pow(2, %MinHSlider.value), pow(2, %MinHSlider.value) * DisplayServer.window_get_hdr_output_current_reference_luminance(window_id)]
%SweepMaxLabel.text = "%0.2f (%0.2f nits)" % [pow(2, %MaxHSlider.value), pow(2, %MaxHSlider.value) * DisplayServer.window_get_hdr_output_current_reference_luminance(window_id)]


func _on_min_h_slider_value_changed(value: float) -> void:
%MaxHSlider.min_value = value;
var sm: ShaderMaterial = %ColourSweepMesh.material as ShaderMaterial
sm.set_shader_parameter("log2_min", value)


func _on_max_h_slider_value_changed(value: float) -> void:
%MinHSlider.max_value = value;
var sm: ShaderMaterial = %ColourSweepMesh.material as ShaderMaterial
sm.set_shader_parameter("log2_max", value)
1 change: 1 addition & 0 deletions hdr_output/color_sweep/colour_sweep.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://cqjmg63jbxlns
106 changes: 106 additions & 0 deletions hdr_output/color_sweep/colour_sweep.gdshader
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
shader_type canvas_item;
render_mode unshaded;

uniform float log2_min = -18.0;
uniform float log2_max = 5.0;
uniform bool clip_to_max = false;
uniform float max_value = 10;

void fragment() {
vec3 color;
float top_bar = 0.05;
float log2_value = UV.x * (log2_max - log2_min) + log2_min;
float scale = pow(2.0, log2_value);

if (UV.y >= top_bar)
{
float padding = 0.005;
float y = (UV.y - top_bar - padding) / (1.0 - top_bar - padding * 2.0);
y = clamp(y, 0.0, 1.0);
float segments = 1.0 / 6.0;
vec3 col = vec3(0);
if (y < segments)
{
col.r = 1.0;
col.g = y / segments;
col.b = 0.0;
}
else if (y < segments * 2.0)
{
col.r = (y - segments * 2.0) / -segments;
col.g = 1.0;
col.b = 0.0;
}
else if (y < segments * 3.0)
{
col.r = 0.0;
col.g = 1.0;
col.b = (y - segments * 2.0) / segments;
}
else if (y < segments * 4.0)
{
col.r = 0.0;
col.g = (y - segments * 4.0) / -segments;
col.b = 1.0;
}
else if (y < segments * 5.0)
{
col.r = (y - segments * 4.0) / segments;
col.g = 0.0;
col.b = 1.0;
}
else
{
col.r = 1.0;
col.g = 0.0;
col.b = (y - segments * 6.0) / -segments;
}

color = col * scale;
}
else
{
color = vec3(1.0) * scale;

if (UV.y < 0.01) {
// Max value mark:
float max_log2 = log2(max_value);
float scale_log2 = log2(scale);
float mark_size = 0.03;
if (scale_log2 > max_log2 - mark_size && scale_log2 < max_log2 + mark_size) {
color = vec3(0);
}
} else if (UV.y > 0.03) {
// Log scale marks:
float tick_col = scale > 0.184 ? 0.0 : 1.0;
while (scale >= 1.0) {
scale /= 10.0;
}
while (scale < 0.1) {
scale *= 10.0;
}
float tick_threshold = scale * 0.02;
if ((scale > 1.0 - tick_threshold && scale < 1.0 + tick_threshold)
|| (scale > 0.0 - tick_threshold && scale < 0.0 + tick_threshold)
|| (scale > 0.1 - tick_threshold && scale < 0.1 + tick_threshold)) {
color = vec3(tick_col);
} else if (UV.y > 0.04
&& ((scale > 0.9 - tick_threshold && scale < 0.9 + tick_threshold)
|| (scale > 0.8 - tick_threshold && scale < 0.8 + tick_threshold)
|| (scale > 0.7 - tick_threshold && scale < 0.7 + tick_threshold)
|| (scale > 0.6 - tick_threshold && scale < 0.6 + tick_threshold)
|| (scale > 0.5 - tick_threshold && scale < 0.5 + tick_threshold)
|| (scale > 0.4 - tick_threshold && scale < 0.4 + tick_threshold)
|| (scale > 0.3 - tick_threshold && scale < 0.3 + tick_threshold)
|| (scale > 0.2 - tick_threshold && scale < 0.2 + tick_threshold))) {
color = vec3(tick_col);
}
}
}

if (clip_to_max) {
color = min(color, max_value);
}

COLOR = vec4(color.rgb, 1.0);
}
1 change: 1 addition & 0 deletions hdr_output/color_sweep/colour_sweep.gdshader.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://upgu5h4jlibh
28 changes: 28 additions & 0 deletions hdr_output/environment/3d_environment.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[gd_scene format=3 uid="uid://c0wukesav63su"]

[ext_resource type="PackedScene" uid="uid://cyg6jtuudogcg" path="res://environment/gpu_particles_fire.tscn" id="1_oevuw"]

[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_7l7or"]
sky_top_color = Color(0.34199998, 0.5161667, 0.76, 1)

[sub_resource type="Sky" id="Sky_oevuw"]
sky_material = SubResource("ProceduralSkyMaterial_7l7or")

[sub_resource type="Environment" id="Environment_dg77c"]
background_mode = 2
sky = SubResource("Sky_oevuw")
tonemap_mode = 4
tonemap_agx_contrast = 1.32

[node name="Node3D" type="Node3D" unique_id=229028905]

[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=522993847]
environment = SubResource("Environment_dg77c")

[node name="Camera3D" type="Camera3D" parent="." unique_id=1229274230]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.0156713)

[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1268142717]

[node name="GPUParticlesFire" parent="." unique_id=1592479161 instance=ExtResource("1_oevuw")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.7439877, 0)
44 changes: 44 additions & 0 deletions hdr_output/environment/fire.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[gd_scene format=3 uid="uid://bcif16iayg5dj"]

[ext_resource type="Texture2D" uid="uid://dkl7yvfg3ivr3" path="res://fire_particle.png" id="1_2pqqt"]

[sub_resource type="CanvasItemMaterial" id="1"]
blend_mode = 1

[sub_resource type="Curve" id="2"]
_limits = [-360.0, 360.0, 0.0, 1.0]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 85.0781), 0.0, 0.0, 0, 0]
point_count = 2

[sub_resource type="CurveTexture" id="3"]
curve = SubResource("2")

[sub_resource type="Gradient" id="Gradient_wdtkk"]
offsets = PackedFloat32Array(0, 0.142857, 0.506494, 0.961039)
colors = PackedColorArray(0, 0, 0.803922, 1, 0.858824, 0.180392, 0.0470588, 1, 0.788235, 0.294118, 0, 1, 0, 0, 0, 0)

[sub_resource type="GradientTexture1D" id="GradientTexture1D_fv41j"]
gradient = SubResource("Gradient_wdtkk")

[sub_resource type="Curve" id="4"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.11, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3

[sub_resource type="CurveTexture" id="5"]
curve = SubResource("4")

[sub_resource type="ParticleProcessMaterial" id="6"]
emission_shape = 1
emission_sphere_radius = 8.0
angular_velocity_curve = SubResource("3")
gravity = Vector3(0, -250, 0)
scale_curve = SubResource("5")
color_ramp = SubResource("GradientTexture1D_fv41j")

[node name="Fire" type="GPUParticles2D" unique_id=1051806849]
texture_filter = 4
material = SubResource("1")
amount = 32
texture = ExtResource("1_2pqqt")
preprocess = 1.0
process_material = SubResource("6")
Binary file added hdr_output/environment/fire_particle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions hdr_output/environment/fire_particle.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dkl7yvfg3ivr3"
path="res://.godot/imported/fire_particle.png-2d5c46863bbeaf227772f709dff146aa.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://environment/fire_particle.png"
dest_files=["res://.godot/imported/fire_particle.png-2d5c46863bbeaf227772f709dff146aa.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=true
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
Loading
Loading