Add gamma correction, change illumination values
This commit is contained in:
@@ -15,20 +15,34 @@ const char * vs =
|
||||
"layout (location = 6) in float aNormal_z;"
|
||||
"layout (location = 7) in float aNormal_w;"
|
||||
|
||||
"uniform float idx;"
|
||||
"uniform uint idx;"
|
||||
|
||||
"uniform uint i;"
|
||||
"uniform float angle;"
|
||||
|
||||
"uniform mat4 fix;"
|
||||
"uniform mat4 rot;"
|
||||
"uniform mat4 mdl;"
|
||||
|
||||
"out float index;"
|
||||
"flat out uint index;"
|
||||
"out vec3 Normal;"
|
||||
"out vec3 FragPos;"
|
||||
|
||||
"mat2 rotate2d( float angle )"
|
||||
"{"
|
||||
"return mat2( cos(angle), sin(angle), -sin(angle), cos(angle) );"
|
||||
"}"
|
||||
|
||||
"void main()"
|
||||
"{"
|
||||
" index=idx;"
|
||||
|
||||
" vec3 aNormal = vec3(aNormal_x,aNormal_y,aNormal_z);"
|
||||
" vec3 aPos = vec3(aPos_x,aPos_y,aPos_z);"
|
||||
|
||||
" aNormal[i] = (vec2(aNormal_w, aNormal[i]) * rotate2d(angle))[0];"
|
||||
" aPos[i] = (vec2(aPos_w, aPos[i]) * rotate2d(angle))[0];"
|
||||
|
||||
" Normal = mat3(transpose(inverse(rot*mdl))) * aNormal;"
|
||||
" gl_Position = fix * rot * mdl * vec4( aPos, 1.0 );\n"
|
||||
" FragPos = vec3( rot * mdl * vec4(aPos, 1.0));"
|
||||
@@ -46,7 +60,7 @@ const char * fs_plain =
|
||||
#endif
|
||||
"uniform sampler2DArray palette;"
|
||||
|
||||
"in float index;"
|
||||
"flat in uint index;"
|
||||
"out vec4 FragColor;"
|
||||
"in vec3 Normal;"
|
||||
"in vec3 FragPos;"
|
||||
@@ -67,7 +81,7 @@ const char * fs =
|
||||
|
||||
"uniform sampler2DArray palette;"
|
||||
|
||||
"in float index;"
|
||||
"flat in uint index;"
|
||||
"in vec3 Normal;"
|
||||
"in vec3 FragPos;"
|
||||
|
||||
@@ -85,9 +99,9 @@ const char * fs =
|
||||
|
||||
" vec3 halfwayDir = normalize(lightDir + viewDir);\n"
|
||||
|
||||
" float specular = pow(max(dot(normalize(Normal), halfwayDir), 0.0), 16.0);\n"
|
||||
" float diffuse = max(dot(normalize(Normal), lightDir), 0.0);\n"
|
||||
" float specular = pow(abs(dot(normalize(Normal), halfwayDir)), 32.0);\n"
|
||||
" float diffuse = abs(dot(normalize(Normal), lightDir));\n"
|
||||
|
||||
" vec3 result = (0.5 + 0.5 * diffuse + specular) * color.rgb;\n"
|
||||
" FragColor = vec4(result, color.a);\n"
|
||||
" vec3 result = (0.5 + 1.5*diffuse + 4*specular) * color.rgb;\n"
|
||||
" FragColor = vec4(result, color.a)*1/2.2;\n"
|
||||
"}";
|
||||
|
||||
Reference in New Issue
Block a user