planet distribution is nice now and one sun is always placed with bigger radius and space nearby.
This commit is contained in:
parent
f2bdadd49f
commit
0b71aad1f7
5 changed files with 86 additions and 45 deletions
|
|
@ -6,8 +6,9 @@ varying vec3 lightDirection;
|
|||
|
||||
uniform vec3 lightColor;
|
||||
uniform vec3 lightPosition;
|
||||
uniform float materialKind;
|
||||
uniform vec3 materialColor;
|
||||
uniform int materialKind;
|
||||
uniform int materialSeed;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -23,27 +24,15 @@ void main()
|
|||
}
|
||||
|
||||
// TODO: add noise texture
|
||||
vec3 IDiffuse = vec3(materialColor) * lightColor * max(dot(normal, lightDirection), 0.0);
|
||||
vec3 color = materialColor;
|
||||
color = max(vec3(0.0), min(vec3(1.0), color));
|
||||
|
||||
vec3 IDiffuse = vec3(color) * lightColor * max(dot(normal, lightDirection), 0.0);
|
||||
|
||||
// TODO make instensity/exponent as parameter
|
||||
//vec3 ISpecular = lightColor * 5.0 * pow(max(dot(Reflected, Eye), 0.0), 2.0);
|
||||
vec3 ISpecular = lightColor * pow(max(dot(Reflected, Eye), 0.0), 2.0);
|
||||
//vec3 ISpecular = lightColor * pow(max(dot(Reflected, Eye), 0.0), 2.0);
|
||||
|
||||
if (dot(lightDirection, normal) <= 0.0) {
|
||||
ISpecular = vec3(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
// p: point of the fragment on the surface
|
||||
//vec3 v_eye = normalize(pos_eye - pos_space); // point from p to eye
|
||||
//vec3 v_sun = normalize(sun_light_dir); // points from p to the sun
|
||||
|
||||
//float specular = spec_int * pow(
|
||||
// clamp(dot((v_eye + v_sun)/2.0, normal), 0.0, 1.0),
|
||||
// 2.0*specular_exponent);
|
||||
|
||||
//ISpecular = vec3(1.0, 0.0, 0.0) * specular;
|
||||
|
||||
//gl_FragColor = vec4(ISpecular, 1.0);
|
||||
gl_FragColor = vec4((IAmbient + IDiffuse) + ISpecular, 1.0);
|
||||
//gl_FragColor = vec4(0.5+0.5*normal, 1.0);
|
||||
//gl_FragColor = vec4((IAmbient + IDiffuse) + ISpecular, 1.0);
|
||||
gl_FragColor = vec4((IAmbient + IDiffuse), 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue