|
47 | 47 | #include "UnityCG.cginc"
|
48 | 48 | #include "Include/TricubicSampling.cginc"
|
49 | 49 |
|
50 |
| - #define AMBIENT_LIGHTING_FACTOR 0.5 |
| 50 | + #define AMBIENT_LIGHTING_FACTOR 0.2 |
51 | 51 | #define JITTER_FACTOR 5.0
|
52 | 52 |
|
53 | 53 | struct vert_in
|
|
252 | 252 | // Optimised version of: if(dot(normal, eyeDir) < 0.0) normal *= -1.0
|
253 | 253 | normal *= (step(0.0, dot(normal, eyeDir)) * 2.0 - 1.0);
|
254 | 254 |
|
255 |
| - float ndotl = max(lerp(0.0f, 1.5f, dot(normal, lightDir)), AMBIENT_LIGHTING_FACTOR); |
| 255 | + float ndotl = max(dot(normal, lightDir), 0.0f); |
256 | 256 | float3 diffuse = ndotl * col;
|
| 257 | + float3 ambient = AMBIENT_LIGHTING_FACTOR * col; |
257 | 258 | float3 v = eyeDir;
|
258 | 259 | float3 r = normalize(reflect(-lightDir, normal));
|
259 | 260 | float rdotv = max( dot( r, v ), 0.0 );
|
260 | 261 | float3 specular = pow(rdotv, 32.0f) * float3(1.0f, 1.0f, 1.0f) * specularIntensity;
|
261 |
| - return diffuse + specular; |
| 262 | + float3 result = diffuse + ambient + specular; |
| 263 | + return float3(min(result.r, 1.0f), min(result.g, 1.0f), min(result.b, 1.0f)); |
262 | 264 | }
|
263 | 265 |
|
264 | 266 | float calculateShadow(float3 pos, float3 lightDir)
|
|
355 | 357 | #if defined(TF2D_ON) || defined(LIGHTING_ON)
|
356 | 358 | float3 gradient = getGradient(currPos);
|
357 | 359 | float gradMag = length(gradient);
|
| 360 | + |
358 | 361 | float gradMagNorm = gradMag / 1.75f;
|
359 | 362 | #endif
|
360 | 363 |
|
|
0 commit comments