git-svn-id: svn://db.shs.com.ru/libs@45 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
in vec3 src_normal, normal;//, et;
|
||||
in vec4 pos;
|
||||
in float fogCoord;
|
||||
in mat3 TBN;
|
||||
|
||||
uniform bool acc_fog;
|
||||
uniform vec2 dt;
|
||||
@@ -18,10 +19,14 @@ void main(void) {
|
||||
//if (acc_fog) dc.xyz = mix(dc.rgb, gl_Fog.color.rgb, fogCoord);
|
||||
|
||||
vec3 n, dn;
|
||||
dn = (texture2D(qgl_Material.map_bump.map, tc).rgb - vec3(0.5, 0.5, 1.)) * qgl_Material.map_bump.amount + qgl_Material.map_bump.offset;
|
||||
dn.x = -dn.x;
|
||||
dn = dn * mat3(qgl_ModelViewMatrixInverse);
|
||||
n = normalize(normal - dn);
|
||||
dn = (texture2D(qgl_Material.map_normal.map, tc).rgb - vec3(0.5, 0.5, 1.)) * qgl_Material.map_normal.amount + qgl_Material.map_normal.offset;
|
||||
//float tx = dn.x;
|
||||
dn.y = -dn.y;
|
||||
//dn.y = tx;
|
||||
dn = TBN * dn;
|
||||
//dn = dn * mat3(qgl_ModelViewMatrix)*10;//*(mat3(qgl_NormalMatrix));
|
||||
n = normalize(qgl_NormalMatrix*(normal+dn));//normalize(qgl_NormalMatrix * (normal - dn));
|
||||
//n = dn;
|
||||
|
||||
/*vec2 dpm = normalize(gl_FragCoord.xy * dt * 2. - vec2(1., 1.)), ntc;
|
||||
ntc = gl_FragCoord.xy * dt * 2. - vec2(1., 1.) + dpm * hei;
|
||||
@@ -32,16 +37,15 @@ void main(void) {
|
||||
dc *= texture2D(qgl_Material.map_diffuse.map, tc) * qgl_Material.map_diffuse.amount + qgl_Material.map_diffuse.offset;
|
||||
|
||||
vec4 spec = texture2D(qgl_Material.map_specular.map, tc) * qgl_Material.map_specular.amount + qgl_Material.map_specular.offset;
|
||||
spec *= qgl_Material.color_specular * qgl_Material.specular;
|
||||
vec4 rough = texture2D(qgl_Material.map_roughness.map, tc) * qgl_Material.map_roughness.amount + qgl_Material.map_roughness.offset;
|
||||
rough *= qgl_Material.roughness;
|
||||
spec *= qgl_Material.color_specular;
|
||||
vec4 specularity = texture2D(qgl_Material.map_specularity.map, tc) * qgl_Material.map_specularity.amount + qgl_Material.map_specularity.offset;
|
||||
vec4 self = texture2D(qgl_Material.map_self_illumination.map, tc) * qgl_Material.map_self_illumination.amount + qgl_Material.map_self_illumination.offset;
|
||||
self *= qgl_Material.color_self_illumination;
|
||||
|
||||
qgl_FragData[0] = vec4(dc.rgb, z);
|
||||
qgl_FragData[1] = vec4(n.xyz / 2. + vec3(0.5), rough);
|
||||
qgl_FragData[1] = vec4(n.xyz / 2. + vec3(0.5), specularity);
|
||||
qgl_FragData[2] = vec4(spec.rgb, hei);
|
||||
qgl_FragData[3] = vec4(pos.xyz, pos.z);
|
||||
qgl_FragData[3] = vec4(self.rgb, pos.w);
|
||||
|
||||
//gl_FragData[0] = vec4(et.xyz, pos.w);
|
||||
//gl_FragDepth = gl_FragCoord.z - clamp(hei / pos.z / pos.z / (abs(n.z) + 1), -0.01, 0.01);
|
||||
|
||||
Reference in New Issue
Block a user