39 lines
1.0 KiB
Plaintext
39 lines
1.0 KiB
Plaintext
shader_type spatial;
|
|
render_mode unshaded, diffuse_lambert;
|
|
|
|
uniform float amount = 3.0f;
|
|
uniform float intensity = 1.0f;
|
|
uniform vec3 fresnel_color : source_color = vec3(1,1,1);
|
|
uniform sampler2D noise_texture;
|
|
varying float flux;
|
|
|
|
float fresnel(vec3 normal, vec3 view)
|
|
{
|
|
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount);
|
|
}
|
|
|
|
vec3 fresnel_glow(vec3 normal, vec3 view)
|
|
{
|
|
return pow((1.0 - dot(normalize(normal), normalize(view))), amount) * fresnel_color * intensity;
|
|
}
|
|
|
|
void vertex()
|
|
{
|
|
flux = .1 + .9 * texture(noise_texture, vec2(UV.x + TIME * .1, UV.y + TIME*.2)).r;
|
|
}
|
|
void fragment()
|
|
{
|
|
|
|
vec3 base_color = vec3(0.0);
|
|
vec3 basic_fresnel = fresnel_glow(NORMAL, VIEW);
|
|
float f = texture(noise_texture, vec2(NORMAL.x + TIME * .1, NORMAL.y + TIME*.2)).r;
|
|
ALBEDO = base_color + basic_fresnel * f;
|
|
float fres_alpha = fresnel(NORMAL, VIEW);
|
|
ALPHA = fres_alpha;
|
|
}
|
|
|
|
//void light() {
|
|
// // Called for every pixel for every light affecting the material.
|
|
// // Uncomment to replace the default light processing function with this one.
|
|
//}
|