rendering fixes

rose_physics
jonathan 2 months ago
parent a128d801be
commit 01812b45c3

@ -101,9 +101,8 @@ curve = SubResource("Curve_gcpng")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gcpng"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_gcpng"]
shader = ExtResource("9_k5i88") shader = ExtResource("9_k5i88")
shader_parameter/target_tex_size = Vector2(427, 240)
shader_parameter/color_steps = 24.0 shader_parameter/color_steps = 24.0
shader_parameter/color_min = 0.0
shader_parameter/color_max = 0.999999977648
shader_parameter/color_curve = SubResource("CurveTexture_5747v") shader_parameter/color_curve = SubResource("CurveTexture_5747v")
[sub_resource type="ViewportTexture" id="ViewportTexture_dp7jk"] [sub_resource type="ViewportTexture" id="ViewportTexture_dp7jk"]
@ -189,7 +188,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.8011624, 1.3881333, 4.88327
mesh = SubResource("BoxMesh_oslft") mesh = SubResource("BoxMesh_oslft")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/Cieling"] [node name="MeshInstance3D2" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/Cieling"]
transform = Transform3D(-4.371138e-08, -1, -8.742278e-08, 1, -4.371139e-08, 8.742278e-08, -8.742278e-08, -8.742278e-08, 1, -1.085567, 0.17431808, 3.1567752) transform = Transform3D(-4.371138e-08, -1, -8.742278e-08, 1, -4.371139e-08, 8.742278e-08, -8.742278e-08, -8.742278e-08, 1, -1.085567, 0.19348681, 3.156775)
mesh = SubResource("BoxMesh_gcpng") mesh = SubResource("BoxMesh_gcpng")
[node name="back wall" type="Node3D" parent="SubViewportContainer/SubViewport"] [node name="back wall" type="Node3D" parent="SubViewportContainer/SubViewport"]
@ -218,12 +217,12 @@ skeleton = NodePath("../../Fake lights")
[node name="Fake lights" type="Node3D" parent="SubViewportContainer/SubViewport"] [node name="Fake lights" type="Node3D" parent="SubViewportContainer/SubViewport"]
[node name="OmniLight3D3" type="OmniLight3D" parent="SubViewportContainer/SubViewport"] [node name="OmniLight3D3" type="OmniLight3D" parent="SubViewportContainer/SubViewport"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.4813757, 1.2506423, 4.327849) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.8505666, 1.2506423, 4.1084437)
light_color = Color(1, 0.6068378, 0.4258487, 1) light_color = Color(1, 0.6068378, 0.4258487, 1)
light_indirect_energy = 0.0 light_indirect_energy = 0.0
shadow_enabled = true shadow_enabled = true
omni_range = 11.183 omni_range = 2.081
omni_attenuation = 1.538 omni_attenuation = 3.068
[node name="AnimationPlayer" type="AnimationPlayer" parent="SubViewportContainer/SubViewport/OmniLight3D3"] [node name="AnimationPlayer" type="AnimationPlayer" parent="SubViewportContainer/SubViewport/OmniLight3D3"]
libraries = { libraries = {
@ -286,6 +285,10 @@ material = SubResource("FogMaterial_dp7jk")
[node name="WorldEnvironment" type="WorldEnvironment" parent="SubViewportContainer/SubViewport"] [node name="WorldEnvironment" type="WorldEnvironment" parent="SubViewportContainer/SubViewport"]
environment = SubResource("Environment_dp7jk") environment = SubResource("Environment_dp7jk")
[node name="tmp phone light" type="OmniLight3D" parent="SubViewportContainer/SubViewport"]
transform = Transform3D(0.5765749, 0.8170443, 0, -0.8170443, 0.5765749, 0, 0, 0, 1, -2.4286354, 2.0967534, -0.82138157)
light_energy = 0.05
[node name="TextureRect" type="TextureRect" parent="."] [node name="TextureRect" type="TextureRect" parent="."]
material = SubResource("ShaderMaterial_gcpng") material = SubResource("ShaderMaterial_gcpng")
anchors_preset = 15 anchors_preset = 15

@ -1,25 +1,25 @@
shader_type canvas_item; shader_type canvas_item;
uniform vec2 target_tex_size = vec2(1280,720);
uniform float color_steps:hint_range(1.0, 255.0, 1.0); uniform float color_steps:hint_range(1.0, 255.0, 1.0);
uniform float color_min:hint_range(0.0, 1.0, 0.01) = 0;
uniform float color_max:hint_range(0.0, 1.0, 0.01) = 1;
uniform sampler2D color_curve; uniform sampler2D color_curve;
void vertex() { void vertex() {
// Called for every vertex the material is visible on. // Called for every vertex the material is visible on.
} }
void fragment() { void fragment() {
vec2 texSize = vec2(textureSize(TEXTURE,0)); // For performance reasons, this function should be avoided as it always performs a full texture read. When possible, you should pass the texture size as a uniform instead. //vec2 texSize = vec2(textureSize(TEXTURE,0)); // For performance reasons, this function should be avoided as it always performs a full texture read. When possible, you should pass the texture size as a uniform instead.
texSize = texSize / 4.; //texSize = texSize / 4.;
ivec2 intUv = ivec2(texSize * UV); ivec2 intUv = ivec2(target_tex_size * UV);
vec2 flooredUv = vec2(intUv) / texSize; vec2 flooredUv = vec2(intUv) / target_tex_size;
vec3 fullColor = texture(TEXTURE,flooredUv).rgb; vec3 fullColor = texture(TEXTURE,flooredUv).rgb;
//vec3 strechedColor = (fullColor - color_min) / color_max;
vec3 strechedColor = vec3( vec3 strechedColor = vec3(
texture(color_curve,vec2(fullColor.r,0)).r, texture(color_curve,vec2(fullColor.r,0)).r,
texture(color_curve,vec2(fullColor.g,0)).r, texture(color_curve,vec2(fullColor.g,0)).g,
texture(color_curve,vec2(fullColor.b,0)).r); texture(color_curve,vec2(fullColor.b,0)).b);
vec3 scaledColor = strechedColor * color_steps; vec3 scaledColor = strechedColor * color_steps;
vec3 roundColor = round(scaledColor); vec3 roundColor = round(scaledColor);
vec3 backScaledColor = roundColor / color_steps; vec3 backScaledColor = roundColor / color_steps;

Loading…
Cancel
Save