New emission-map algorithm

Former-commit-id: a45adb79b885d41a2d461a1d672fc8f63dedff65
This commit is contained in:
Lynix 2013-05-25 10:07:55 +02:00
parent 5f36817209
commit 810b45fbb7
1 changed files with 3 additions and 2 deletions

View File

@ -289,8 +289,9 @@ namespace
if (flags & nzShaderFlags_EmissiveMapping)
{
sourceCode += "vec3 emission = vec3(" + textureLookupKW + "(MaterialEmissiveMap, vTexCoord));\n"
+ fragmentColorKW + " = vec4(mix(lighting, emission, max(0.0, 1.0-length(light))), alpha);\n";
sourceCode += "float intensity = light.r*0.3 + light.g*0.59 + light.b*0.11;\n"
"vec3 emission = vec3(" + textureLookupKW + "(MaterialEmissiveMap, vTexCoord));\n"
+ fragmentColorKW + " = vec4(mix(lighting, emission, clamp(1.0 - 3.0*intensity, 0.0, 1.0)), alpha);\n";
///NOTE: Pour un shader avec un coût réduit avec une qualité moyenne, il est possible de remplacer "length(light)" par "dot(light, light)"
}
else