Browse Source

added shader

max
Pixdigit 3 months ago
parent
commit
139a382a0f
6 changed files with 913 additions and 451 deletions
  1. BIN
     
  2. +640
    -446
      assets/models/ship/prototype ship.escn
  3. BIN
     
  4. +0
    -1
      scenes/sub_scenes/player.tscn
  5. +161
    -4
      scenes/sub_scenes/ship.tscn
  6. +112
    -0
      src/shader/sail.shader

BIN
View File


+ 640
- 446
assets/models/ship/prototype ship.escn
File diff suppressed because it is too large
View File


BIN
View File


+ 0
- 1
scenes/sub_scenes/player.tscn View File

@@ -165,7 +165,6 @@ anims/rotate = SubResource( 4 )

[node name="WaterLogo" parent="." instance=ExtResource( 6 )]
transform = Transform( 0.901675, 0, -0.432413, 0, 1, 0, 0.432413, 0, 0.901675, 0, 3, 0 )
visible = false

[node name="AnimationPlayer2" type="AnimationPlayer" parent="WaterLogo"]
autoplay = "rotate"


+ 161
- 4
scenes/sub_scenes/ship.tscn
File diff suppressed because it is too large
View File


+ 112
- 0
src/shader/sail.shader View File

@@ -0,0 +1,112 @@
shader_type spatial;
render_mode blend_mix, depth_draw_always, cull_back, diffuse_burley, specular_schlick_ggx;


uniform sampler2D noise1;
uniform sampler2D noise2;


void node_bsdf_principled(vec4 color, float subsurface, vec4 subsurface_color,
float metallic, float specular, float roughness, float clearcoat,
float clearcoat_roughness, float anisotropy, float transmission,
float IOR, out vec3 albedo, out float sss_strength_out,
out float metallic_out, out float specular_out,
out float roughness_out, out float clearcoat_out,
out float clearcoat_gloss_out, out float anisotropy_out,
out float transmission_out, out float ior) {
metallic = clamp(metallic, 0.0, 1.0);
transmission = clamp(transmission, 0.0, 1.0);

subsurface = subsurface * (1.0 - metallic);

albedo = mix(color.rgb, subsurface_color.rgb, subsurface);
sss_strength_out = subsurface;
metallic_out = metallic;
specular_out = pow((IOR - 1.0)/(IOR + 1.0), 2)/0.08;
roughness_out = roughness;
clearcoat_out = clearcoat * (1.0 - transmission);
clearcoat_gloss_out = 1.0 - clearcoat_roughness;
anisotropy_out = clamp(anisotropy, 0.0, 1.0);
transmission_out = (1.0 - transmission) * (1.0 - metallic);
ior = IOR;
}

void vertex () {
}

void fragment () {
// node: 'Principled BSDF'
// type: 'ShaderNodeBsdfPrincipled'
// input sockets handling
vec4 node0_in0_basecolor = vec4(0.09167075157165527, 0.46101850271224976, 1.0,
1.0);
float node0_in1_subsurface = float(0.0);
vec3 node0_in2_subsurfaceradius = vec3(1.0, 0.20000000298023224,
0.10000000149011612);
vec4 node0_in3_subsurfacecolor = vec4(0.8000000715255737, 0.7206057906150818,
0.7986864447593689, 1.0);
float node0_in4_metallic = float(0.0);
float node0_in5_specular = float(0.5681818127632141);
float node0_in6_speculartint = float(0.4636363685131073);
float node0_in7_roughness = float(0.25);
float node0_in8_anisotropic = float(0.0);
float node0_in9_anisotropicrotation = float(0.17272727191448212);
float node0_in10_sheen = float(0.16363635659217834);
float node0_in11_sheentint = float(0.5);
float node0_in12_clearcoat = float(0.0);
float node0_in13_clearcoatroughness = float(0.029999999329447746);
float node0_in14_ior = float(1.100000023841858);
float node0_in15_transmission = float(1.0);
float node0_in16_transmissionroughness = float(0.0);
vec4 node0_in17_emission = vec4(0.0, 0.0, 0.0, 1.0);
float node0_in18_alpha = float(1.0);
vec3 node0_in19_normal = NORMAL;
vec3 node0_in20_clearcoatnormal = vec3(0.0, 0.0, 0.0);
vec3 node0_in21_tangent = TANGENT;
// output sockets definitions
vec3 node0_bsdf_out0_albedo;
float node0_bsdf_out1_sss_strength;
float node0_bsdf_out3_specular;
float node0_bsdf_out2_metallic;
float node0_bsdf_out4_roughness;
float node0_bsdf_out5_clearcoat;
float node0_bsdf_out6_clearcoat_gloss;
float node0_bsdf_out7_anisotropy;
float node0_bsdf_out8_transmission;
float node0_bsdf_out9_ior;
node_bsdf_principled(node0_in0_basecolor, node0_in1_subsurface,
node0_in3_subsurfacecolor, node0_in4_metallic, node0_in5_specular,
node0_in7_roughness, node0_in12_clearcoat, node0_in13_clearcoatroughness,
node0_in8_anisotropic, node0_in15_transmission, node0_in14_ior,
node0_bsdf_out0_albedo, node0_bsdf_out1_sss_strength, node0_bsdf_out2_metallic,
node0_bsdf_out3_specular, node0_bsdf_out4_roughness, node0_bsdf_out5_clearcoat,
node0_bsdf_out6_clearcoat_gloss, node0_bsdf_out7_anisotropy,
node0_bsdf_out8_transmission, node0_bsdf_out9_ior);
float t = TIME * 0.3;

ALPHA = mix(
smoothstep(0.3, 0.7, texture(noise1, UV + vec2(0.5, 1) * TIME * 0.16).r),
smoothstep(0.3, 0.7, texture(noise2, UV + vec2(0., 1.3) * TIME * 0.1).r),
mix(fract(t), 1. - fract(t), step(fract(t), 0.5))
) * 0.5;

ALBEDO = node0_bsdf_out0_albedo;
EMISSION = node0_bsdf_out0_albedo * 1.4;
SSS_STRENGTH = node0_bsdf_out1_sss_strength;
SPECULAR = node0_bsdf_out3_specular;
METALLIC = node0_bsdf_out2_metallic;
ROUGHNESS = node0_bsdf_out4_roughness;
CLEARCOAT = node0_bsdf_out5_clearcoat;
CLEARCOAT_GLOSS = node0_bsdf_out6_clearcoat_gloss;
NORMAL = node0_in19_normal;
// uncomment it when you need it
// TRANSMISSION = vec3(1.0, 1.0, 1.0) * node0_bsdf_out8_transmission;
// uncomment it when you are modifing TANGENT
// TANGENT = normalize(cross(cross(node0_in21_tangent, NORMAL), NORMAL));
// BINORMAL = cross(TANGENT, NORMAL);
// uncomment it when you have tangent(UV) set
// ANISOTROPY = node0_bsdf_out7_anisotropy;
}

Loading…
Cancel
Save