First test with ground shading
This commit is contained in:
parent
7a0fa13bf7
commit
da22d36003
14 changed files with 240 additions and 12 deletions
|
@ -1,9 +1,9 @@
|
||||||
[gd_scene load_steps=17 format=3 uid="uid://cvdmfc2hi172g"]
|
[gd_scene load_steps=17 format=3 uid="uid://cvdmfc2hi172g"]
|
||||||
|
|
||||||
[ext_resource type="Material" uid="uid://cdijyqa881tvv" path="res://maps/materials/simple_grid_world.material" id="1_h84bv"]
|
[ext_resource type="Material" uid="uid://dpegsmygxcfmv" path="res://maps/materials/basic_ground.material" id="1_lodye"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cveshwnu272vf" path="res://maps/ramp-complex.tscn" id="2_4eueh"]
|
[ext_resource type="PackedScene" uid="uid://cveshwnu272vf" path="res://maps/ramp-complex.tscn" id="2_4eueh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://omess6wwwwcq" path="res://maps/ramp-moving.tscn" id="3_bvbgo"]
|
[ext_resource type="PackedScene" uid="uid://omess6wwwwcq" path="res://maps/ramp-moving.tscn" id="3_bvbgo"]
|
||||||
[ext_resource type="PackedScene" path="res://maps/moutain.tscn" id="3_rbp35"]
|
[ext_resource type="PackedScene" uid="uid://dvsl8x3lb1h4e" path="res://maps/moutain.tscn" id="3_rbp35"]
|
||||||
[ext_resource type="PackedScene" path="res://maps/cave.tscn" id="4_pc85h"]
|
[ext_resource type="PackedScene" path="res://maps/cave.tscn" id="4_pc85h"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b61edh0bre65c" path="res://maps/ramp.tscn" id="5_dfm8h"]
|
[ext_resource type="PackedScene" uid="uid://b61edh0bre65c" path="res://maps/ramp.tscn" id="5_dfm8h"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bl1widitqdugs" path="res://maps/obstacles.tscn" id="5_mi3we"]
|
[ext_resource type="PackedScene" uid="uid://bl1widitqdugs" path="res://maps/obstacles.tscn" id="5_mi3we"]
|
||||||
|
@ -26,7 +26,7 @@ volumetric_fog_emission = Color(0.407843, 0.415686, 0.439216, 1)
|
||||||
volumetric_fog_detail_spread = 1.60766
|
volumetric_fog_detail_spread = 1.60766
|
||||||
|
|
||||||
[sub_resource type="BoxMesh" id="BoxMesh_k23th"]
|
[sub_resource type="BoxMesh" id="BoxMesh_k23th"]
|
||||||
material = ExtResource( "1_h84bv" )
|
material = ExtResource( "1_lodye" )
|
||||||
|
|
||||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_lld3w"]
|
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_lld3w"]
|
||||||
data = PackedVector3Array(-0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5)
|
data = PackedVector3Array(-0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5)
|
||||||
|
|
BIN
maps/materials/basic_ground.material
Normal file
BIN
maps/materials/basic_ground.material
Normal file
Binary file not shown.
BIN
maps/materials/basic_ground_mountain.material
Normal file
BIN
maps/materials/basic_ground_mountain.material
Normal file
Binary file not shown.
|
@ -1,9 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=3]
|
[gd_scene load_steps=2 format=3 uid="uid://dvsl8x3lb1h4e"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bas4wwnjq76wm" path="res://maps/imports/moutain.gltf" id="1_afq06"]
|
[ext_resource type="PackedScene" uid="uid://bas4wwnjq76wm" path="res://maps/imports/moutain.gltf" id="1_afq06"]
|
||||||
[ext_resource type="Material" path="res://maps/materials/simple_grid_world.material" id="2_pll6h"]
|
|
||||||
|
|
||||||
[node name="moutain" instance=ExtResource( "1_afq06" )]
|
[node name="moutain" instance=ExtResource( "1_afq06" )]
|
||||||
|
|
||||||
[node name="moutain2" parent="." index="0"]
|
[node name="moutain" parent="moutain2" index="0"]
|
||||||
material_override = ExtResource( "2_pll6h" )
|
visible = false
|
||||||
|
|
89
maps/shaders/base_ground.gdshader
Normal file
89
maps/shaders/base_ground.gdshader
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
// NOTE: Shader automatically converted from Godot Engine 4.0.alpha2's StandardMaterial3D.
|
||||||
|
|
||||||
|
shader_type spatial;
|
||||||
|
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
|
||||||
|
uniform vec4 albedo : hint_color;
|
||||||
|
uniform sampler2D texture_albedo : hint_albedo,filter_linear_mipmap,repeat_enable;
|
||||||
|
uniform float point_size : hint_range(0,128);
|
||||||
|
uniform float roughness : hint_range(0,1);
|
||||||
|
uniform sampler2D texture_metallic : hint_white,filter_linear_mipmap,repeat_enable;
|
||||||
|
uniform vec4 metallic_texture_channel;
|
||||||
|
uniform sampler2D texture_roughness : hint_roughness_gray,filter_linear_mipmap,repeat_enable;
|
||||||
|
uniform float specular;
|
||||||
|
uniform float metallic;
|
||||||
|
uniform sampler2D texture_normal : hint_roughness_normal,filter_linear_mipmap,repeat_enable;
|
||||||
|
uniform float normal_scale : hint_range(-16,16);
|
||||||
|
uniform sampler2D texture_heightmap : hint_black,filter_linear_mipmap,repeat_enable;
|
||||||
|
uniform float heightmap_scale;
|
||||||
|
uniform int heightmap_min_layers;
|
||||||
|
uniform int heightmap_max_layers;
|
||||||
|
uniform vec2 heightmap_flip;
|
||||||
|
uniform vec3 uv1_scale;
|
||||||
|
uniform vec3 uv1_offset;
|
||||||
|
uniform vec3 uv2_scale;
|
||||||
|
uniform vec3 uv2_offset;
|
||||||
|
|
||||||
|
vec4 hash4( vec2 p ) { return fract(sin(vec4( 1.0+dot(p,vec2(37.0,17.0)),
|
||||||
|
2.0+dot(p,vec2(11.0,47.0)),
|
||||||
|
3.0+dot(p,vec2(41.0,29.0)),
|
||||||
|
4.0+dot(p,vec2(23.0,31.0))))*103.0); }
|
||||||
|
|
||||||
|
vec4 reduce_tiling( sampler2D samp, in vec2 uv )
|
||||||
|
{
|
||||||
|
vec2 iuv = floor( uv );
|
||||||
|
vec2 fuv = fract( uv );
|
||||||
|
|
||||||
|
// generate per-tile transform
|
||||||
|
vec4 ofa = hash4( iuv + vec2(0.0,0.0) );
|
||||||
|
vec4 ofb = hash4( iuv + vec2(1.0,0.0) );
|
||||||
|
vec4 ofc = hash4( iuv + vec2(0.0,1.0) );
|
||||||
|
vec4 ofd = hash4( iuv + vec2(1.0,1.0) );
|
||||||
|
|
||||||
|
vec2 ddx = dFdx( uv );
|
||||||
|
vec2 ddy = dFdy( uv );
|
||||||
|
|
||||||
|
// transform per-tile uvs
|
||||||
|
ofa.zw = sign(ofa.zw-0.5);
|
||||||
|
ofb.zw = sign(ofb.zw-0.5);
|
||||||
|
ofc.zw = sign(ofc.zw-0.5);
|
||||||
|
ofd.zw = sign(ofd.zw-0.5);
|
||||||
|
|
||||||
|
// uv's, and derivarives (for correct mipmapping)
|
||||||
|
vec2 uva = uv*ofa.zw + ofa.xy; vec2 ddxa = ddx*ofa.zw; vec2 ddya = ddy*ofa.zw;
|
||||||
|
vec2 uvb = uv*ofb.zw + ofb.xy; vec2 ddxb = ddx*ofb.zw; vec2 ddyb = ddy*ofb.zw;
|
||||||
|
vec2 uvc = uv*ofc.zw + ofc.xy; vec2 ddxc = ddx*ofc.zw; vec2 ddyc = ddy*ofc.zw;
|
||||||
|
vec2 uvd = uv*ofd.zw + ofd.xy; vec2 ddxd = ddx*ofd.zw; vec2 ddyd = ddy*ofd.zw;
|
||||||
|
|
||||||
|
// fetch and blend
|
||||||
|
vec2 b = smoothstep(0.25,0.75,fuv);
|
||||||
|
|
||||||
|
return mix( mix( textureGrad( samp, uva, ddxa, ddya ),
|
||||||
|
textureGrad( samp, uvb, ddxb, ddyb ), b.x ),
|
||||||
|
mix( textureGrad( samp, uvc, ddxc, ddyc ),
|
||||||
|
textureGrad( samp, uvd, ddxd, ddyd ), b.x), b.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
void vertex() {
|
||||||
|
UV=UV*uv1_scale.xy+uv1_offset.xy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec2 base_uv = UV;
|
||||||
|
{
|
||||||
|
vec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT*heightmap_flip.x,-BINORMAL*heightmap_flip.y,NORMAL));
|
||||||
|
float depth = 1.0 - reduce_tiling(texture_heightmap, base_uv).r;
|
||||||
|
vec2 ofs = base_uv - view_dir.xy * depth * heightmap_scale;
|
||||||
|
base_uv=ofs;
|
||||||
|
}
|
||||||
|
vec4 albedo_tex = reduce_tiling(texture_albedo,base_uv);
|
||||||
|
ALBEDO = albedo.rgb * albedo_tex.rgb;
|
||||||
|
float metallic_tex = dot(reduce_tiling(texture_metallic,base_uv),metallic_texture_channel);
|
||||||
|
METALLIC = metallic_tex * metallic;
|
||||||
|
vec4 roughness_texture_channel = vec4(0.333333,0.333333,0.333333,0.0);
|
||||||
|
float roughness_tex = dot(reduce_tiling(texture_roughness,base_uv),roughness_texture_channel);
|
||||||
|
ROUGHNESS = roughness_tex * roughness;
|
||||||
|
SPECULAR = specular;
|
||||||
|
NORMAL_MAP = reduce_tiling(texture_normal,base_uv).rgb;
|
||||||
|
NORMAL_MAP_DEPTH = normal_scale;
|
||||||
|
}
|
BIN
maps/textures/base_ground_aa_01/base_ground_aa_01_basecolor.png
Normal file
BIN
maps/textures/base_ground_aa_01/base_ground_aa_01_basecolor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 MiB |
|
@ -0,0 +1,36 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture2D"
|
||||||
|
uid="uid://dktq7grvqd28t"
|
||||||
|
path.s3tc="res://.godot/imported/base_ground_aa_01_basecolor.png-700262e05c3d1d33f43a3abf3320a3a6.s3tc.stex"
|
||||||
|
path.etc2="res://.godot/imported/base_ground_aa_01_basecolor.png-700262e05c3d1d33f43a3abf3320a3a6.etc2.stex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc", "etc2"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://maps/textures/base_ground_aa_01/base_ground_aa_01_basecolor.png"
|
||||||
|
dest_files=["res://.godot/imported/base_ground_aa_01_basecolor.png-700262e05c3d1d33f43a3abf3320a3a6.s3tc.stex", "res://.godot/imported/base_ground_aa_01_basecolor.png-700262e05c3d1d33f43a3abf3320a3a6.etc2.stex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=2
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
compress/streamed=false
|
||||||
|
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/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
BIN
maps/textures/base_ground_aa_01/base_ground_aa_01_height.png
Normal file
BIN
maps/textures/base_ground_aa_01/base_ground_aa_01_height.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
|
@ -0,0 +1,36 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture2D"
|
||||||
|
uid="uid://bepui0ewq3y3g"
|
||||||
|
path.s3tc="res://.godot/imported/base_ground_aa_01_height.png-eace249d3bdc366ea146f8e88448da4e.s3tc.stex"
|
||||||
|
path.etc2="res://.godot/imported/base_ground_aa_01_height.png-eace249d3bdc366ea146f8e88448da4e.etc2.stex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc", "etc2"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://maps/textures/base_ground_aa_01/base_ground_aa_01_height.png"
|
||||||
|
dest_files=["res://.godot/imported/base_ground_aa_01_height.png-eace249d3bdc366ea146f8e88448da4e.s3tc.stex", "res://.godot/imported/base_ground_aa_01_height.png-eace249d3bdc366ea146f8e88448da4e.etc2.stex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=2
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
compress/streamed=false
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=7
|
||||||
|
roughness/src_normal="res://maps/textures/base_ground_aa_01/base_ground_aa_01_normal.png"
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
BIN
maps/textures/base_ground_aa_01/base_ground_aa_01_normal.png
Normal file
BIN
maps/textures/base_ground_aa_01/base_ground_aa_01_normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 MiB |
|
@ -0,0 +1,36 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture2D"
|
||||||
|
uid="uid://cr8lfe63y14j5"
|
||||||
|
path.s3tc="res://.godot/imported/base_ground_aa_01_normal.png-e110b0f1da08b52053b5a642b218118e.s3tc.stex"
|
||||||
|
path.etc2="res://.godot/imported/base_ground_aa_01_normal.png-e110b0f1da08b52053b5a642b218118e.etc2.stex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc", "etc2"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://maps/textures/base_ground_aa_01/base_ground_aa_01_normal.png"
|
||||||
|
dest_files=["res://.godot/imported/base_ground_aa_01_normal.png-e110b0f1da08b52053b5a642b218118e.s3tc.stex", "res://.godot/imported/base_ground_aa_01_normal.png-e110b0f1da08b52053b5a642b218118e.etc2.stex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=2
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=1
|
||||||
|
compress/channel_pack=0
|
||||||
|
compress/streamed=false
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=1
|
||||||
|
roughness/src_normal="res://maps/textures/base_ground_aa_01/base_ground_aa_01_normal.png"
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
BIN
maps/textures/base_ground_aa_01/base_ground_aa_01_roughness.png
Normal file
BIN
maps/textures/base_ground_aa_01/base_ground_aa_01_roughness.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 MiB |
|
@ -0,0 +1,36 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture2D"
|
||||||
|
uid="uid://cp7yn3820dfkl"
|
||||||
|
path.s3tc="res://.godot/imported/base_ground_aa_01_roughness.png-16acb5789d8e4b63beb68501d1ac4560.s3tc.stex"
|
||||||
|
path.etc2="res://.godot/imported/base_ground_aa_01_roughness.png-16acb5789d8e4b63beb68501d1ac4560.etc2.stex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc", "etc2"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://maps/textures/base_ground_aa_01/base_ground_aa_01_roughness.png"
|
||||||
|
dest_files=["res://.godot/imported/base_ground_aa_01_roughness.png-16acb5789d8e4b63beb68501d1ac4560.s3tc.stex", "res://.godot/imported/base_ground_aa_01_roughness.png-16acb5789d8e4b63beb68501d1ac4560.etc2.stex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=2
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
compress/streamed=false
|
||||||
|
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/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
|
@ -1,12 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://ip4lkyho0gry"]
|
[gd_scene load_steps=2 format=3 uid="uid://ip4lkyho0gry"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://crseicp4voddt" path="res://maps/imports/water-space.gltf" id="1_htkji"]
|
[ext_resource type="PackedScene" uid="uid://crseicp4voddt" path="res://maps/imports/water-space.gltf" id="1_htkji"]
|
||||||
[ext_resource type="Material" uid="uid://cdijyqa881tvv" path="res://maps/materials/simple_grid_world.material" id="2_asppa"]
|
|
||||||
|
|
||||||
[node name="water-space" instance=ExtResource( "1_htkji" )]
|
[node name="water-space" instance=ExtResource( "1_htkji" )]
|
||||||
|
|
||||||
[node name="water_space" parent="." index="0"]
|
|
||||||
material_override = ExtResource( "2_asppa" )
|
|
||||||
|
|
||||||
[node name="StaticBody3D" parent="water_space/water_space" index="0"]
|
[node name="StaticBody3D" parent="water_space/water_space" index="0"]
|
||||||
input_ray_pickable = false
|
input_ray_pickable = false
|
||||||
|
|
Loading…
Reference in a new issue