commit 93ecb2074962988698bda78eeb1a7dc87dbbda25
parent 9bdcd6a7afa5feab002d9d8e02682eb911026853
Author: William Casarin <jb55@jb55.com>
Date: Sun, 23 Sep 2018 13:50:01 -0700
lightning looks better when it's fixed for now
Diffstat:
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/etc/shaders/test.f.glsl b/etc/shaders/test.f.glsl
@@ -46,13 +46,6 @@ float lambert(vec3 N, vec3 L)
void main() {
float distance = length(v_ray);
vec3 light_position = vec3(2.0,1.0,5.0);
- vec3 light_diffuse = vec3(0.1);
-
- vec3 diffuse;
- if (diffuse_on)
- diffuse = light_diffuse * lambert(v_normal, light_position);
- else
- diffuse = vec3(0.0,0.0,0.0);
vec3 color;
@@ -66,5 +59,5 @@ void main() {
color = frag;
// fragmentColor = vec4(color + diffuse, 1.0);
- fragmentColor = vec4(color + diffuse, 1.0);
+ fragmentColor = vec4(color, 1.0);
}
diff --git a/etc/shaders/test.v.glsl b/etc/shaders/test.v.glsl
@@ -20,11 +20,11 @@ out vec3 v_ray;
void main()
{
- vec4 v4_normal = vec4(normal, 1);
+ vec4 v4_normal = vec4(normal , 1);
vec4 trans_normal = normal_matrix * v4_normal;
vec4 v4_pos = vec4(position, 1.0);
gl_Position = mvp * v4_pos;
- v_light = dot(trans_normal, vec4(normalize(light_dir), 0));
+ v_light = dot(normal, normalize(light_dir));
// if (position.z <= 1.0)
// v_color = vec3(0.0, 0.5, 0.79);
@@ -39,7 +39,7 @@ void main()
// else
// v_color = vec3(1.0, 1.0, 1.0) * 0.9;
- v_color = vec3(position.z*0.05, position.z*0.005, position.z*0.0001) * 0.5;
+ v_color = vec3(0.2 + position.z*0.05, position.z*0.005, position.z*0.0001) * 0.5;
v_normal = trans_normal.xyz;
v_ray = camera_position - (world * v4_pos).xyz;