source: opengl-game/shaders/ship.frag@ f97c5e7

feature/imgui-sdl points-test
Last change on this file since f97c5e7 was 8e02b6b, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago

To move to a more generic way of updating the scene, rename updateUniformBuffers() to updateScene() in VulkanGame and move the code to copy the data into a new copyDataToMemory() function in VulkanUtils.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#version 450
2#extension GL_ARB_separate_shader_objects : enable
3
4//in vec3 position_eye, normal_eye, color, light_position_eye, light2_position_eye;
5layout(location = 0) in vec3 position_eye;
6layout(location = 1) in vec3 color;
7
8layout(location = 0) out vec4 outColor;
9
10// fixed point light properties
11vec3 Ls = vec3(1.0, 1.0, 1.0);
12vec3 Ld = vec3(1.0, 1.0, 1.0);
13vec3 La = vec3(0.2, 0.2, 0.2);
14
15// surface reflectance
16vec3 Ks = vec3(1.0, 1.0, 1.0);
17vec3 Kd = vec3(1.0, 1.5, 1.0);
18vec3 Ka = vec3(0.2, 0.2, 0.2);
19float specular_exponent = 100.0; // specular 'power'
20
21void main() {
22 // ambient intensity
23 vec3 Ia = La * Ka;
24
25 // ambient intensity
26 vec3 Ia2 = La * Ka;
27
28 //vec3 direction_to_light_eye = normalize(light_position_eye - position_eye);
29 //float dot_prod = max(dot(direction_to_light_eye, normal_eye), 0.0);
30
31 // diffuse intensity
32 //vec3 Id = Ld * color * dot_prod;
33
34 //vec3 direction_to_light2_eye = normalize(light2_position_eye - position_eye);
35 //float dot_prod2 = max(dot(direction_to_light2_eye, normal_eye), 0.0);
36
37 // diffuse intensity
38 //vec3 Id2 = Ld * color * dot_prod2;
39
40 //vec3 surface_to_viewer_eye = normalize(-position_eye);
41
42 //vec3 reflection_eye = reflect(-direction_to_light_eye, normal_eye);
43 //float dot_prod_specular = max(dot(reflection_eye, surface_to_viewer_eye), 0.0);
44 //float specular_factor = pow(dot_prod_specular, specular_exponent);
45
46 //vec3 reflection_eye2 = reflect(-direction_to_light2_eye, normal_eye);
47 //float dot_prod_specular2 = max(dot(reflection_eye2, surface_to_viewer_eye), 0.0);
48 //float specular_factor2 = pow(dot_prod_specular2, specular_exponent);
49
50 // specular intensity
51 //vec3 Is = Ls * Ks * specular_factor;
52 //vec3 Is2 = Ls * Ks * specular_factor2;
53
54 //frag_color = vec4((Is + Id + Ia + Is2 + Id2 + Ia2)/2, 1.0);
55 outColor = vec4(color, 1.0);
56}
Note: See TracBrowser for help on using the repository browser.