Support for normal_only and spec_only decals in deferred mode

This commit is contained in:
dexy 2019-12-11 21:38:40 +11:00
parent 5672ea6dc3
commit 968a611aa9
3 changed files with 20 additions and 9 deletions

View File

@ -34,8 +34,10 @@ PS_OUTPUT main(VS_OUTPUT input)
}
if (IsDistMap) c = float4(c.rgb * 2, (c.r + c.g + c.b) - 1);
if (IsDecal == 4) c.a = c.r;
if ((IsDecal == 0) && (c.a <= 0.33)) discard;
if ((IsDecal == 1) && (c.a <= 0.0)) discard;
if ((IsDecal >= 3) && (c.a <= 0.0)) discard;
if (IsDecal == 0) c.a = 1;
if (IsDecal == 2)
{
@ -49,7 +51,7 @@ PS_OUTPUT main(VS_OUTPUT input)
{
c.rgb *= input.Tint.rgb;
}
if (IsDecal == 1)
if ((IsDecal == 1) || (IsDecal >= 3))
{
c.a *= input.Colour0.a;
}
@ -157,12 +159,16 @@ PS_OUTPUT main(VS_OUTPUT input)
c.a = saturate(c.a);
float4 a = c.aaaa;
if(IsDecal==3) a.xzw = 0; //normal_only
if(IsDecal==4) a.xyw = 0; //spec_only
PS_OUTPUT output;
output.Diffuse = c;
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
output.Specular = float4(spec, c.a);
output.Irradiance = float4(input.Colour0.rg, emiss, c.a);
output.Diffuse = float4(c.rgb, a.x);
output.Normal = float4(saturate(norm * 0.5 + 0.5), a.y);
output.Specular = float4(spec, a.z);
output.Irradiance = float4(input.Colour0.rg, emiss, a.w);
return output;
}

View File

@ -730,11 +730,16 @@ namespace CodeWalker.Rendering
case 731050667: //weapon_normal_spec_palette.sps
if (usetint) { tintflag = 0; pstintflag = 2; } //use diffuse sampler alpha for tint lookup!
break;
case 3880384844://{decal_spec_only.sps}w
case 600733812://{decal_amb_only.sps}
case 2842248626://{spec_decal.sps}
case 2457676400://{reflect_decal.sps}
case 341123999://{decal_normal_only.sps}
case 2706821972://{mirror_decal.sps}
case 2457676400://{reflect_decal.sps}
decalflag = 3;
break;
case 3880384844://{decal_spec_only.sps}
case 2842248626://{spec_decal.sps}
decalflag = 4;
break;
case 600733812://{decal_amb_only.sps}
//if (RenderMode == WorldRenderMode.Default) usediff = false;
break;
case 2655725442://{decal_dirt.sps}

Binary file not shown.