Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader_type spatial;
- render_mode unshaded;
- uniform sampler2D colorA :hint_albedo;
- uniform sampler2D colorB :hint_albedo;
- uniform sampler2D colorC :hint_albedo;
- uniform sampler2D normalA :hint_normal;
- uniform sampler2D normalB :hint_normal;
- uniform sampler2D normalC :hint_normal;
- /////////////////////////////
- /*MASKING:
- R = METALIC
- G = ROUGHTNESS
- B = HEIGHT
- */
- uniform sampler2D maskingA;
- uniform sampler2D maskingB;
- uniform sampler2D maskingC;
- ////////////////////////////
- /*VERTEX COLOR:
- R = textureA
- G = textureB
- B = textureC
- */
- varying vec4 vertexColor;
- void vertex() {
- vertexColor = COLOR;
- }
- vec3 hlerp(vec4 texture1, float a1, vec4 texture2, float a2)
- {
- float depth = 0.2;
- float ma = max(texture1.a + a1, texture2.a + a2) - depth;
- float b1 = max(texture1.a + a1 - ma, 0);
- float b2 = max(texture2.a + a2 - ma, 0);
- return (texture1.rgb * b1 + texture2.rgb * b2) / (b1 + b2);
- }
- float vColAdd (float a, float b){
- float result = max(a + b, 0);
- }
- void fragment(){
- vec4 colA = texture(colorA, UV);
- vec4 colB = texture(colorB, UV);
- vec4 colC = texture(colorC, UV);
- vec4 norA = texture(normalA, UV);
- vec4 norB = texture(normalB, UV);
- vec4 norC = texture(normalC, UV);
- vec4 maskA = texture(maskingA, UV);
- vec4 maskB = texture(maskingB, UV);
- vec4 maskC = texture(maskingC, UV);
- // ALBEDO = hlerp(colA, vertexColor.r, colB, vertexColor.g).rgb;
- // ALBEDO = colA.rgb;
- NORMAL = hlerp(norA, vertexColor.r, norB, vertexColor.g).rgb;
- ROUGHNESS = 1f;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement