Working on planet
This commit is contained in:
1 parent
3887208b8d
commit
fe361885c0
10 files changed
+358
-227
No files matched your search
@@ -1,9 +1,22 @@
|
||||
//precision mediump float;
|
||||
varying vec3 color;
|
||||
varying vec3 color; // Цвет вершины (с шумом)
|
||||
varying vec3 normal;
|
||||
varying vec3 lightDirection_VS;
|
||||
varying vec2 TexCoord; // UV-координаты
|
||||
|
||||
void main()
|
||||
uniform sampler2D Texture;
|
||||
uniform vec3 uLightDirection;
|
||||
void main()
|
||||
{
|
||||
//gl_FragColor = vec4(color, 1.0);
|
||||
gl_FragColor = vec4(1.0, 1.0, 0.5, 1.0);
|
||||
|
||||
// 1. Получаем цвет из текстуры и смешиваем с цветовым шумом
|
||||
vec4 textureColor = texture2D(Texture, TexCoord);
|
||||
vec3 finalColor = textureColor.rgb * color;
|
||||
|
||||
// 3. Расчет освещения
|
||||
float diffuse = max(0.0, dot(normal, uLightDirection));
|
||||
float ambient = 0.2;
|
||||
float lightingFactor = min(1.0, ambient + diffuse);
|
||||
|
||||
|
||||
gl_FragColor = vec4(finalColor * lightingFactor, 1.0);
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user