Tweaking Water shader and material

This commit is contained in:
yannk 2022-02-05 00:16:11 +01:00
parent ad2fd38a42
commit 3696147038
2 changed files with 22 additions and 19 deletions

View file

@ -30,30 +30,30 @@ uniform vec4 wave_b = vec4(1.0, 0.6, 0.30, 1.55); // xy = Direction, z = Stee
uniform vec4 wave_c = vec4(1.0, 1.3, 0.25, 0.9); // xy = Direction, z = Steepness, w = Length
// Surface settings:
uniform vec2 sampler_scale = vec2(0.25, 0.25); // Scale for the sampler
uniform vec2 sampler_direction= vec2(0.05, 0.04); // Direction and speed for the sampler offset
uniform vec2 sampler_scale = vec2(0.25, 0.25); // Scale for the sampler
uniform vec2 sampler_direction= vec2(0.05, 0.04); // Direction and speed for the sampler offset
uniform sampler2D uv_sampler : hint_anisotropy; // UV motion sampler for shifting the normalmap
uniform vec2 uv_sampler_scale = vec2(0.25, 0.25); // UV sampler scale
uniform float uv_sampler_strength = 0.04; // UV shifting strength
uniform sampler2D uv_sampler : hint_anisotropy; // UV motion sampler for shifting the normalmap
uniform vec2 uv_sampler_scale = vec2(0.25, 0.25); // UV sampler scale
uniform float uv_sampler_strength = 0.04; // UV shifting strength
uniform sampler2D normalmap_a_sampler : hint_normal; // Normalmap sampler A
uniform sampler2D normalmap_b_sampler : hint_normal; // Normalmap sampler B
uniform sampler2D normalmap_a_sampler : hint_normal; // Normalmap sampler A
uniform sampler2D normalmap_b_sampler : hint_normal; // Normalmap sampler B
uniform sampler2D foam_sampler : hint_black; // Foam sampler
uniform float foam_level = 0.5; // Foam level -> distance from the object (0.0 - 0.5)
uniform sampler2D foam_sampler : hint_black; // Foam sampler
uniform float foam_level = 0.5; // Foam level -> distance from the object (0.0 - 0.5)
// Volume settings:
uniform float refraction = 0.075; // Refraction of the water
uniform float refraction = 0.075; // Refraction of the water
uniform vec4 color_deep : hint_color; // Color for deep places in the water, medium to dark blue
uniform vec4 color_shallow : hint_color; // Color for lower places in the water, bright blue - green
uniform float beers_law = 2.0; // Beers law value, regulates the blending size to the deep water level
uniform float depth_offset = -0.75; // Offset for the blending
uniform vec4 color_deep : hint_color; // Color for deep places in the water, medium to dark blue
uniform vec4 color_shallow : hint_color; // Color for lower places in the water, bright blue - green
uniform float beers_law = 2.0; // Beers law value, regulates the blending size to the deep water level
uniform float depth_offset = -0.75; // Offset for the blending
// Projector for the water caustics:
uniform mat4 projector; // Projector matrix, mostly the matric of the sun / directlight
uniform sampler2DArray caustic_sampler : hint_black; // Caustic sampler, (Texture array with 16 Textures for the animation)
uniform mat4 projector; // Projector matrix, mostly the matric of the sun / directlight
uniform sampler2DArray caustic_sampler : hint_black; // Caustic sampler, (Texture array with 16 Textures for the animation)
// Vertex -> Fragment:

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://bkcvep4ijijmc"]
[gd_scene load_steps=9 format=3 uid="uid://bkcvep4ijijmc"]
[ext_resource type="Shader" path="res://maps/shaders/water.gdshader" id="1_j5guc"]
[ext_resource type="PackedScene" uid="uid://ip4lkyho0gry" path="res://maps/water_space.tscn" id="2_nnfoe"]
@ -6,6 +6,8 @@
[ext_resource type="Texture2D" uid="uid://b8tu2ncerig3r" path="res://maps/textures/water_normal_b.png" id="4_gohr5"]
[ext_resource type="Texture2D" uid="uid://dv1ywlb7inqyu" path="res://maps/textures/water_uv_sampler.png" id="5_uyeqp"]
[sub_resource type="Texture2DArray" id="Texture2DArray_um4oc"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_tfcq0"]
render_priority = 0
shader = ExtResource( "1_j5guc" )
@ -21,12 +23,13 @@ shader_param/foam_level = 0.0
shader_param/refraction = 0.075
shader_param/color_deep = Color(0.0117647, 0.380392, 0.564706, 1)
shader_param/color_shallow = Color(0, 0.486275, 0.564706, 1)
shader_param/beers_law = 0.8
shader_param/depth_offset = -1.5
shader_param/beers_law = 2.0
shader_param/depth_offset = 0.0
shader_param/projector = null
shader_param/uv_sampler = ExtResource( "5_uyeqp" )
shader_param/normalmap_a_sampler = ExtResource( "3_vwt8h" )
shader_param/normalmap_b_sampler = ExtResource( "4_gohr5" )
shader_param/caustic_sampler = SubResource( "Texture2DArray_um4oc" )
[sub_resource type="PlaneMesh" id="PlaneMesh_uh76x"]
material = SubResource( "ShaderMaterial_tfcq0" )