space-game001/shaders/defaultColor_bake_desktop.fragment
2025-12-28 18:29:25 +03:00

21 lines
894 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Fragment Shader (Bake Stage)
varying vec2 TexCoord;
varying float vHeight;
varying vec3 vWorldNormal;
uniform sampler2D Texture; // Текстура камня (rock.png)
uniform vec3 uLightDir; // Направление света для базового затенения камней при запекании
void main()
{
vec4 stoneColor = texture2D(Texture, TexCoord);
// Простое Lambert-освещение, чтобы камни не были "плоскими" в текстуре
//float diff = max(dot(normalize(vWorldNormal), normalize(uLightDir)), 0.3);
float diff = 1.0;
// RGB - цвет камня с учетом света, A - нормализованная высота
//gl_FragColor = vec4(stoneColor.rgb * diff, vHeight);
gl_FragColor = vec4(vHeight, vHeight, vHeight, vHeight);
//gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
}