Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader_type spatial;
- render_mode shadows_disabled;
- //render_mode unshaded;
- uniform vec4 main_color : hint_color;
- uniform vec4 intersection_color : hint_color;
- uniform float intersection_max_threshold = 0.5;
- uniform sampler2D displ_tex : hint_white;
- uniform sampler2D noise1;
- uniform sampler2D noise2;
- uniform float displ_amount = 0.6;
- uniform float near = 0.15;
- uniform float far = 300.0;
- float linearize(float c_depth) {
- c_depth = 2.0 * c_depth - 1.0;
- return near * far / (far + c_depth * (near - far));
- }
- void fragment(){
- // partie LAVA
- float t = TIME * 0.005;
- vec3 v1 = texture(noise1, UV +t).rgb;
- vec3 v2 = texture(noise2, UV -t).rgb;
- float sum = (v1.r + v2.r) - 0.7;
- // vec4 back = vec4(1.0, 0.0, 0.0, 1.0);
- float fin = 0.0;
- if(sum > 0.0 && sum < 0.2) fin = 0.2;
- if(sum > 0.2 && sum <= 0.7) fin = 0.0;
- if(sum > 0.7 ) fin = 1.0;
- vec3 lava = vec3(fin) + mix(main_color.rgb, intersection_color.rgb, 0.5) ;
- // partie FOAM
- float zdepth = linearize(texture(DEPTH_TEXTURE, SCREEN_UV).x);
- float zpos = linearize(FRAGCOORD.z);
- float diff = zdepth - zpos;
- vec2 displ = texture(displ_tex, UV - TIME / 20.0).gb;
- displ = ((displ * 2.0) - 1.0) * displ_amount;
- diff += displ.x;
- vec4 col = mix(intersection_color, main_color, step(intersection_max_threshold, diff));
- vec3 final = col.rgb+ lava;
- ALBEDO = final;
- EMISSION =final * 1.5;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement