Terrain shader opacity help vs blender
Asked Answered
B

2

0

So I'm making a simple terrain shader with 4 textures that use a mask with the color channels, in blender it works fine with the alpha of that channel but in Godot it doesn't take into account the alpha of the color (second one is godot, first one is blender)

Here's the visual shader :

What it looks like in Godot :

What it looks like in blender :

What should I add for it to behave the same ? \

Oh and here is the converted shader code if that can help instead of visual :

shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx;

uniform sampler2D terrain_mask : source_color, filter_linear_mipmap;
uniform sampler2D texture_a : source_color, filter_nearest;
uniform sampler2D texture_b : source_color, filter_nearest;
uniform sampler2D texture_c : source_color, filter_nearest;
uniform sampler2D texture_d : source_color, filter_nearest;
uniform float specular;


void fragment() {
// Input:4
	vec2 n_out4p0 = UV;


// VectorOp:5
	vec2 n_in5p1 = vec2(100.0000, 100.0000);
	vec2 n_out5p0 = n_out4p0 * n_in5p1;


	vec4 n_out2p0;
// Texture2D:2
	n_out2p0 = texture(texture_a, n_out5p0);


	vec4 n_out6p0;
// Texture2D:6
	n_out6p0 = texture(texture_b, n_out5p0);


	vec4 n_out16p0;
// Texture2D:16
	n_out16p0 = texture(terrain_mask, UV);
	float n_out16p1 = n_out16p0.r;
	float n_out16p2 = n_out16p0.g;
	float n_out16p3 = n_out16p0.b;
	float n_out16p4 = n_out16p0.a;


// Mix:12
	vec3 n_out12p0 = mix(vec3(n_out2p0.xyz), vec3(n_out6p0.xyz), vec3(n_out16p1));


	vec4 n_out8p0;
// Texture2D:8
	n_out8p0 = texture(texture_c, n_out5p0);


// Mix:13
	vec3 n_out13p0 = mix(n_out12p0, vec3(n_out8p0.xyz), vec3(n_out16p2));


	vec4 n_out9p0;
// Texture2D:9
	n_out9p0 = texture(texture_d, n_out5p0);


// Mix:14
	vec3 n_out14p0 = mix(n_out13p0, vec3(n_out9p0.xyz), vec3(n_out16p3));


// Output:0
	SPECULAR = specular;
	ALBEDO = n_out14p0;


}
Brooking answered 29/12, 2023 at 18:5 Comment(0)
P
1

Brooking Multiply the mix weight with wanted alpha.

Protestantism answered 29/12, 2023 at 18:37 Comment(0)
B
0

Protestantism Thank you !

Brooking answered 29/12, 2023 at 20:57 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.