Improve planet textures; add flowmaps
Flowmaps inspired by this tutorial: https://www.youtube.com/watch?v=KfphtLRoUB0
This commit is contained in:
parent
79c935a62f
commit
b04868f8f4
46
Materials/GasGiantMaterial.tres
Normal file
46
Materials/GasGiantMaterial.tres
Normal file
@ -0,0 +1,46 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Resources/gas_planet_flowmap.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Resources/gas_planet_base.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="Shader" id=1]
|
||||
resource_local_to_scene = true
|
||||
code = "shader_type spatial;
|
||||
|
||||
uniform sampler2D base_texture: hint_albedo;
|
||||
uniform sampler2D flowmap;
|
||||
uniform vec4 color: hint_color;
|
||||
|
||||
uniform float flow_speed = 0.1;
|
||||
uniform float flow_intensity = 0.1;
|
||||
|
||||
void fragment(){
|
||||
// Flow
|
||||
vec2 flow = texture(flowmap, UV).xy;
|
||||
flow = (flow - 0.5) * 2.0;
|
||||
|
||||
// We use two phases which are exactly halfway offset from one another, and we blend between those.
|
||||
// That way, the animation seems to go on infinitely (similar to a Shepard tone)
|
||||
float time_phase_1 = fract(TIME * flow_speed);
|
||||
float time_phase_2 = fract(time_phase_1 + 0.5);
|
||||
float flow_mix = abs((time_phase_1 - 0.5) * 2.0);
|
||||
|
||||
// Read the color values based on the offsets from the flowmap samples and mix them
|
||||
vec3 base_tex_1 = texture(base_texture, UV + (flow * time_phase_1 * flow_intensity)).xyz;
|
||||
vec3 base_tex_2 = texture(base_texture, UV + (flow * time_phase_2 * flow_intensity)).xyz;
|
||||
vec3 base_tex_mix = mix(base_tex_1, base_tex_2, flow_mix);
|
||||
|
||||
// Apply the custom color scaled by that previous greyscale sample
|
||||
vec3 final_color = (0.05 + base_tex_mix.x * 0.95) * color.xyz;
|
||||
|
||||
ALBEDO = final_color;
|
||||
}
|
||||
"
|
||||
|
||||
[resource]
|
||||
shader = SubResource( 1 )
|
||||
shader_param/color = Color( 1, 0.584314, 0, 1 )
|
||||
shader_param/flow_speed = 0.2
|
||||
shader_param/flow_intensity = 0.8
|
||||
shader_param/base_texture = ExtResource( 2 )
|
||||
shader_param/flowmap = ExtResource( 1 )
|
30
Materials/GasGiantShader.shader
Normal file
30
Materials/GasGiantShader.shader
Normal file
@ -0,0 +1,30 @@
|
||||
shader_type spatial;
|
||||
|
||||
uniform sampler2D base_texture: hint_albedo;
|
||||
uniform sampler2D flowmap;
|
||||
uniform vec4 color: hint_color;
|
||||
|
||||
uniform float flow_speed = 0.1;
|
||||
uniform float flow_intensity = 0.1;
|
||||
|
||||
void fragment(){
|
||||
// Flow
|
||||
vec2 flow = texture(flowmap, UV).xy;
|
||||
flow = (flow - 0.5) * 2.0;
|
||||
|
||||
// We use two phases which are exactly halfway offset from one another, and we blend between those.
|
||||
// That way, the animation seems to go on infinitely (similar to a Shepard tone)
|
||||
float time_phase_1 = fract(TIME * flow_speed);
|
||||
float time_phase_2 = fract(time_phase_1 + 0.5);
|
||||
float flow_mix = abs((time_phase_1 - 0.5) * 2.0);
|
||||
|
||||
// Read the color values based on the offsets from the flowmap samples and mix them
|
||||
vec3 base_tex_1 = texture(base_texture, UV + (flow * time_phase_1 * flow_intensity)).xyz;
|
||||
vec3 base_tex_2 = texture(base_texture, UV + (flow * time_phase_2 * flow_intensity)).xyz;
|
||||
vec3 base_tex_mix = mix(base_tex_1, base_tex_2, flow_mix);
|
||||
|
||||
// Apply the custom color scaled by that previous greyscale sample
|
||||
vec3 final_color = (0.05 + base_tex_mix.x * 0.95) * color.xyz;
|
||||
|
||||
ALBEDO = final_color;
|
||||
}
|
@ -1,13 +1,10 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="Shader" id=1]
|
||||
code = "shader_type spatial;
|
||||
shader_type spatial;
|
||||
|
||||
|
||||
uniform vec2 scale = vec2(50.0);
|
||||
uniform bool seamless = false;
|
||||
|
||||
uniform vec3 color_scale;
|
||||
uniform vec4 color_scale: hint_color;
|
||||
|
||||
float rand(vec2 coord) {
|
||||
return fract(sin(dot(coord, vec2(12.9898, 78.233))) * 43758.5453);
|
||||
@ -46,12 +43,5 @@ void fragment() {
|
||||
|
||||
float value = perlin_noise(coord);
|
||||
|
||||
ALBEDO = vec3(value * color_scale);
|
||||
}"
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = true
|
||||
shader = SubResource( 1 )
|
||||
shader_param/scale = Vector2( 50, 50 )
|
||||
shader_param/seamless = false
|
||||
shader_param/color_scale = Vector3( 0.8, 0.2, 0.4 )
|
||||
ALBEDO = vec3(value * color_scale.rgb);
|
||||
}
|
10
Materials/PlanetMaterial.tres
Normal file
10
Materials/PlanetMaterial.tres
Normal file
@ -0,0 +1,10 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Materials/PerlinPlanetShader.shader" type="Shader" id=1]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource( 1 )
|
||||
shader_param/scale = Vector2( 20, 40 )
|
||||
shader_param/seamless = false
|
||||
shader_param/color_scale = Color( 0.160784, 0.411765, 0.72549, 1 )
|
BIN
Resources/gas_planet_base.png
Normal file
BIN
Resources/gas_planet_base.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 539 KiB |
36
Resources/gas_planet_base.png.import
Normal file
36
Resources/gas_planet_base.png.import
Normal file
@ -0,0 +1,36 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/gas_planet_base.png-1056673f46c3b64eaf0d4ae7a8b6d514.s3tc.stex"
|
||||
path.etc2="res://.import/gas_planet_base.png-1056673f46c3b64eaf0d4ae7a8b6d514.etc2.stex"
|
||||
metadata={
|
||||
"imported_formats": [ "s3tc", "etc2" ],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Resources/gas_planet_base.png"
|
||||
dest_files=[ "res://.import/gas_planet_base.png-1056673f46c3b64eaf0d4ae7a8b6d514.s3tc.stex", "res://.import/gas_planet_base.png-1056673f46c3b64eaf0d4ae7a8b6d514.etc2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=1
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
BIN
Resources/gas_planet_flowmap.png
Normal file
BIN
Resources/gas_planet_flowmap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 105 KiB |
36
Resources/gas_planet_flowmap.png.import
Normal file
36
Resources/gas_planet_flowmap.png.import
Normal file
@ -0,0 +1,36 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/gas_planet_flowmap.png-448b81864accf30ac7e426b237f70468.s3tc.stex"
|
||||
path.etc2="res://.import/gas_planet_flowmap.png-448b81864accf30ac7e426b237f70468.etc2.stex"
|
||||
metadata={
|
||||
"imported_formats": [ "s3tc", "etc2" ],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Resources/gas_planet_flowmap.png"
|
||||
dest_files=[ "res://.import/gas_planet_flowmap.png-448b81864accf30ac7e426b237f70468.s3tc.stex", "res://.import/gas_planet_flowmap.png-448b81864accf30ac7e426b237f70468.etc2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
75
World.tscn
75
World.tscn
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user