git-svn-id: svn://db.shs.com.ru/libs@703 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -1,31 +1,34 @@
|
||||
// vert //
|
||||
|
||||
out vec3 view_dir;
|
||||
out vec3 view_dir, world_dir;
|
||||
|
||||
uniform vec4 view_corners[4];
|
||||
uniform vec4 view_corners[4], world_corners[4];
|
||||
|
||||
void main(void) {
|
||||
qgl_FragTexture = qgl_Texture;
|
||||
gl_Position = qgl_ftransform();
|
||||
view_dir = view_corners[gl_VertexID].xyz;
|
||||
view_dir = view_corners [gl_VertexID].xyz;
|
||||
world_dir = world_corners[gl_VertexID].xyz;
|
||||
}
|
||||
|
||||
|
||||
// frag //
|
||||
|
||||
in vec3 view_dir;
|
||||
in vec3 view_dir, world_dir;
|
||||
|
||||
uniform vec2 dt;
|
||||
uniform float z_near;
|
||||
uniform sampler2D tex_coeffs[2];
|
||||
uniform sampler2D tex_0, tex_1, tex_2, tex_3, tex_4;
|
||||
uniform samplerCube tex_env;
|
||||
uniform int lights_start, lights_count;
|
||||
|
||||
uniform vec4 fog_color = vec4(0.5, 0.5, 0.5, 1);
|
||||
uniform float fog_decay = 10, fog_density = 0;
|
||||
uniform mat3 view_mat;
|
||||
|
||||
const vec3 luma = vec3(0.299, 0.587, 0.114);
|
||||
const float _min_rough = 1.e-8;
|
||||
const float _min_rough = 1.e-8, max_lod = 8;
|
||||
|
||||
vec4 pos, lpos, shp;
|
||||
vec3 li, si, ldir, halfV, bn, bn2, lwdir;
|
||||
@@ -154,11 +157,14 @@ void main(void) {
|
||||
li *= (1 - shlick);
|
||||
alpha = min(1, alpha * (1 + shlick));
|
||||
|
||||
vec2 brdf = texture(tex_coeffs[0], vec2(NdotV*0.99, roughness3*0.995)).rg;
|
||||
vec2 brdf = texture(tex_coeffs[0], vec2(NdotV*0.99, roughness*0.995)).rg;
|
||||
float env_spec = shlick * brdf.x + brdf.y;
|
||||
vec3 spec_col = mix(vec3(1), diffuse, metalness);
|
||||
vec3 env_dir = view_mat * reflect(-v, normal);
|
||||
vec3 env_col = textureLod(tex_env, env_dir, sqrt(roughness) * max_lod).rgb * spec_col;
|
||||
|
||||
vec3 res_col = max(vec3(0), li * diffuse + si * mix(vec3(1), diffuse, metalness) + emission);
|
||||
res_col = mix(res_col, fog_color.rgb, env_spec);
|
||||
vec3 res_col = max(vec3(0), li * diffuse + si * spec_col + emission);
|
||||
res_col = mix(res_col, env_col, env_spec * reflectivity);
|
||||
|
||||
float plen = length(pos.xyz);
|
||||
float fog = 1 - exp(-plen / fog_decay);
|
||||
@@ -169,6 +175,7 @@ void main(void) {
|
||||
|
||||
//vec3 specular = prefilteredColor * (F * envBRDF.x + envBRDF.y);
|
||||
//qgl_FragColor.rgb = vec3(shlick * brdf.x + brdf.y);
|
||||
//qgl_FragColor.rgb = vec3(env_spec);
|
||||
//qgl_FragColor.rgb = vec3(1-GeometrySchlickGGX(dot(normal, v),roughness));
|
||||
//qgl_FragColor.rgb = vec3(alpha);
|
||||
//qgl_FragColor.rgb = vec3(textureLod(tex_env, world_dir, 0).rgb);
|
||||
//qgl_FragColor.a = 1.;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user