Skip to content

Commit

Permalink
minor seraphim shader update
Browse files Browse the repository at this point in the history
specular reflection now sharper and more stripey. substituted commented out formula with shorter equivalent
  • Loading branch information
BlackYps authored Jan 2, 2020
1 parent a033ab9 commit a4219f8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions effects/mesh.fx
Original file line number Diff line number Diff line change
Expand Up @@ -2857,21 +2857,20 @@ float4 UnitFalloffPS_02( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows)
light = light + ( 1 - light ) * shadowFill;

// Calculate specular highlights of the sun
float3 reflection = reflect( sunDirection, normal);
float3 reflection = reflect(sunDirection, normal);
float specularAmount = saturate( dot( reflection, -vertex.viewDirection));
float3 phongAdditive = pow( specularAmount, 9) * specular.g * shadow * 0.7;
float3 phongAdditive = pow(specularAmount, 15) * (specular.g - 0.5) * shadow * 2.2;

// Calculate environment map reflection
float reflectivity = saturate(specular.r * 2.5); // Reduce artifacts of texture
environment *= reflectivity * fallOff.a;
float3 phongMultiplicative = light * environment * (1 - (diffuse.a * 0.5) ) * 0.7;
// float3 phongMultiplicative = light * environment * (1 - (diffuse.a * 0.5) ) * 0.7;

// Makes reflection more intense depending on the diffuse color. Could be cool, but
// looks like shit because the diffuse texture is not interpolated for unknown reasons
// TODO: find out why the diffuse texture is not interpolated
// float Amount = (diffuse.r + diffuse.g + diffuse.b) / 3;
// Amount = pow(Amount * 10, 0.3) * 2;
// Amount = 1.0 - (Amount * 0.25);
// Amount = 1.0 - pow(Amount, 0.3);
// phongMultiplicative *= (float3(0.5, 0.7, 0.9) + Amount);

float3 teamColSpec = NdotV * vertex.color.rgb * 2;
Expand All @@ -2880,7 +2879,7 @@ float4 UnitFalloffPS_02( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows)

// Combine all previous computations
float3 color = (diffuse.rgb + float3 (0.25,0.35,0.45)) * light * (1 - diffuse.a) * 0.4;
color += phongAdditive + phongMultiplicative + (teamColSpec.rgb * diffuse.a) + whiteness;
color += phongAdditive + environment + (teamColSpec.rgb * diffuse.a) + whiteness;

// Substitute all the computations on pure glowing parts with the pure brightness texture
// to get rid of reflections and shadows
Expand Down

0 comments on commit a4219f8

Please sign in to comment.